Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-208: new configuration format #215

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

gh-208: new configuration format #215

wants to merge 5 commits into from

Conversation

ntessore
Copy link
Contributor

@ntessore ntessore commented Nov 24, 2024

Implements a new "configuration" format. This can be used for both CLI and pipeline. Still work in progress.

Closes: #208

@ntessore ntessore linked an issue Nov 24, 2024 that may be closed by this pull request
@ntessore
Copy link
Contributor Author

After discussion with @JaimeRZP today: here is the proposed config in TOML form:

# example config file for Heracles

[[catalogs]]
fields = ["POS", "VIS"]
label = "position catalogue"
selections = [
    {key = 1, selection = "POS_TOM_BIN_ID==1", visibility = "visibility.1.fits"},
    {key = 2, selection = "POS_TOM_BIN_ID==2", visibility = "visibility.2.fits"},
    {key = 3, selection = "POS_TOM_BIN_ID==3", visibility = "visibility.3.fits"},
]
source = "pos_catalog.fits"

[[catalogs]]
fields = ["SHE", "WHT"]
label = "shear catalogue"
selections = [
    {key = 1, selection = "TOM_BIN_ID==1"},
    {key = 2, selection = "TOM_BIN_ID==2"},
    {key = 3, selection = "TOM_BIN_ID==3"},
]
source = "she_catalog.fits"
visibility = "coverage.fits" # global visibility for this catalogue

[[fields]]
key = "POS"
type = "positions"
columns = ["RIGHT_ASCENSION", "DECLINATION"]
mask = "VIS"
mapper = "healpix" # default, requires healpy
lmax = 2000
nside = 2048

[[fields]]
key = "VIS"
type = "visibility"
lmax = 6000 # maximum lmax + l2max from spectra involving POS
nside = 4096

[[fields]]
key = "SHE"
type = "shears"
columns = ["SHE_RA", "SHE_DEC", "SHE_E1_CAL", "-SHE_E2_CAL", "SHE_WEIGHT"]
mask = "WHT"
mapper = "discrete" # requires ducc, no nside here
lmax = 3000

[[fields]]
key = "WHT"
type = "weights"
columns = ["SHE_RA", "SHE_DEC", "SHE_WEIGHT"]
lmax = 8000 # maximum lmax + l2max from spectra involving SHE
nside = 8192

[[spectra]]
# galaxy clustering
key = "POS-POS" # can use string syntax here
lmin = 10 # used only when doing angular binning
lmax = 2000
l2max = 4000 # mixing matrix: number of columns
l3max = 6000 # lmax + l2max is the default
bins = 32 # angular binning
spacing = "log" # angular binning
weights = "2l+1" # angular binning

[[spectra]]
# cosmic shear
key = "SHE-SHE"
lmin = 10
lmax = 3000
l2max = 5000
bins = 32
spacing = "log"
weights = "2l+1"

[[spectra]]
# galaxy-galaxy lensing
key = ["POS", "SHE"] # can also use sequence
lmin = 10
lmax = 1000
l2max = 2000
bins = 32
spacing = "log"
weights = "2l+1"

And here the exact same in YAML form:

catalogs:
- fields: [POS, VIS]
  label: position catalogue
  selections:
  - key: 1
    selection: POS_TOM_BIN_ID==1
    visibility: visibility.1.fits
  - key: 2
    selection: POS_TOM_BIN_ID==2
    visibility: visibility.2.fits
  - key: 3
    selection: POS_TOM_BIN_ID==3
    visibility: visibility.3.fits
  source: pos_catalog.fits
- fields: [SHE, WHT]
  label: shear catalogue
  selections:
  - key: 1
    selection: TOM_BIN_ID==1
  - key: 2
    selection: TOM_BIN_ID==2
  - key: 3
    selection: TOM_BIN_ID==3
  source: she_catalog.fits
  visibility: coverage.fits
fields:
- key: POS
  type: positions
  columns: [RIGHT_ASCENSION, DECLINATION]
  mask: VIS
  mapper: healpix
  lmax: 2000
  nside: 2048
- key: VIS
  type: visibility
  lmax: 6000
  nside: 4096
- key: SHE
  type: shears
  columns: [SHE_RA, SHE_DEC, SHE_E1_CAL, -SHE_E2_CAL, SHE_WEIGHT]
  mask: WHT
  mapper: discrete
  lmax: 3000
- key: WHT
  type: weights
  columns: [SHE_RA, SHE_DEC, SHE_WEIGHT]
  lmax: 8000
  nside: 8192
spectra:
- key: POS-POS
  lmin: 10
  lmax: 2000
  l2max: 4000
  l3max: 6000
  bins: 32
  spacing: log
  weights: 2l+1
- key: SHE-SHE
  lmin: 10
  lmax: 3000
  l2max: 5000
  bins: 32
  spacing: log
  weights: 2l+1
- key: [POS, SHE]
  lmin: 10
  lmax: 1000
  l2max: 2000
  bins: 32
  spacing: log
  weights: 2l+1

I find the TOML is slightly more readable, because the splitting into "groups" helps information overload. But the YAML could maybe be separated visually with additional whitespace, and I have no strong feelings one way or the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configuration format
1 participant