Cluster#

class asteca.Cluster(cluster_name: str | None = None, UCC_members_file: pd.DataFrame | None = None, ra: np.ndarray | None = None, dec: np.ndarray | None = None, mag: np.ndarray | None = None, max_mag: float | None = None, max_mag_perc: float | None = None, e_mag: np.ndarray | None = None, color: np.ndarray | None = None, e_color: np.ndarray | None = None, color2: np.ndarray | None = None, e_color2: np.ndarray | None = None, plx: np.ndarray | None = None, e_plx: np.ndarray | None = None, pmra: np.ndarray | None = None, e_pmra: np.ndarray | None = None, pmde: np.ndarray | None = None, e_pmde: np.ndarray | None = None, probs: np.ndarray | None = None, N_clust_min: int = 25, N_clust_max: int = 2000, verbose: int = 1)#

Bases: object

Define a Cluster object.

This object contains the basic data required to load a group of observed stars that could represent a cluster or an entire field.

Parameters:
  • cluster_name (str | None) – Name of the cluster, only required if the data is to be loaded from the UCC members file. If provided, the UCC_members_file argument must also be provided

  • UCC_members_file (pd.DataFrame | None) – Loaded UCC members .parquet file

  • ra (np.ndarray | None) – Array that contains the right ascension (RA)

  • dec (np.ndarray | None) – Array that contains the declination (DEC)

  • mag (np.ndarray | None) – Array that contains the magnitude

  • max_mag (float | None) – Maximum magnitude to be considered for the cluster

  • max_mag_perc (float | None) – Maximum magnitude percentile. Either this or max_mag (or both) must by None

  • e_mag (np.ndarray | None) – Array that contains the magnitude’s uncertainty

  • color (np.ndarray | None) – Array that contains the color

  • e_color (np.ndarray | None) – Array that contains the color’s uncertainty

  • color2 (np.ndarray | None) – Array that contains the second color

  • e_color2 (np.ndarray | None) – Array that contains the second color’s uncertainty

  • plx (np.ndarray | None) – Array that contains the parallax

  • e_plx (np.ndarray | None) – Array that contains the parallax uncertainty

  • pmra (np.ndarray | None) – Array that contains the RA proper motion

  • e_pmra (np.ndarray | None) – Array that contains the RA proper motion’s uncertainty

  • pmde (np.ndarray | None) – Array that contains the DEC proper motion

  • e_pmde (np.ndarray | None) – Array that contains the DEC proper motion’s uncertainty

  • probs (np.ndarray | None) – Array that contains the membership probabilities for each star. The membership method stores here the estimated probabilities, but this attribute can be used to store membership probabilities estimated in other ways. The select_members method uses these values to select stars with probabilities above a given threshold.

  • N_clust_min (int) – Lower limit on cluster size assumed by the membership estimation algorithm

  • N_clust_max (int) – Upper limit on cluster size assumed by the membership estimation algorithm

  • verbose (int) – Verbose level. A value of 0 hides all output

Raises:

ValueError – If cluster_name is provided but UCC_file_path is not provided

Methods Summary

get_center([algo, data_2d, radec_c, pms_c, ...])

Estimate center coordinates for the cluster

get_nmembers([algo, eq_to_gal])

Estimate the number of members for the cluster.

Methods Documentation

get_center(algo: str = 'knn_5d', data_2d: str = 'radec', radec_c: tuple[float, float] | None = None, pms_c: tuple[float, float] | None = None, plx_c: float | None = None) None#

Estimate center coordinates for the cluster

Use the available data (ra, dec, pmra, pmde, plx) to estimate a cluster’s center coordinates as the point(s) of maximum density. Algorithms:

  • knn_5d: Estimates the 5-dimensional center values (in ra, dec, pmra, pmde, plx) as the median position of the k (k=N_clust_min) stars with the largest nearest-neighbor density to a 5D center value that can be either given (fully or partially) or estimated.

  • kde_2d: Estimates the 2-dimensional center values (either in (ra, dec) or in (pmra, pmde); determined by the data_2d argument) using a Kernel Density Estimator (KDE).

Parameters:
  • algo (str) – Algorithm used to estimate center values, one of (knn_5d, kde_2d)

  • data_2d (str) – String indicating the data to be used to estimate the center value, either: radec or pms

  • radec_c (tuple[float, float] | None) – Estimated initial value for the (RA, DEC) center, used by the knn_5d method

  • pms_c (tuple[float, float] | None) – Estimated initial value for the (pmRA, pmDE) center, used by the knn_5d method

  • plx_c (float | None) – Estimated initial value for the plx center, used by the knn_5d method

Raises:

ValueError – If required data is missing from the Cluster object

get_nmembers(algo: str = 'ripley', eq_to_gal: bool = True) None#

Estimate the number of members for the cluster. Algorithms:

  • ripley: Originally introduced with the fastMP membership method in Perren et al. (2023). Requires (ra, dec, pmra, pmde, plx) and their center estimates.

  • density: Simple algorithm that counts the number of stars within the cluster region (center+radius) and subtracts the expected number of field stars within that region. Requires the (ra, dec) center and the radius of the cluster to be defined.

Parameters:
  • algo (str) – Algorithm used to estimate center values, one of (ripley, density)

  • eq_to_gal (bool) – Convert (ra, dec) to (lon, lat). Useful for clusters with large dec values to reduce the frame’s distortion

Raises:
  • ValueError – If algo argument is not recognized

  • AttributeError – If required attributes are missing from the Cluster object