Skip to main content

ProMage

ProMage is the inference wrapper for the magnitude emulator used by GalSBI. End users provide galaxy physical properties and requested bands; ProMage loads opaque TorchScript resources and returns emulated magnitudes.

The public API intentionally does not expose the neural-network architecture, activation function, training loop, or scalers.

Each emulator instance is bound to one ProSpect star-formation-history (SFH) model. The SFH model passed to ProMage must be the same SFH model used to create the galaxy properties. Current resources provide massfunc_snorm_trunc and massfunc_snorm_burst_trunc.

Installation

Install the released package from PyPI with:

pip install promage

For development, install a local checkout in editable mode:

pip install -e .

If the Python environment has no network access but already contains the build dependencies, use:

pip install -e . --no-build-isolation

The magnitude-emulator resources are distributed separately through cosmo-torrent. In GalSBI-SPS, load them with data_path("ProMage_res").

Basic Usage

from promage import ProMage
from cosmo_torrent import data_path

emu = ProMage(
    data_path("ProMage_res"),
    sfh_model="massfunc_snorm_trunc",
)

mags = emu.predict(
    properties=properties,
    bands=["g_HSC", "r_HSC", "i_HSC"],
)

SFH-aware resources require sfh_model; omitting it or requesting an unavailable family raises an error rather than silently loading the wrong network. The selected family and all families in the resource can be inspected with emu.sfh_model and emu.available_sfh_models.

By default, predict uses frame="observed" and returns final observer-frame magnitudes. For artifacts trained as m_obs - DM(z), ProMage adds the fixed training distance modulus internally.

mags is a dictionary mapping each requested band to a NumPy array with the same shape as the input property arrays.

Absolute Magnitudes

Absolute/rest-frame magnitudes are requested with frame="absolute":

mags_abs = emu.predict(
    properties=properties,
    bands=["g_HSC", "r_HSC", "i_HSC"],
    frame="absolute",
)

Absolute-frame artifacts are trained directly on the ProSpect absolute_magnitudes dataset. No distance-modulus correction is applied to absolute-frame outputs.

Available frames and bands can be inspected with:

print(emu.available_frames)
print(emu.available_roles)
print(emu.available_bands)

Current Band Coverage

The current resource provides observer-frame and absolute magnitudes for:

HSC:   g_HSC, r_HSC, i_HSC, z_HSC, Y_HSC
VST:   u_VST, g_VST, r_VST, i_VST
VISTA: Z_VISTA, Y_VISTA, J_VISTA, H_VISTA, Ks_VISTA
DECam: DECam_g, DECam_r, DECam_i, DECam_z, DECam_y
LSST:  lsstcam_u, lsstcam_g, lsstcam_r, lsstcam_i, lsstcam_z, lsstcam_y
GALEX: FUV_GALEX, NUV_GALEX
Spitzer: I1_Spitzer, I2_Spitzer, I3_Spitzer, I4_Spitzer, M24_Spitzer, M70_Spitzer, M160_Spitzer
Herschel: P70_Herschel, P100_Herschel, P160_Herschel, S250_Herschel, S350_Herschel, S500_Herschel
WISE: W1_WISE, W2_WISE, W3_WISE, W4_WISE
PLANCK: PLANCK_LFI_030GHz, PLANCK_LFI_044GHz, PLANCK_LFI_070GHz, PLANCK_HFI_100GHz, PLANCK_HFI_143GHz, PLANCK_HFI_217GHz, PLANCK_HFI_353GHz, PLANCK_HFI_545GHz, PLANCK_HFI_857GHz
SO: SO_LF1_27GHz, SO_LF2_39GHz, SO_MF1_93GHz, SO_MF2_145GHz, SO_UHF1_225GHz, SO_UHF2_280GHz

ProSpect produces exactly zero observed u_VST flux for the current training samples at 4 <= z <= 5. The resource manifest therefore declares a constant observer-frame magnitude of 99 in those two redshift bins. This value is a zero-flux/nondetection sentinel, not a measured physical magnitude. Absolute u_VST magnitudes continue to use trained artifacts over the full redshift range.

Observed FUV_GALEX and NUV_GALEX magnitudes likewise use a constant 99 for 1 <= z <= 5, where those bins have no trained observed-flux model. Treat 99 as a zero-flux/nondetection sentinel, not as a physical magnitude. Absolute GALEX magnitudes remain model-predicted throughout 0 < z <= 5.

Selection Magnitudes

