CirrusMachine
Galactic cirrus synthesis and diffuse emission recovery with a coarse guide map and wavelet scattering statistics.
Install
Python 3.10+:
python -m pip install cirrusmachine
# Optional notebook environment:
python -m pip install "cirrusmachine[examples]"
The [examples] extra adds notebook dependencies; download the notebook and
optional input files separately.
CirrusMachine includes a private copy of Cheng's scattering package.
The cirrusmachine._scattering_synthesis adapter
retains the local image-increment optimization separately.
The default device="auto" uses CUDA when available and otherwise CPU. Setting device="cpu" to use CPU only.
GPU use is optional and requires a compatible driver and a CUDA-enabled PyTorch build. Apple Silicon Mac's MPS is unsupported.
Example
The notebook the modeling notebook demonstrates an examplefor diffuse light injection, one representative cirrus realization with 100 optimization steps, and surface-brightness and cumulative-flux comparisons.
example_helpers.py contains input and plotting helper function for the example.
To run the example, keep the optional input bundle in
examples/inputs/: Optical.fits, Mask.fits, FIR.fits, PSF.npz, and
inputs.json (or set CIRRUSMACHINE_DATA). The notebook will create
examples/output/ for generated files, including the caches (statistics.npz).
A Google Colab T4 GPU test of the 100-step example is about 8–9× faster in preparation/calibration and 4–5× faster in modeling than the CPU backend on the same Colab host (2 vCPUs).
Main usage
from cirrusmachine import modeling as cm
cm.configure_logging("INFO")
config = cm.load_config("examples/modeling.yaml")
# Calibrate image statistics and the FIR coarse-guide backbone constraint.
statistics = cm.calibrate_statistics(field, config)
beam = cm.prepare_backbone_constraint(
field, inputs["coarse_image"], inputs["coarse_error"],
inputs["coarse_coverage"], inputs["coarse_mask"], inputs["coarse_WCS"], config,
effective_FWHM=inputs["metadata"]["effective_FWHM"],
)
# Build the cirrus prior and generate initial realizations.
prior = cm.build_cirrus_prior(field, beam, statistics, config)
initial = cm.initialize_cirrus(prior, config)
# Model cirrus and diffuse light; select the first realization.
result = cm.run_cirrus_halo_modeling(field, prior, initial, config)[0]
corrected = result.corrected # Observed image with modeled cirrus subtracted.
- Passing
diffuse_model=MY_MODELtorun_cirrus_halo_modelingallows one to replace the default isophote fit with a callable matchingfit_diffuseinputs and(model_image, info)output (includinginfo["sky"]["value_ADU"]).
** For injection test, both Ie (at Re_arcsec) and I0 (central brightness)
are in mag/arcsec².
For a de Vaucouleurs profile injection: n=4, Re_arcsec=20, and
Ie=24.0:
injection = cm.prepare_injection(
field, [{"n": 4, "Re_arcsec": 20.0, "Ie": 24.0}],
SB_ZP=SB_ZP, PSF_native=inputs["PSF_detector"],
oversample=9, device=config.device,
)
field = injection.field
# Then calibrate and model this field.
In the example, the coarse guide is the source-clean FIR image from Herschel.
modeling.coarse handles coarse guide calibration.
modeling.diffuse provides fit for smooth diffuse light.
run_cirrus_halo_modeling do joint modeling on cirrus and diffuse light.
Metadata
Release files for cirrusmachine 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cirrusmachine-0.1.0.tar.gz | 1.1 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cirrusmachine-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.3 MB
Release files / cirrusmachine-0.1.0.tar.gz
| Download URL | cirrusmachine-0.1.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a82f967b6985d6930f3504c9aa1fe04bf798dd266503f1c12ca9cbe5cee4e22
|
|
BLAKE2b-256 checksum How to use checksums |
0159ac27179f8fb2a2a399da80411dee359765016f7341b6e1d183845a2bb739
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / cirrusmachine-0.1.0-py3-none-any.whl
| Download URL | cirrusmachine-0.1.0-py3-none-any.whl |
|---|---|
| Size | 107.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9b842c5d045c82cb131bd8791dc0e58ada14f6f6a9d0b9d1f58df8ef9c82808
|
|
BLAKE2b-256 checksum How to use checksums |
9e0bd9d2513e99b8f46a3a9fb0368eeb7f4118d99ba0db34d88bd320c6bf08b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for cirrusmachine 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.