cosmotron_mcp.tools.maps¶
make_shear_map ¶
make_shear_map(ra: list, dec: list, e1: list, e2: list, weights: list, nside: int = 512, chunk_rows: int = 5000000) -> dict
Project a weak-lensing shear catalogue onto HEALPix Q and U maps.
Each occupied pixel receives the weighted mean ellipticity components
Q[p] = sum(w_i * e1_i) / sum(w_i) U[p] = sum(w_i * e2_i) / sum(w_i)
Pixels with no objects are set to zero in Q, U, and the mask.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
list
|
Object right ascension in degrees. |
required |
dec
|
list
|
Object declination in degrees. |
required |
e1
|
list
|
Per-galaxy first ellipticity component (must be finite; typically |e| <= 1). |
required |
e2
|
list
|
Per-galaxy second ellipticity component (must be finite; typically |e| <= 1). |
required |
weights
|
list
|
Per-object weights (must be non-negative). |
required |
nside
|
int
|
HEALPix resolution parameter (must be a power of two). |
512
|
chunk_rows
|
int
|
Row-chunk size for the pixel accumulation (bounds peak transient memory for large catalogues). Purely mechanical — bit-identical output for any value; only change it for very large catalogues. |
5000000
|
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
mean e1 per pixel), |
dict
|
mean e2 per pixel), |
dict
|
float 0/1), |
dict
|
pixel), |
dict
|
(int), |
dict
|
shape noise RMS), |
dict
|
[sr⁻¹], Heymans+2012), |
dict
|
to [arcmin⁻²]). |
Source code in cosmotron_mcp/server.py
make_healpix_map ¶
make_healpix_map(ra: list, dec: list, weights: list, nside: int = 512, chunk_rows: int = 5000000) -> dict
Project a galaxy catalogue onto a HEALPix overdensity map.
Returns dict with delta_map, survey_mask, n_bar, f_sky, nside, npix. Note: delta_map and survey_mask are large numpy arrays serialised as lists. Prefer run_power_spectrum / compute_cls_from_session for end-to-end runs. Use this only when you need the raw map for downstream custom steps.
chunk_rows: row-chunk size for the pixel accumulation (bounds peak transient memory for large catalogues). Purely mechanical — bit-identical output for any value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra
|
list
|
Object right ascension in degrees. |
required |
dec
|
list
|
Object declination in degrees. |
required |
weights
|
list
|
Per-object weights. |
required |
nside
|
int
|
HEALPix resolution parameter. |
512
|
chunk_rows
|
int
|
Row-chunk size for the pixel accumulation. |
5000000
|
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
|
Source code in cosmotron_mcp/server.py
make_healpix_mask ¶
make_healpix_mask(nside: int, mask_fits_path: str | None = None, full_sky: bool = False, apodise: bool = False, apodisation_scale: float = 0.5, apodisation_type: str = 'C1') -> dict
Load or construct a HEALPix mask, optionally apodise it.
Either full_sky=True or mask_fits_path must be provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nside
|
int
|
HEALPix resolution parameter. |
required |
mask_fits_path
|
str | None
|
Path to a HEALPix mask FITS file. |
None
|
full_sky
|
bool
|
Use a full-sky mask of ones instead of loading a file. |
False
|
apodise
|
bool
|
Apply C1 mask apodisation. |
False
|
apodisation_scale
|
float
|
Apodisation scale in degrees. |
0.5
|
apodisation_type
|
str
|
NaMaster apodisation type (default |
'C1'
|
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
|
Source code in cosmotron_mcp/server.py
make_namaster_field ¶
make_namaster_field(delta_map: list, mask: list, lmax: int, templates: list | None = None, spin: int = 0, field_maps_b: list | None = None) -> dict
Validate parameters for a NaMaster field and return metadata.
Dry-run validation — does NOT return an NmtField (not JSON-serialisable). Call this to confirm delta_map/mask/lmax/templates are mutually consistent before committing to a full run_power_spectrum call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delta_map
|
list
|
HEALPix map (Q/E component for spin-2). |
required |
mask
|
list
|
HEALPix survey mask. |
required |
lmax
|
int
|
Maximum multipole. |
required |
templates
|
list | None
|
Optional systematics template maps to check for deprojection compatibility. |
None
|
spin
|
int
|
Field spin weight (0 or 2). |
0
|
field_maps_b
|
list | None
|
Second spin component (U-map) when spin=2. |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
|
Source code in cosmotron_mcp/server.py
resample_healpix_map ¶
resample_healpix_map(input_path: str, nside_out: int, output_path: str | None = None, is_mask: bool = False) -> dict
Up/downgrade a HEALPix map or mask to nside_out (deterministic ud_grade).
Use this when a supplied mask/map is at a DIFFERENT HEALPix resolution than the
analysis nside (which is global, pinned in session_context.json). The
session-driven power-spectrum and covariance tools already reconcile a
mismatched mask automatically on read; call this only to materialise a
resampled map on disk (e.g. register a mask at the session nside). If the input
is already at nside_out it is returned unchanged (no file written).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_path
|
str
|
Path to the input HEALPix map/mask FITS file. |
required |
nside_out
|
int
|
Target HEALPix resolution. |
required |
output_path
|
str | None
|
Destination path; defaults next to |
None
|
is_mask
|
bool
|
Use nearest-neighbour-safe resampling appropriate for a binary/weight mask rather than a continuous map. |
False
|
Returns:
| Type | Description |
|---|---|
dict
|
|