Some resources include a threshold-selection role. This is separate from the default precision magnitude emulators and is intended for broad sample selection over the full redshift range. Current resources provide i_HSC, i_VST, DECam_i, lsstcam_i, PLANCK_HFI_217GHz, and SO_MF1_93GHz selection artifacts for both SFH families. The optical selectors use a magnitude threshold of 32; the PLANCK and SO selectors use a threshold of 50. Query the resource for the authoritative value:

i_selection = emu.predict(
    properties=properties,
    bands=["i_HSC"],
    role="selection",
)["i_HSC"]

threshold = emu.selection_threshold("i_HSC")
selected = i_selection < threshold

The default role is role="magnitude", so existing calls to predict(...) are unchanged. The selection role should not be treated as the final precision magnitude estimate for all downstream photometry.

Inputs

The resource manifest defines the required properties. Current ProSpect Latin-hypercube resources use:

[
    "z",
    "logmSFR",
    "mpeak",
    "logmperiod",
    "mskew",
    "logZfinal",
    "logtaubirth",
    "logtauscreen",
    "alphabirth",
    "alphascreen",
    "logU",
]

The massfunc_snorm_burst_trunc family additionally requires logfburst, defined as log10(fburst), where fburst = M_burst / (M_smooth + M_burst). The manifest supplies the required property ordering internally.

All arrays must have the same shape. Redshifts must lie inside the resource domain, typically 0 < z <= 5.

Return Formats

The default return format is a dictionary:

{
    "g_HSC": np.ndarray,
    "r_HSC": np.ndarray,
    "i_HSC": np.ndarray,
}

An array can be requested with:

mag_array = emu.predict(
    properties=properties,
    bands=["g_HSC", "r_HSC", "i_HSC"],
    return_format="array",
)

The final axis follows the order of the requested bands.

Resource Directory

ProMage(...) expects a directory containing a manifest.json and its referenced TorchScript .pt artifacts. A manifest can also contain explicit constant-output redshift bins for physically defined zero-flux cases.

An SFH-aware resource directory looks like:

manifest.json
models/
  massfunc_snorm_trunc/
    observed/
      magnitude/
        g_HSC/
          z0p0_0p5.pt
          z0p5_1p0.pt
          ...
        r_HSC/
          ...
      selection/
        i_HSC/
          z0p0_5p0.pt
    absolute/
      magnitude/
        g_HSC/
          z0p0_0p5.pt
          z0p5_1p0.pt
          ...
        r_HSC/
          ...
  massfunc_snorm_burst_trunc/
    ...

SFH families, observer-frame artifacts, and absolute-frame artifacts can coexist in the same ProMage_res directory because each has a distinct model path.

Legacy manifests without explicit SFH families remain supported through ProMage(resource_dir). They cannot be safely assigned to a named SFH at load time; regenerate those resources to obtain an SFH-aware manifest. Legacy manifests without explicit roles are treated as role="magnitude".

Cosmology

The training data use a fixed flat LambdaCDM cosmology:

H0 = 67.8
Omega_M = 0.308
Tcmb0 = 2.725

The package uses Astropy:

from astropy.cosmology import FlatLambdaCDM

FlatLambdaCDM(H0=67.8, Om0=0.308, Tcmb0=2.725)

The distance-modulus correction is applied only for observer-frame artifacts whose target convention is obs_minus_dm.

Out-of-Range Redshifts

By default, ProMage raises an error if a redshift is outside the manifest domain:

emu = ProMage(
    data_path("ProMage_res"),
    sfh_model="massfunc_snorm_trunc",
    on_out_of_range="raise",
)

To leave out-of-range predictions as NaN:

emu = ProMage(
    data_path("ProMage_res"),
    sfh_model="massfunc_snorm_trunc",
    on_out_of_range="nan",
)

License

ProMage is distributed under the MIT License. See LICENSE.

Metadata

Release files for promage 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for promage 0.6.0
File Size Uploaded Provenance
promage-0.6.0.tar.gz 19.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for promage 0.6.0
File Interpreter ABI Platform
promage-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.9 kB

Release files / promage-0.6.0.tar.gz

Download URL promage-0.6.0.tar.gz
Size 19.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3c88e591072b8de040a71490f3d637341dc2d6db0cfe3d582d9149d9d08c2b10
BLAKE2b-256 checksum
How to use checksums
92dcba3b6d5a935f47f1fe21f3f090a6864005102fba75b42770a169c1ea092d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.11

Release files / promage-0.6.0-py3-none-any.whl

Download URL promage-0.6.0-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd07f6d0424311a1e6ca4e63bf9e6ae341653f5f1f009f8a48aa211dbdb287f3
BLAKE2b-256 checksum
How to use checksums
189de03944a56a1e49e4501487c24d04a4a4f655c5526c0bc13ab2243e657351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.11

Security for promage 0.6.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page