Synthetic#
- class asteca.Synthetic(isochs: Isochrones, def_params: dict[str, float] = {'Av': 0.2, 'DR': 0.0, 'Rv': 3.1, 'alpha': 0.09, 'beta': 0.94, 'dm': 9.0, 'loga': 8.0, 'met': 0.0152}, IMF_name: str = 'chabrier_2014', max_mass: int = 10000, gamma: float | str = 'D&K', ext_law: str = 'CCMO', DR_distribution: str = 'uniform', seed: int | None = None, verbose: int = 1)#
Bases:
objectDefine a
Syntheticobject.Use the isochrones loaded in the
Isochronesobject to generate aSyntheticobject. This object is used to generate synthetic clusters given aClusterobject and a set of input fundamental parameters (metallicity, age, distance, extinction, etc.).See the Synthetic module section for more details.
- Parameters:
isochs (Isochrones) –
Isochronesobject with the loaded files for the theoretical isochronesdef_params (dict[str, float]) – Default values for all the required fundamental parameters
IMF_name (str) – Name of the initial mass function used to populate the isochrones, one of
salpeter_1955, kroupa_2001, chabrier_2014max_mass (int) – Maximum total initial mass. Should be large enough to allow generating as many synthetic stars as observed stars
gamma (float | str) – Distribution function for the mass ratio of the binary systems, float or one of
D&K, fisher_stepped, fisher_peaked, raghavanext_law (str) – Extinction law, one of
CCMO, GAIADR3. IfGAIADR3is selected, the magnitude and first color defined in theIsochronesandClusterobjects are assumed to be Gaia’s (E)DR3 G and (BP-RP) respectively. The second color (if defined) will always be affected by theCCMOmodelDR_distribution (str) – Distribution function for the differential reddening, one of
uniform, normalseed (int | None) – Random seed. If
Nonea random integer will be generated and usedverbose (int) – Verbose level. A value of
0hides all output
- Raises:
ValueError – If any of the attributes is not recognized as a valid option
Methods Summary
calibrate(cluster)cluster_masses([radec_c, rho_amb, M_B, r_B, ...])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.
stellar_parameters([mag_offset_1, ...])Estimate parameters for the observed stars: - Mass of single system - Mass of binary system; if binarity was estimated - Binary probabilities; if binarity was estimated - Blue straggler probabilities
Methods Documentation
- calibrate(cluster: Cluster)#
Calibrate a
Syntheticobject based on aClusterobject .Use the data obtained from your observed cluster, stored in the
Clusterobject, to calibrate aSyntheticobject.See the Synthetic module section for more details.
- cluster_masses(radec_c: tuple | None = None, 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, return_arrays: bool = False) 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_photM_init = M_actual + M_evol + M_dyn
If
rho_ambis not provided (None), then the method will try to estimate it using the cluster’s position and a model for the Galaxy’s potential. In this case, the coordinates of the clusterradec_care required to estimate the ambient density. If these are alsoNone, the method will try to resolve the coordinates from thecluster_raandcluster_decattributes, stored when calling thecalibrate()method with aClusterobject. If these attributes are missing, a ValueError is raised because the ambient density cannot be estimated without coordinates.- Parameters:
radec_c (tuple | None) – Center coordinates in
(RA, DEC)rho_amb (float | None) – Ambient density [\(M_{\odot}\,pc^{-3}\)]. If
None, it is estimated using the cluster’s position (radec_c) and a model for the Galaxy’s potentialM_B (float) – Bulge mass; defaults to
2.5e10[\(M_{\odot}\)] (from Haghi et al. 2015, Table 1)r_B (float) – Characteristic radius of the bulge; defaults to
0.5e3[pc] (from Haghi et al. 2015, Table 1)M_D (float) – Disc mass; defaults to
7.5e10[\(M_{\odot}\)] (from Haghi et al. 2015, Table 1)a (float) – Disc scale radius; defaults to
5400[pc] (from Haghi et al. 2015, Table 1)b (float) – Disc scaleheight; defaults to
300[pc] (from Haghi et al. 2015, Table 1)M_s (float) – Dark matter halo mass; defaults to
1.87e11[\(M_{\odot}\)] (from Sanderson et al. 2017, Table 1)r_s (float) – Dark matter halo scale radius; defaults to
15.19e3[pc] (from Sanderson et al. 2017, Table 1)C_env (float) – Constant related to the disruption time; defaults to
810e6[Myr] (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 (no units); defaults to
0.08(from Angelo et al. (2023))return_arrays (bool) – If
True, return arrays with the mass values for each model instead of the median and STDDEV values
- 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
- Raises:
ValueError – If the get_models() method was not previously called
- generate(params: dict = {}, N_stars: int = 100) ndarray | tuple[ndarray, ndarray]#
Generate a synthetic cluster.
The synthetic cluster is generated according to the parameters given in the
paramsdictionary and the already calibratedSyntheticobject.The
params``dictionary can include values for all or some of the parameters. E.g. of a dictionary with some fundamental parameters: ``params = {met: 0.0152, loga: 8.1, Av: 0.2, DR: 0., Rv: 3.1, dm: 9.7}If noparamsdictionary is given, an empty one is used and the default values defined in theSyntheticobject are used to generate the synthetic cluster.- Parameters:
params (dict) – Dictionary containing the values for the fundamental parameters.
N_stars (int) – Number of synthetic stars to generate
- Returns:
Returns a
np.arraycontaining a synthetic cluster with the data[mag, c1, (c2), mass, mass_b], wheremagis the magnitude,c1is the color,c2is the optional second color, andmass, mass_bare 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 | tuple[np.ndarray, np.ndarray]
- get_isochrone(fit_params: dict, color_idx: int = 0, full_track: bool = False, N_stars: int = 1000) ndarray#
Generate an isochrone for plotting.
The isochrone is generated using the fundamental parameter values given in the
fit_paramsdictionary.- Parameters:
fit_params (dict) – Dictionary with the values for the fundamental parameters that were not included in the
fix_paramsdictionary when theSyntheticobject was calibrated (calibrate()method).color_idx (int) – Index of the color to plot. If
0(default), plot the first color. If1plot the second colorfull_track (bool) – If
True, return the full isochrone (ie: do not apply the max mass filter)N_stars (int) – Number of synthetic stars to generate
- 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, color_idx: int = 0) 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
modelargumentN_models (int) – Number of sampled models
color_idx (int) – Index of the color used to define the CMD. If only one color is defined, set to
0. If two colors are defined, set to0to use the first color, or1to use the second color. Defaults to0.
- Raises:
ValueError –
If the calibrate() method was not previously called
If all the synthetic arrays generated are empty
- stellar_parameters(mag_offset_1: float = 0.5, col_offset_1: float = -0.1, mag_offset_2: float = -0.5, col_offset_2: float = -0.05) dict#
Estimate parameters for the observed stars: - Mass of single system - Mass of binary system; if binarity was estimated - Binary probabilities; if binarity was estimated - Blue straggler probabilities
- Parameters:
mag_offset_1 (float) – Offset applied to the turn-off magnitude to define the first BSS region
col_offset_1 (float) – Offset applied to the turn-off color to define the first BSS region
mag_offset_2 (float) – Offset applied to the turn-off magnitude to define the second BSS region
col_offset_2 (float) – Offset applied to the turn-off color to define the second BSS region
- Returns:
Data frame containing per-star primary and secondary masses along with their uncertainties, and their probability of being a binary system and/or a blue straggler star (BSS)
- Return type:
dict
- Raises:
ValueError – If the get_models() method was not previously called