asteca#

Submodules#

Package Contents#

Classes#

isochrones

Define an isochrones object.

synthetic

cluster

Define a cluster object.

likelihood

Attributes#

__version__

class asteca.isochrones#

Define an isochrones object.

This object contains the loaded theoretical isochrones used by the asteca.synthetic class to generate synthetic clusters.

Parameters:
  • isochs_path (str) – Path to the folder that contains the files for the theoretical isochrones. The name of the folder must be one of the supported isochrone services: PARSEC, MIST, or BASTI. Examples of valid paths: isochrones/PARSEC/, Mist/, basti. See Loading the isochrones for more detailed information on how to properly store the isochrone files.

  • magnitude (dict) – Dictionary containing the magnitude’s filter name (as defined in the files of the theoretical isochrones) as the key, and its effective lambda (in Angstrom) as the value. Example for Gaia’s G magnitude: {"Gmag": 6390.21}.

  • color (dict) – Dictionary containing the color used in the cluster’s analysis. The correct format is: {"filter1": 1111.11, "filter2": 2222.22}, where filter1 and filter2 are the names of the filters that are combined to generate the color. The order is important because the color will be generated as: filter1-filter2. The values 1111.11 and 2222.22 are the effective lambdas (in Angstrom) for each filter. The color does not need to be defined in the same photometric system as the magnitude. Example for Gaia’s ‘BP-RP’ color: {"G_BPmag": 5182.58, "G_RPmag": 7825.08}

  • N_interp (int, default=2500) – Number of interpolation points used to ensure that all isochrones are the same shape.

  • color2 (dict, optional, default=None) – Optional second color to use in the analysis. Same format as that used by the color parameter.

  • column_names (dict, optional, default=None) – Column names for the initial mass, metallicity, and age for the photometric system’s isochrones files. Example: {"mass_col": "Mini", "met_col": "Zini", "age_col": "logAge"}. This dictionary is defined internally in ASteCA and should only be given by the user if the isochrone service changes its format and the isochrones class fails to load the files.

  • parsec_rm_stage_9 (boll, optional, default=True) – If the isochrones are PARSEC, this argument set to True will remove the post_AGB stage (label=9) which are still “in preparation”.

class asteca.synthetic#

Define a synthetic object.

Use the isochrones loaded in the asteca.isochrones object to generate a asteca.synthetic object. This object is used to generate synthetic clusters given a asteca.cluster object and a set of input fundamental parameters (metallicity, age, distance, extinction, etc.).

See the Synthetic clusters section for more details.

Parameters:
  • isochs (isochrones) – asteca.isochrones object with the loaded files for the theoretical isochrones.

  • IMF_name (str, {"salpeter_1955", "kroupa_2001", "chabrier_2014"}, default="chabrier_2014") – Name of the initial mass function used to populate the isochrones.

  • max_mass (int, default=100_000) – Maximum total initial mass. Should be large enough to allow generating as many synthetic stars as observed stars.

  • gamma (str, float, {"D&K", "fisher_stepped", "fisher_peaked", "raghavan"}, default="D&K") – Distribution function for the mass ratio of the binary systems.

  • DR_distribution (str, {"uniform", "normal"}, default="uniform") – Distribution function for the differential reddening.

  • seed (int, optional, default=None) – Random seed. If None a random integer will be generated and used.

calibrate(cluster, fix_params: dict = {}, z_to_FeH: float | None = None)#

Calibrate a asteca.synthetic object based on a asteca.cluster object and a dictionary of fixed fundamental parameters (fix_params).

Use the data obtained from your observed cluster stored in the asteca.cluster object, to calibrate a asteca.synthetic object. Additionally, a dictionary of fixed fundamental parameters (metallicity, age, distance, extinction, etc.) can be passed.

See the Synthetic clusters section for more details.

Parameters:
  • cluster (cluster) – asteca.cluster object with the processed data from your observed cluster.

  • fix_params (dict, optional, default={}) – Dictionary with the values for the fixed parameters (if any).

  • z_to_FeH (float, optional, default=None) – If None, the default z values (defined when loading the isochrones via the asteca.isochrones object) will be used to generate the synthetic clusters. If float, it must represent the solar metallicity for these isochrones. The metallicity values will then be converted to [FeH] values, to be used by the synthetic.generate() method.

min_max() tuple[float]#

Return the minimum and maximum values for the metallicity and age defined in the theoretical isochrones.

Returns:

Tuple of (minimum_metallicity, maximum_metallicity, minimum_age, maximum_age)

