Synthetic#
- class asteca.Synthetic(isochs: Isochrones, def_params: dict = {'Av': 0.2, 'DR': 0.0, 'Rv': 3.1, 'alpha': 0.09, 'beta': 0.94, 'dm': 9.0, 'loga': 8.0, 'met': 0.0152}, ext_law: str = 'CCMO', DR_distribution: str = 'uniform', IMF_name: str = 'chabrier_2014', max_mass: int = 10000, gamma: float | str = 'D&K', seed: int | None = None, verbose: int = 1)#
Bases:
object
Define a
Synthetic
object.Use the isochrones loaded in the
Isochrones
object to generate aSynthetic
object. This object is used to generate synthetic clusters given aCluster
object and a set of input fundamental parameters (metallicity, age, distance, extinction, etc.).See the Synthetic module section for more details.
- Parameters:
isochs (Isochrones) –
Isochrones
object with the loaded files for the theoretical isochronesdef_params (dict) – Default values for all the required fundamental parameters
ext_law (str) – Extinction law, one of
CCMO, GAIADR3
. IfGAIADR3
is selected, the magnitude and first color defined in theIsochrones
andCluster
objects are assumed to be Gaia’s (E)DR3 G and (BP-RP) respectively. The second color (if defined) will always be affected by theCCMO
model, defaults toCCMO
DR_distribution (str) – Distribution function for the differential reddening, one of
uniform, normal
; defaults touniform
IMF_name (str) – Name of the initial mass function used to populate the isochrones, one of
salpeter_1955, kroupa_2001, chabrier_2014
; defaults tochabrier_2014
max_mass (int) – Maximum total initial mass. Should be large enough to allow generating as many synthetic stars as observed stars, defaults to
100_000
gamma (float | str) – Distribution function for the mass ratio of the binary systems, float or one of
D&K, fisher_stepped, fisher_peaked, raghavan
; defaults toD&K
seed (int | None) – Random seed. If
None
a random integer will be generated and used, defaults toNone
verbose (int) – Verbose level. A value of
0
hides all output, defaults to1
- Raises:
ValueError – If any of the attributes is not recognized as a valid option
Methods Summary
binary_fraction
(binar_prob[, Nsamples])Estimate the total binary fraction for the observed cluster, given the per-star probability of being a binary system.
calibrate
(cluster)cluster_masses
([rho_amb, M_B, r_B, M_D, a, ...])Estimate the different total masses for the observed cluster.
generate
(params[, N_stars])Generate a synthetic cluster.
get_isochrone
(fit_params[, color_idx])Generate an isochrone for plotting.
get_models
(model, model_std[, N_models])Generate random sampled models from the selected solution.
Estimate individual masses for the observed stars, along with their binary probabilities (if binarity was estimated).
Methods Documentation
- binary_fraction(binar_prob: ndarray, Nsamples: int = 10000) tuple[float, float] #
Estimate the total binary fraction for the observed cluster, given the per-star probability of being a binary system.
- Parameters:
binar_prob (np.ndarray) – Per-star binary system probabilities
Nsamples (int) – Number of samples generated to produce the final values; defaults to
10_000
.
- Returns:
Median and STDDEV values for the total binary fraction
- Return type:
tuple[float, float]
- Raises:
ValueError – If the get_models() method was not previously called
- calibrate(cluster: Cluster)#
Calibrate a
Synthetic
object based on aCluster
object .Use the data obtained from your observed cluster, stored in the
Cluster
object, to calibrate aSynthetic
object.See the Synthetic module section for more details.
- cluster_masses(rho_amb: float | None = None, M_B: float = 25000000000.0, r_B: float = 500.0, M_D: float = 75000000000.0, a: float = 5400.0, b: float = 300.0, M_s: float = 187000000000.0, r_s: float = 15190.0, C_env: float = 810000000.0, gamma: float = 0.62, epsilon: float = 0.08) dict #
Estimate the different total masses for the observed cluster.
The returned dictionary contains distributions for
M_init, M_actual, M_obs, M_phot, M_evol, M_dyn
, where:M_init
: Initial massM_actual
: Actual massM_obs
: Observed massM_phot
: Photometric mass, ie: mass not observed that is located below the maximum observed magnitudeM_evol
: Mass lost via stellar evolutionM_dyn
: Mass lost via dynamical effects
The actual and initial masses can also be obtained as:
M_actual = M_obs + M_phot
M_init = M_actual + M_evol + M_dyn
- Parameters:
rho_amb (float | None) – Ambient density. If
None
, it is estimated using the cluster’s position and a model for the Galaxy’s potential; defaults toNone
.M_B (float) – Bulge mass (in solar masses); defaults to
2.5e10
(from Haghi et al. 2015, Table 1)r_B (float) – Characteristic radius of the bulge (in pc); defaults to
0.5e3
(from Haghi et al. 2015, Table 1)M_D (float) – Disc mass (in solar masses); defaults to
7.5e10
(from Haghi et al. 2015, Table 1)a (float) – Disc scale radius (in pc); defaults to
5.4e3
(from Haghi et al. 2015, Table 1)b (float) – Disc scaleheight (in pc); defaults to
0.3e3
(from Haghi et al. 2015, Table 1)M_s (float) – Dark matter halo mass (in solar masses); defaults to
1.87e11
(from Sanderson et al. 2017, Table 1)r_s (float) – Dark matter halo scale radius (in pc); defaults to
15.19e3
(from Sanderson et al. 2017, Table 1)C_env (float) – Constant related to the disruption time (in Myr); defaults to
810e6
(from Lamers, Gieles & Zwart 2005)gamma (float) – Constant related to the disruption time (no units); defaults to
0.62
(from Lamers, Gieles & Zwart 2005)epsilon (float) – Eccentricity of the orbit; defaults to
0.08
(from Angelo et al. (2023))
- Raises:
ValueError – If no synthetic models were generated via the get_models() method.
- Returns:
Dictionary with the mass distributions for the initial, actual, observed, photometric, evolutionary, and dynamical masses:
M_init, M_actual, M_obs, M_phot, M_evol, M_dyn
- Return type:
dict
- generate(params: dict, N_stars: int = 100) ndarray #
Generate a synthetic cluster.
The synthetic cluster is generated according to the parameters given in the
params
dictionary and the already calibratedSynthetic
object.- Parameters:
params (dict) – Dictionary containing the values for the fundamental parameters. The dictionary must include values for all the parameters, e.g.:
params = {met: 0.0152, loga: 8.1, alpha: 0.1, beta: 1, Av: 0.2, DR: 0., Rv: 3.1, dm: 9.7}
N_stars (int) – Number of synthetic stars to generate; defaults to
100
- Returns:
Returns a
np.array
containing a synthetic cluster with the data[mag, c1, (c2), mass, mass_b]
, wheremag
is the magnitude,c1
is the color,c2
is the optional second color, andmass, mass_b
are the masses of the single and secondary components of the binary systems, respectively (if generated). If the system is a single star, thenmass_b==np.nan
.- Return type:
np.ndarray
- get_isochrone(fit_params: dict, color_idx: int = 0) ndarray #
Generate an isochrone for plotting.
The isochrone is generated using the fundamental parameter values given in the
fit_params
dictionary.- Parameters:
fit_params (dict) – Dictionary with the values for the fundamental parameters that were not included in the
fix_params
dictionary when theSynthetic
object was calibrated (calibrate()
method).color_idx (int) – Index of the color to plot. If
0
(default), plot the first color. If1
plot the second color. Defaults to0
- Raises:
ValueError – If either parameter (met, age) is outside of allowed range
- Returns:
Array with the isochrone data to plot
- Return type:
np.ndarray
- get_models(model: dict[str, float], model_std: dict[str, float], N_models: int = 200) None #
Generate random sampled models from the selected solution. Use these models to generate full synthetic clusters.
- Parameters:
model (dict[str, float]) – Dictionary with the values for the fundamental parameters
model_std (dict[str, float]) – Dictionary with the standard deviations for the fundamental parameters in the
model
argumentN_models (int) – Number of sampled models, defaults to
200
- Raises:
ValueError – If any of the (met, age) parameters are out of range or if all the synthetic arrays generated are empty
- stellar_masses() dict #
Estimate individual masses for the observed stars, along with their binary probabilities (if binarity was estimated).
- Returns:
Data frame containing per-star primary and secondary masses along with their uncertainties, and their probability of being a binary system
- Return type:
dict
- Raises:
ValueError – If the get_models() method was not previously called