Structure analysis#
The first step in the analysis of a stellar cluster is to load the data file as a Cluster object, the user can employ the library of their choice. For example, the pandas library allows you to easily read a CSV file as a pandas DataFrame:
Show code cell content
%config InlineBackend.figure_format = "retina"
import pandas as pd
# Load the observed cluster with pandas. This is an example cluster
# used for this notebook, containing Gaia DR3 data
clust_df = pd.read_csv("../_static/field.csv")
clust_df
DR3Name | RA_ICRS | DE_ICRS | Plx | e_Plx | PM | pmRA | e_pmRA | pmDE | e_pmDE | Gmag | e_Gmag | BP-RP | e_BP-RP | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 6.9702 | 61.0644 | 0.4155 | 0.1298 | 4.723 | -4.596 | 0.113 | -1.088 | 0.126 | 18.236310 | 0.003055 | 1.417509 | 0.0181 |
1 | 2 | 6.9730 | 61.0663 | 0.1394 | 0.1147 | 0.728 | -0.709 | 0.101 | 0.164 | 0.115 | 18.068916 | 0.002972 | 1.489637 | 0.0251 |
2 | 3 | 6.9929 | 61.0615 | 0.1798 | 0.0815 | 1.397 | -1.345 | 0.075 | 0.374 | 0.071 | 17.406872 | 0.002857 | 1.895990 | 0.0133 |
3 | 4 | 6.8977 | 61.0641 | NaN | NaN | NaN | NaN | NaN | NaN | NaN | 18.103613 | 0.007146 | 1.127492 | 0.0262 |
4 | 5 | 6.9032 | 61.0656 | 0.2339 | 0.0175 | 2.666 | -2.651 | 0.017 | 0.277 | 0.018 | 14.180438 | 0.002762 | 1.828795 | 0.0049 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
8678 | 8679 | 5.8419 | 61.5723 | 0.3010 | 0.0532 | 2.920 | -2.422 | 0.048 | -1.631 | 0.049 | 16.835844 | 0.002816 | 1.374006 | 0.0101 |
8679 | 8680 | 5.8271 | 61.5857 | 0.3655 | 0.0938 | 1.047 | 0.623 | 0.083 | -0.842 | 0.082 | 17.654474 | 0.002899 | 1.352100 | 0.0132 |
8680 | 8681 | 5.8430 | 61.5898 | 0.6432 | 0.1565 | 3.109 | -3.059 | 0.144 | -0.553 | 0.148 | 17.699040 | 0.003224 | 1.523220 | 0.0131 |
8681 | 8682 | 5.8384 | 61.5882 | 0.3607 | 0.1222 | 2.758 | -2.755 | 0.109 | 0.130 | 0.116 | 18.355470 | 0.003012 | 1.699585 | 0.0230 |
8682 | 8683 | 5.8014 | 61.5829 | 0.2103 | 0.1195 | 1.186 | -0.303 | 0.104 | -1.146 | 0.104 | 18.257357 | 0.003048 | 1.616970 | 0.0298 |
8683 rows × 14 columns
Passing this data to the Cluster class creates an object which we call here my_field
:
import asteca
my_field = asteca.Cluster(
ra=clust_df["RA_ICRS"],
dec=clust_df["DE_ICRS"],
magnitude=clust_df["Gmag"],
e_mag=clust_df["e_Gmag"],
color=clust_df["BP-RP"],
e_color=clust_df["e_BP-RP"],
pmra=clust_df["pmRA"],
pmde=clust_df["pmDE"],
plx=clust_df["Plx"],
e_pmra=clust_df["e_pmRA"],
e_pmde=clust_df["e_pmDE"],
e_plx=clust_df["e_Plx"],
verbose=2 # Print info to screen
)
Instantiating cluster...
Columns read : RA, DEC, Magnitude, e_mag, Color, e_color, Plx, pmRA, pmDE
N_stars : 8683
N_clust_min : 25
N_clust_max : 5000
Cluster object generated
We can generate a simple plot to see how our loaded data looks like:
Show code cell source
import matplotlib.pyplot as plt
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(10, 10))
ax1.scatter(my_field.ra, my_field.dec, alpha=.2, s=10)
ax1.set_xlabel("ra")
ax1.set_ylabel("dec")
ax2.scatter(my_field.pmra, my_field.pmde, alpha=.2, s=10)
ax2.set_xlim(-5, 1) # Zoom in to better see the density
ax2.set_ylim(-2, 1)
ax2.set_xlabel("pmra")
ax2.set_ylabel("pmde")
ax3.hist(my_field.plx, 100)
ax3.set_xlim(-0.5, 2)
ax3.set_xlabel("plx")
ax4.scatter(my_field.color, my_field.mag, alpha=.2, s=10)
ax4.set_ylim(19, 8)
ax4.set_xlabel("BP-RP")
ax4.set_ylabel("Gmag");

We can see that this is an observed field, and not a data file with the cluster member’s already identified.
Center estimation#
To estimate the center we call the get_center() method on the my_field
object defined above:
# Estimate the cluster's center coordinates, use the default `knn_5d` algorithm
my_field.get_center()
Center coordinates found
radec_c : (6.3049, 61.3218)
pms_c : (-2.811, -1.070)
plx_c : 0.288
We can extract the center values found by accessing the attributes with:
# Access estimated center values
ra_c, dec_c = my_field.radec_c
pmra_c, pmde_c = my_field.pms_c
plx_c = my_field.plx_c
and plot them over our field data:
Show code cell source
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 5))
ax1.scatter(my_field.ra, my_field.dec, alpha=.2, s=10)
ax1.scatter(ra_c, dec_c, marker='x', s=150, c='r')
ax1.set_xlabel("ra")
ax1.set_ylabel("dec")
ax2.scatter(my_field.pmra, my_field.pmde, alpha=.2, s=10)
ax2.scatter(pmra_c, pmde_c, marker='x', s=150, c='r')
ax2.set_xlim(-5, 1) # Zoom in to better see the density
ax2.set_ylim(-2, 1)
ax2.set_xlabel("pmra")
ax2.set_ylabel("pmde");

We can also try the other method to estimate center values
# Apply the `kde_2d` algorithm on `(ra, dec)` data
my_field.get_center('kde_2d')
# Apply the `kde_2d` algorithm on `(pmra, pmde)` data
my_field.get_center('kde_2d', data_2d='pms')
Center coordinates found
radec_c : (6.3142, 61.3262)
Center coordinates found
pms_c : (-2.8078, -1.0741)
where we see that the resulting values are very similar to the ones obtained previously.
Radius estimation#
There is yet no method included in ASteCA to estimate the radius parameter. The user can manually set this attribute with:
my_field.radius = 0.09 # Value in degrees
Number of members#
We can estimate the number of members for the cluster embedded in this field using the default ripley
algorithm which works on (ra, dec, pmra, pmde, plx)
data, by applying the get_nmembers() method:
my_field.get_nmembers()
Number of members estimated
N_cluster : 600
We can also use the density
algorithm which is applied on (ra, dec)
data and assumes that
the radius
argument in my_field
is also defined:
# Estimate the number of cluster members, using the `density` algorithm. The radius
# argument was included above
my_field.get_nmembers("density")
Number of members estimated
N_cluster : 247
Important
Notice that the resulting values for the estimated number of members are quite different between both methods. Since the N_cluster
parameter is very important for the estimation of the membership probabilities later on, be sure to choose its value carefully.