Return type:

tuple[float]

generate(fit_params: dict) numpy.ndarray#

Generate a synthetic cluster.

The synthetic cluster is generated according to the parameters given in the fit_params dictionary and the already calibrated asteca.synthetic object.

Parameters:

fit_params (dict) – Dictionary with the values for the fundamental parameters that were not included in the fix_params dictionary when the asteca.synthetic object was calibrated (synthetic.calibrate() method).

Returns:

Return a np.array containing a synthetic cluster with the shape [mag, c1, (c2)], where mag is the magnitude dimension, and c1 and c2 (last one is optional) are the color dimension(s).

Return type:

array[mag, c1, (c2)]

synthplot(fit_params, ax=None, isochplot=False)#

Generate a color-magnitude plot for a synthetic cluster.

The synthetic cluster 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 the asteca.synthetic object was calibrated (synthetic.calibrate() method).

  • ax (matplotlib.axis, optional, default=None) – Matplotlib axis where to draw the plot.

  • isochplot (bool, default=False) – If True, the accompanying isochrone will be plotted.

Returns:

Matplotlib axis object

Return type:

matplotlib.axis

masses_binary_probs(model, model_std)#

Estimate individual masses for the observed stars, along with their binary probabilities (if binarity was estimated).

Parameters:
  • model (dict) – Dictionary with the values for the fundamental parameters that were not included in the fix_params dictionary when the asteca.synthetic object was calibrated (synthetic.calibrate() method).

  • model_std (dict) – Dictionary with the standard deviations for the fundamental parameters in the model argument.

Returns:

  • pandas.DataFrame – Data frame containing per-star primary and secondary masses along with their uncertainties, and their probability of being a binary system.

  • numpy.array – Distribution of total binary fraction values for the cluster.

class asteca.cluster#

Define a cluster object.

Parameters:
  • cluster_df (pd.DataFrame) – pandas DataFrame with the cluster’s loaded data

  • magnitude (str) – Name of the DataFrame column that contains the magnitude

  • e_mag (str) – Name of the DataFrame column that contains the magnitude’s uncertainty

  • color (str) – Name of the DataFrame column that contains the color

  • e_color (str) – Name of the DataFrame column that contains the color’s uncertainty

  • ra (str, optional, default=None) – Name of the DataFrame column that contains the right ascension (RA)

  • dec (str, optional, default=None) – Name of the DataFrame column that contains the declination (DEC)

  • plx (str, optional, default=None) – Name of the DataFrame column that contains the parallax

  • pmra (str, optional, default=None) – Name of the DataFrame column that contains the RA proper motion

  • pmde (str, optional, default=None) – Name of the DataFrame column that contains the DEC proper motion

  • color2 (str, optional, default=None) – Name of the DataFrame column that contains the second color

  • e_color2 (str, optional, default=None) – Name of the DataFrame column that contains the second color’s uncertainty

radecplot()#

Generate a (RA, DEC) plot.

Returns:

Matplotlib axis object

Return type:

matplotlib.axis

clustplot(ax=None, binar_prob=None)#

Generate a color-magnitude plot.

Parameters:
  • ax (matplotlib.axis, optional, default=None) – Matplotlib axis where to draw the plot

  • binar_prob (numpy.array, optional, default=None) – Array with probabilities of being a binary system for each observed star

Returns:

Matplotlib axis object

Return type:

matplotlib.axis

class asteca.likelihood#

Define a likelihood object.

This object is used to assess how similar your observed cluster is, stored in a cluster object, compared to a given synthetic cluster, generated by the synthetic.generate() method.

Parameters:
  • my_cluster (cluster) – asteca.cluster object with the loaded data for the observed cluster.

  • lkl_name (str, {"plr"}, default="plr") – Currently only the Poisson likelihood ratio defined in Tremmel et al. (2013) is accepted.

  • bin_method (str, {"knuth", "fixed", "bayes_blocks", "manual"}, default="knuth") – Bin method used to split the color-magnitude diagram into cells (Hess diagram). If manual is selected, a list containing an array of edge values for the magnitude, followed by one or two arrays (depending on the number of colors defined) for the color(s), also with edge values.

get(synth_clust)#

Evaluate the selected likelihood function.

Parameters:

synth_clust (array) – np.array containing the synthetic cluster. The shape of this array must be: [magnitude, color1, (color2)], where magnitude and color are arrays with the magnitude and color photometric data (color2 is the optional second color defined).

Returns:

Likelihood value.

Return type:

float

asteca.__version__#