Skip to content

Commit

Permalink
ENH: command line interface (#72)
Browse files Browse the repository at this point in the history
Implementation of the Heracles command line interface (CLI). The CLI is
meant to make it quick and easy to perform a "standard" analysis of
catalogues, that is: obtaining angular power spectra, mixing matrices,
and eventually jackknife covariances.

The CLI uses a configuration file (default file name `heracles.cfg`), of
which an example is provided in the `examples/` folder.

The analysis itself uses a series of commands that build up e.g. angular
power spectra:

    heracles alms myalms.fits
    heracles spectra myspectra.fits myalms.fits
    heracles mixmats mymixmats.fits myalms.fits

The following commands are currently implemented:

* `maps` -- create HEALPix maps from catalogues
* `alms` -- compute spherical harmonic coefficients (alms); either from
catalogues or pre-computed maps
* `spectra` -- compute angular power spectra from alms
* `mixmats` -- compute mixing matrices

There is help available for every command (`heracles <cmd> -h`).

Closes: #56
  • Loading branch information
ntessore authored Jan 30, 2024
1 parent 2e484f0 commit 58c882c
Show file tree
Hide file tree
Showing 7 changed files with 1,385 additions and 4 deletions.
1 change: 1 addition & 0 deletions .commitlint.rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = {
"always",
[
"catalog",
"cli",
"core",
"covariance",
"io",
Expand Down
72 changes: 72 additions & 0 deletions examples/heracles.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# example config file for Heracles
# values from [defaults] are applied to all sections

[defaults]
lmin = 10
bins = 32 log 2l+1

[spectra:clustering]
include = D, D
lmax = 2000
l2max = 4000

[spectra:shear]
include =
G_E, G_E
G_B, G_B
G_E, G_B
lmax = 3000
l2max = 5000

[spectra:ggl]
include =
D, G_E
D, G_B
lmax = 1000
l2max = 2000

[fields:D]
type = positions
columns =
SHE_RA
SHE_DEC
mask = V
nside = 2048
lmax = 2000

[fields:G]
type = shears
columns =
SHE_RA
SHE_DEC
SHE_E1_CAL
-SHE_E2_CAL
SHE_WEIGHT
mask = W
nside = 2048
lmax = 3000

[fields:V]
type = visibility
nside = 4096
lmax = 6000

[fields:W]
type = weights
columns =
SHE_RA
SHE_DEC
SHE_WEIGHT
nside = 8192
lmax = 8000

[catalogs:fs2-dr1n-noia]
source = catalog.fits
selections =
0 = TOM_BIN_ID==0
1 = TOM_BIN_ID==1
2 = TOM_BIN_ID==2
visibility =
0 = vmap.0.fits
1 = vmap.1.fits
2 = vmap.2.fits
25 changes: 25 additions & 0 deletions heracles/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Heracles: Euclid code for harmonic-space statistics on the sphere
#
# Copyright (C) 2023 Euclid Science Ground Segment
#
# This file is part of Heracles.
#
# Heracles is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Heracles is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with Heracles. If not, see <https://www.gnu.org/licenses/>.
"""Executable module."""

import sys

from .cli import main

sys.exit(main())
Loading

0 comments on commit 58c882c

Please sign in to comment.