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:
objectDefine a
Clusterobject.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_fileargument must also be providedUCC_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 Nonee_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
membershipmethod stores here the estimated probabilities, but this attribute can be used to store membership probabilities estimated in other ways. Theselect_membersmethod 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
0hides all output
- Raises:
ValueError – If
cluster_nameis provided butUCC_file_pathis 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 (inra, 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 thedata_2dargument) 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:
radecorpmsradec_c (tuple[float, float] | None) – Estimated initial value for the (RA, DEC) center, used by the
knn_5dmethodpms_c (tuple[float, float] | None) – Estimated initial value for the (pmRA, pmDE) center, used by the
knn_5dmethodplx_c (float | None) – Estimated initial value for the plx center, used by the
knn_5dmethod
- Raises:
ValueError – If required data is missing from the
Clusterobject
- get_nmembers(algo: str = 'ripley', eq_to_gal: bool = True) None#
Estimate the number of members for the cluster. Algorithms:
ripley: Originally introduced with thefastMPmembership 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 largedecvalues to reduce the frame’s distortion
- Raises:
ValueError – If
algoargument is not recognizedAttributeError – If required attributes are missing from the
Clusterobject