streamobs.model module#
Models for simulating streams.
- class streamobs.model.BackgroundModel(config, **kwargs)[source]#
Bases:
StreamModelBackground model.
Methods
complete_catalog(catalog[, columns_to_add, ...])Complete only the requested columns in a catalog.
sample(size)Sample stream stars and derived quantities.
- class streamobs.model.ConfigurableModel(config, **kwargs)[source]#
Bases:
objectBaseclass for models built from configs.
Methods
sample
- class streamobs.model.DensityModel(config, **kwargs)[source]#
Bases:
ConfigurableModelDensity along the stream; samples
phi1positions.Methods
sample(size)Draw
phi1samples.
- class streamobs.model.DistanceModel(config, **kwargs)[source]#
Bases:
ConfigurableModelMethods
sample
- class streamobs.model.IsochroneModel(config, **kwargs)[source]#
Bases:
ConfigurableModelIsochrone wrapper using
ugalifor CMD sampling.Methods
create_isochrone(config)Construct the underlying
ugaliisochrone from configuration.sample(nstars, distance_modulus, **kwargs)Simulate magnitudes in g and r bands.
- create_isochrone(config)[source]#
Construct the underlying
ugaliisochrone from configuration.- Parameters:
config (dict) – Isochrone factory configuration.
- sample(nstars, distance_modulus, **kwargs)[source]#
Simulate magnitudes in g and r bands.
- Parameters:
nstars (int) – Number of stars to simulate.
distance_modulus (float or array-like) – Distance modulus per star (broadcast if scalar).
- Returns:
(mag_g, mag_r)arrays.- Return type:
tuple of numpy.ndarray
- class streamobs.model.SplineStreamModel(config, **kwargs)[source]#
Bases:
StreamModelSpline-based stream model with linear-density component.
Methods
complete_catalog(catalog[, columns_to_add, ...])Complete only the requested columns in a catalog.
sample(size)Sample stream stars and derived quantities.
- class streamobs.model.StreamModel(config, **kwargs)[source]#
Bases:
ConfigurableModelHigh-level object for the various components of the stream model.
Methods
complete_catalog(catalog[, columns_to_add, ...])Complete only the requested columns in a catalog.
sample(size)Sample stream stars and derived quantities.
- complete_catalog(catalog, columns_to_add=None, size=None, inplace=False, save_path=None, verbose=True)[source]#
Complete only the requested columns in a catalog.
This method takes an input catalog (or a desired size when no catalog is provided) and fills in only the requested stream-model columns while preserving pre-existing non-null values. Columns are generated using the configured sub-models (density, track, distance modulus, isochrone, velocity) and only if those capabilities are available.
- Parameters:
catalog (pandas.DataFrame or str or dict or None) – Input catalog. If a string, it is interpreted as a CSV filepath to read. If a dict, it will be converted to a DataFrame. If None,
sizemust be provided to create an empty frame of that length.columns_to_add (sequence of str or None, optional) – The columns to ensure in the output. Valid entries are {‘phi1’,’phi2’,’dist’,’mag_g’,’mag_r’,’mu1’,’mu2’,’rv’}. If None, all valid columns supported by the configured model are considered.
size (int or None, optional) – Required when
catalogis None or an empty table; ignored otherwise.inplace (bool, default False) – If True and a DataFrame or CSV path is provided, modify that object in place (for CSV, overwrite the input file).
save_path (str or None, optional) – If provided, write the completed catalog to this CSV path.
verbose (bool, default True) – If True, print progress/status messages.
- Returns:
The completed catalog. If
inplaceis True and a DataFrame was provided, the same object is returned after modification.- Return type:
pandas.DataFrame
- Raises:
ValueError – If
sizeis required but not provided, or when dependencies are missing (e.g., requesting ‘phi2’ without available ‘phi1’).
Notes
Dependencies: ‘phi2’ and ‘dist’ require ‘phi1’. Magnitudes require ‘dist’ and an isochrone model. Velocities require ‘phi1’ and a velocity model.
Existing non-null values are preserved; only missing rows are filled, except for magnitudes and velocities where the method intentionally overwrites the whole columns to keep internal consistency (e.g., colors and kinematic coherence across rows).
When
catalogis a CSV path andinplaceis True, the original file is overwritten.
- class streamobs.model.TrackModel(config, **kwargs)[source]#
Bases:
ConfigurableModelTransverse track model; samples
phi2givenphi1.Methods
sample(x)Sample
phi2at givenphi1positionsx.