MGCS-pytools 0.1.4__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mgcs_pytools-0.2.1/PKG-INFO +47 -0
- mgcs_pytools-0.2.1/README.md +23 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/pyproject.toml +1 -1
- mgcs_pytools-0.2.1/src/MGCS_pytools.egg-info/PKG-INFO +47 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/MGCS_pytools.egg-info/SOURCES.txt +1 -2
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/cvt_grid.py +12 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/dr_correction.py +30 -9
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/membership.py +43 -19
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/utils/plotting.py +15 -12
- mgcs_pytools-0.1.4/PKG-INFO +0 -25
- mgcs_pytools-0.1.4/README.md +0 -1
- mgcs_pytools-0.1.4/src/MGCS_pytools.egg-info/PKG-INFO +0 -25
- mgcs_pytools-0.1.4/test/test.py +0 -68
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/LICENSE +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/setup.cfg +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/MGCS_pytools.egg-info/dependency_links.txt +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/MGCS_pytools.egg-info/requires.txt +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/MGCS_pytools.egg-info/top_level.txt +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/__init__.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/mcmc/__init__.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/mcmc/bivariate_normal.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/mcmc/legacy/multivariate_2d_posterior.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/mcmc/mcmc.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/mcmc/set_posterior.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/mcmc/utils.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/__init__.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/region_tools.py +0 -0
- {mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/utils/__init__.py +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MGCS_pytools
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: A collection of Python tools for data analysis and visualization made for the MGCS HST Treasury program.
|
|
5
|
+
Author-email: Luca Rosignoli <luca.rosignoli@inaf.it>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/LR-inaf/MGCS_pytools
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/LR-inaf/MGCS_pytools/issues
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: shapely
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: matplotlib
|
|
16
|
+
Requires-Dist: astropy
|
|
17
|
+
Requires-Dist: emcee
|
|
18
|
+
Requires-Dist: corner
|
|
19
|
+
Requires-Dist: tqdm
|
|
20
|
+
Requires-Dist: seaborn
|
|
21
|
+
Requires-Dist: h5py
|
|
22
|
+
Requires-Dist: scikit-learn
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Python tools used for the Missing Globular Cluster Survey [D. Massari et al. 2024](https://doi.org/10.1051/0004-6361/202554007)
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
You can install this module from PyPi repository using `pip install mgcs-pytools`
|
|
29
|
+
|
|
30
|
+
## Brief description
|
|
31
|
+
This package provides three modules:
|
|
32
|
+
1. `mcmc`: this module provide a inference-based Guassian Mixture Model (GMM). this module has been designed to study the distribution of the Proper Motions but it can be used for any 2D distribution.
|
|
33
|
+
2. `statistical_membership`: you can use this module to perform a statistical decontamination of your CMD. This approach implements an adaptive CMD grid based on the Voronoi tassellation, and it combines the statistical decontamination with the differential reddening correction. the output is your photometric catalog with the membership probability for each star, the corrected magnitude and the delta_ebv to construct the reddening map
|
|
34
|
+
3. `utils`: this package contain usefull plotting routin for both outcomes of the `mcmc` and `statistical_memberhsip` modules.
|
|
35
|
+
|
|
36
|
+
Further details on the code and it performance on real data will be published in an upcoming paper(s).
|
|
37
|
+
|
|
38
|
+
You can find a boilerplate in the main folder.
|
|
39
|
+
|
|
40
|
+
## Contributing
|
|
41
|
+
__!!Contributions are super welcome!!__
|
|
42
|
+
If you wanna develop this project just clone this repo, make your branch with your branch and start developing.
|
|
43
|
+
|
|
44
|
+
## Issue reporting
|
|
45
|
+
Also reporting bugs is important. If you find some bugs please open a ticket in the issue tab and I will more than happy to try to fix it.
|
|
46
|
+
|
|
47
|
+
For any information please reach me at _luca.rosignoli@inaf.it_
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Python tools used for the Missing Globular Cluster Survey [D. Massari et al. 2024](https://doi.org/10.1051/0004-6361/202554007)
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
You can install this module from PyPi repository using `pip install mgcs-pytools`
|
|
5
|
+
|
|
6
|
+
## Brief description
|
|
7
|
+
This package provides three modules:
|
|
8
|
+
1. `mcmc`: this module provide a inference-based Guassian Mixture Model (GMM). this module has been designed to study the distribution of the Proper Motions but it can be used for any 2D distribution.
|
|
9
|
+
2. `statistical_membership`: you can use this module to perform a statistical decontamination of your CMD. This approach implements an adaptive CMD grid based on the Voronoi tassellation, and it combines the statistical decontamination with the differential reddening correction. the output is your photometric catalog with the membership probability for each star, the corrected magnitude and the delta_ebv to construct the reddening map
|
|
10
|
+
3. `utils`: this package contain usefull plotting routin for both outcomes of the `mcmc` and `statistical_memberhsip` modules.
|
|
11
|
+
|
|
12
|
+
Further details on the code and it performance on real data will be published in an upcoming paper(s).
|
|
13
|
+
|
|
14
|
+
You can find a boilerplate in the main folder.
|
|
15
|
+
|
|
16
|
+
## Contributing
|
|
17
|
+
__!!Contributions are super welcome!!__
|
|
18
|
+
If you wanna develop this project just clone this repo, make your branch with your branch and start developing.
|
|
19
|
+
|
|
20
|
+
## Issue reporting
|
|
21
|
+
Also reporting bugs is important. If you find some bugs please open a ticket in the issue tab and I will more than happy to try to fix it.
|
|
22
|
+
|
|
23
|
+
For any information please reach me at _luca.rosignoli@inaf.it_
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "MGCS_pytools"
|
|
7
|
-
version = "0.1
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "A collection of Python tools for data analysis and visualization made for the MGCS HST Treasury program."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MGCS_pytools
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: A collection of Python tools for data analysis and visualization made for the MGCS HST Treasury program.
|
|
5
|
+
Author-email: Luca Rosignoli <luca.rosignoli@inaf.it>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/LR-inaf/MGCS_pytools
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/LR-inaf/MGCS_pytools/issues
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: numpy
|
|
12
|
+
Requires-Dist: pandas
|
|
13
|
+
Requires-Dist: shapely
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: matplotlib
|
|
16
|
+
Requires-Dist: astropy
|
|
17
|
+
Requires-Dist: emcee
|
|
18
|
+
Requires-Dist: corner
|
|
19
|
+
Requires-Dist: tqdm
|
|
20
|
+
Requires-Dist: seaborn
|
|
21
|
+
Requires-Dist: h5py
|
|
22
|
+
Requires-Dist: scikit-learn
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Python tools used for the Missing Globular Cluster Survey [D. Massari et al. 2024](https://doi.org/10.1051/0004-6361/202554007)
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
You can install this module from PyPi repository using `pip install mgcs-pytools`
|
|
29
|
+
|
|
30
|
+
## Brief description
|
|
31
|
+
This package provides three modules:
|
|
32
|
+
1. `mcmc`: this module provide a inference-based Guassian Mixture Model (GMM). this module has been designed to study the distribution of the Proper Motions but it can be used for any 2D distribution.
|
|
33
|
+
2. `statistical_membership`: you can use this module to perform a statistical decontamination of your CMD. This approach implements an adaptive CMD grid based on the Voronoi tassellation, and it combines the statistical decontamination with the differential reddening correction. the output is your photometric catalog with the membership probability for each star, the corrected magnitude and the delta_ebv to construct the reddening map
|
|
34
|
+
3. `utils`: this package contain usefull plotting routin for both outcomes of the `mcmc` and `statistical_memberhsip` modules.
|
|
35
|
+
|
|
36
|
+
Further details on the code and it performance on real data will be published in an upcoming paper(s).
|
|
37
|
+
|
|
38
|
+
You can find a boilerplate in the main folder.
|
|
39
|
+
|
|
40
|
+
## Contributing
|
|
41
|
+
__!!Contributions are super welcome!!__
|
|
42
|
+
If you wanna develop this project just clone this repo, make your branch with your branch and start developing.
|
|
43
|
+
|
|
44
|
+
## Issue reporting
|
|
45
|
+
Also reporting bugs is important. If you find some bugs please open a ticket in the issue tab and I will more than happy to try to fix it.
|
|
46
|
+
|
|
47
|
+
For any information please reach me at _luca.rosignoli@inaf.it_
|
|
@@ -19,5 +19,4 @@ src/mgcs_pytools/statistical_membership/dr_correction.py
|
|
|
19
19
|
src/mgcs_pytools/statistical_membership/membership.py
|
|
20
20
|
src/mgcs_pytools/statistical_membership/region_tools.py
|
|
21
21
|
src/mgcs_pytools/utils/__init__.py
|
|
22
|
-
src/mgcs_pytools/utils/plotting.py
|
|
23
|
-
test/test.py
|
|
22
|
+
src/mgcs_pytools/utils/plotting.py
|
{mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/cvt_grid.py
RENAMED
|
@@ -195,6 +195,18 @@ def _aggregate_regions(regions: NDArray) -> NDArray:
|
|
|
195
195
|
np.where(np.isin(new_touched_regions, old_touched_regions)),
|
|
196
196
|
)
|
|
197
197
|
|
|
198
|
+
# discard too large cells, most likely to be a field one
|
|
199
|
+
mask = np.where(
|
|
200
|
+
[
|
|
201
|
+
regions[idx].area > 10.0 * reg.area for idx in new_touched_regions
|
|
202
|
+
] # to understand if it is better 5 or 10
|
|
203
|
+
)
|
|
204
|
+
new_touched_regions = (
|
|
205
|
+
np.delete(new_touched_regions, mask[0])
|
|
206
|
+
if len(mask[0]) > 0
|
|
207
|
+
else new_touched_regions
|
|
208
|
+
)
|
|
209
|
+
|
|
198
210
|
old_touched_regions = np.append(old_touched_regions, new_touched_regions)
|
|
199
211
|
old_touched_regions = np.append(old_touched_regions, i)
|
|
200
212
|
|
{mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/dr_correction.py
RENAMED
|
@@ -31,6 +31,20 @@ class createROI:
|
|
|
31
31
|
|
|
32
32
|
# make plot
|
|
33
33
|
self.ax.scatter(self.points[:, 0], self.points[:, 1], marker=".", s=0.5, lw=0.1)
|
|
34
|
+
self.ax.set(
|
|
35
|
+
xlabel="abscissa",
|
|
36
|
+
ylabel="ordinate",
|
|
37
|
+
title="CMD in the abscissa-ordinate plane",
|
|
38
|
+
)
|
|
39
|
+
self.ax.text(
|
|
40
|
+
0.05,
|
|
41
|
+
0.95,
|
|
42
|
+
"Left click: add vertex\nSpacebar: close polygon\nC: cancel polygon\nQ: quit",
|
|
43
|
+
transform=self.ax.transAxes,
|
|
44
|
+
fontsize=8,
|
|
45
|
+
verticalalignment="top",
|
|
46
|
+
bbox=dict(boxstyle="round", facecolor="wheat", alpha=0.5),
|
|
47
|
+
)
|
|
34
48
|
self.fig.canvas.draw()
|
|
35
49
|
plt.show()
|
|
36
50
|
|
|
@@ -84,6 +98,22 @@ class createROI:
|
|
|
84
98
|
lw=0.5,
|
|
85
99
|
zorder=3,
|
|
86
100
|
)
|
|
101
|
+
|
|
102
|
+
self.ax.set(
|
|
103
|
+
xlabel="abscissa",
|
|
104
|
+
ylabel="ordinate",
|
|
105
|
+
title="CMD in the abscissa-ordinate plane",
|
|
106
|
+
)
|
|
107
|
+
self.ax.text(
|
|
108
|
+
0.05,
|
|
109
|
+
0.95,
|
|
110
|
+
"Left click: add vertex\nSpacebar: close polygon\nC: cancel polygon\nQ: quit",
|
|
111
|
+
transform=self.ax.transAxes,
|
|
112
|
+
fontsize=8,
|
|
113
|
+
verticalalignment="top",
|
|
114
|
+
bbox=dict(boxstyle="round", facecolor="wheat", alpha=0.5),
|
|
115
|
+
)
|
|
116
|
+
|
|
87
117
|
self.fig.canvas.draw()
|
|
88
118
|
self.fig.canvas.flush_events()
|
|
89
119
|
|
|
@@ -100,15 +130,6 @@ class createROI:
|
|
|
100
130
|
self.cid_KEYBOARD = self.ax.figure.canvas.mpl_connect("key_press_event", self)
|
|
101
131
|
|
|
102
132
|
|
|
103
|
-
# params needed:
|
|
104
|
-
# rband1[float], exctiction law in band1
|
|
105
|
-
# rband2[float], exctiction law in band2
|
|
106
|
-
# RA[str], RA colname
|
|
107
|
-
# DEC[str], DEC colname
|
|
108
|
-
# TO_mag[float], Turn off mag
|
|
109
|
-
# TO_color[float], Turn off color
|
|
110
|
-
# nref[int], number of neighbors stars used as reference
|
|
111
|
-
# columns[dict[str]] columns name of the dataframe [X, Y, V, I, membership]
|
|
112
133
|
def compute_differential_reddening(
|
|
113
134
|
df: pd.DataFrame,
|
|
114
135
|
params: dict,
|
{mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/membership.py
RENAMED
|
@@ -221,6 +221,8 @@ def get_membership(
|
|
|
221
221
|
def do_statistical_membership(
|
|
222
222
|
df_cluster_input: DataFrame,
|
|
223
223
|
df_field_input: DataFrame,
|
|
224
|
+
target_mag_col: list[str],
|
|
225
|
+
target_mag_col_error: list[str],
|
|
224
226
|
field_mag_col: list[str],
|
|
225
227
|
dr_params: dict[str, str],
|
|
226
228
|
parallel_fov: float,
|
|
@@ -228,10 +230,9 @@ def do_statistical_membership(
|
|
|
228
230
|
minstars: int = 200,
|
|
229
231
|
racol: str = "RA",
|
|
230
232
|
deccol: str = "DEC",
|
|
231
|
-
process_iter: int = 3,
|
|
233
|
+
# process_iter: int = 3,
|
|
232
234
|
min_star_per_cell: int = 3,
|
|
233
235
|
membership_iter: int = 1000,
|
|
234
|
-
# fov_ratio: float = 1.0,
|
|
235
236
|
roi: list[float] | None = None,
|
|
236
237
|
plot_dred: bool = False,
|
|
237
238
|
plot_voronoi: bool = False,
|
|
@@ -245,13 +246,26 @@ def do_statistical_membership(
|
|
|
245
246
|
DataFrame containing the cluster stars.
|
|
246
247
|
df_field_input: DataFrame
|
|
247
248
|
DataFrame containing the field stars.
|
|
249
|
+
target_mag_col: list of str
|
|
250
|
+
List containing the names of the columns with the magnitudes
|
|
251
|
+
to use for the target CMD (color, mag).
|
|
252
|
+
target_mag_col_error: list of str
|
|
253
|
+
List containing the names of the columns with the magnitude errors
|
|
254
|
+
to use for the target CMD (color, mag).
|
|
248
255
|
field_mag_col: list of str
|
|
249
256
|
List containing the names of the columns with the magnitudes
|
|
250
|
-
to use for the CMD (color, mag).
|
|
257
|
+
to use for the field CMD (color, mag).
|
|
251
258
|
dr_params: dict of str
|
|
252
|
-
Dictionary containing
|
|
253
|
-
|
|
254
|
-
|
|
259
|
+
Dictionary containing inputs parameters for the differential reddening
|
|
260
|
+
correction. It must contain the following keys:
|
|
261
|
+
- 'rband1': the exction value in band1,
|
|
262
|
+
- 'rband2': the exction value in band2,
|
|
263
|
+
- 'TO_mag': the magnitude of the Turn-off,
|
|
264
|
+
- 'TO_color': the color of the Turn-off,
|
|
265
|
+
- 'nref': the number of reference stars,
|
|
266
|
+
- 'xcol': the name of the column containing the x coordinates,
|
|
267
|
+
- 'ycol': the name of the column containing the y coordinates,
|
|
268
|
+
- 'ord_step': the bin size in the 'ordinate' to calculate the ridge line
|
|
255
269
|
parallel_fov: float
|
|
256
270
|
Size of the parallel FoV in deg square.
|
|
257
271
|
member_threshold: float, optional
|
|
@@ -263,8 +277,6 @@ def do_statistical_membership(
|
|
|
263
277
|
Name of the column containing the RA of the stars. Default is "RA".
|
|
264
278
|
deccol: str, optional
|
|
265
279
|
Name of the column containing the DEC of the stars. Default is "DEC".
|
|
266
|
-
process_iter: int, optional
|
|
267
|
-
Number of iterations to perform. Default is 3.
|
|
268
280
|
min_star_per_cell: int, optional
|
|
269
281
|
Minimum number of stars per Voronoi cell. Default is 3.
|
|
270
282
|
membership_iter: int, optional
|
|
@@ -325,30 +337,34 @@ def do_statistical_membership(
|
|
|
325
337
|
]
|
|
326
338
|
|
|
327
339
|
# initialize the cluster columns for membership and differential reddening
|
|
328
|
-
dr_band1_corr =
|
|
329
|
-
dr_band2_corr =
|
|
330
|
-
df_cluster[dr_band1_corr] = df_cluster[
|
|
331
|
-
df_cluster[dr_band2_corr] = df_cluster[
|
|
340
|
+
dr_band1_corr = target_mag_col[0] + "_drcorr"
|
|
341
|
+
dr_band2_corr = target_mag_col[1] + "_drcorr"
|
|
342
|
+
df_cluster[dr_band1_corr] = df_cluster[target_mag_col[0]]
|
|
343
|
+
df_cluster[dr_band2_corr] = df_cluster[target_mag_col[1]]
|
|
332
344
|
|
|
333
345
|
dr_params["band1"] = dr_band1_corr
|
|
334
346
|
dr_params["band2"] = dr_band2_corr
|
|
335
347
|
|
|
348
|
+
dr_params["xcol"] = racol
|
|
349
|
+
dr_params["ycol"] = deccol
|
|
350
|
+
|
|
336
351
|
df_cluster["delta_ebv"] = 0.0
|
|
337
352
|
df_cluster["membership"] = 1.0
|
|
338
353
|
|
|
339
354
|
it = 0
|
|
355
|
+
it_stop = None
|
|
340
356
|
# for it in range(process_iter):
|
|
341
357
|
while True:
|
|
342
358
|
print(f"ITERATION {it+1}")
|
|
343
359
|
|
|
344
360
|
# reddening differential correction
|
|
345
|
-
print("
|
|
346
|
-
print(df_cluster["membership"].describe())
|
|
361
|
+
print("Compute differential reddening..")
|
|
362
|
+
# print(df_cluster["membership"].describe())
|
|
347
363
|
if it == 0:
|
|
348
364
|
print("First iteration, correction threshold skipped")
|
|
349
365
|
calc_corr_threhsold = False
|
|
350
366
|
else:
|
|
351
|
-
print(f"
|
|
367
|
+
print(f"Do calculation of the correction threshold")
|
|
352
368
|
calc_corr_threhsold = True
|
|
353
369
|
|
|
354
370
|
b1_corr, b2_corr, EBV, poli = compute_differential_reddening(
|
|
@@ -395,11 +411,14 @@ def do_statistical_membership(
|
|
|
395
411
|
# _, ax = plt.subplots()
|
|
396
412
|
# ax.hist(EBV, bins=30, color="gray", edgecolor="black", density=True)
|
|
397
413
|
# plt.show()
|
|
398
|
-
print(
|
|
414
|
+
print(
|
|
415
|
+
f"Number of stars with null ebv: {np.sum(EBV == 0.0) / EBV.shape[0] * 100:.2f}%"
|
|
416
|
+
f" ({np.sum(EBV == 0.0)} over {EBV.shape[0]})"
|
|
417
|
+
)
|
|
399
418
|
photometric_error = np.median(
|
|
400
419
|
(
|
|
401
|
-
df_cluster[
|
|
402
|
-
+ df_cluster[
|
|
420
|
+
df_cluster[target_mag_col_error[0]] ** 2
|
|
421
|
+
+ df_cluster[target_mag_col_error[1]] ** 2
|
|
403
422
|
)
|
|
404
423
|
** 0.5
|
|
405
424
|
)
|
|
@@ -486,9 +505,14 @@ def do_statistical_membership(
|
|
|
486
505
|
membership[:, 1]
|
|
487
506
|
)
|
|
488
507
|
|
|
508
|
+
if it == it_stop:
|
|
509
|
+
break
|
|
510
|
+
|
|
489
511
|
if abs(np.median(EBV)) < abs(photometric_error) and it > 0:
|
|
490
512
|
print("Differential reddening converged, stopping iterations.")
|
|
491
|
-
|
|
513
|
+
print("Next iteration will be the last one.")
|
|
514
|
+
it_stop = it + 1
|
|
515
|
+
|
|
492
516
|
it += 1
|
|
493
517
|
|
|
494
518
|
return df_cluster
|
|
@@ -3,6 +3,7 @@ import matplotlib.pyplot as plt
|
|
|
3
3
|
import matplotlib.cm as cm
|
|
4
4
|
from matplotlib.ticker import MultipleLocator
|
|
5
5
|
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
|
|
6
|
+
from matplotlib.gridspec import GridSpec
|
|
6
7
|
|
|
7
8
|
from scipy.spatial import voronoi_plot_2d, Voronoi
|
|
8
9
|
from scipy.stats import norm
|
|
@@ -678,25 +679,24 @@ def plot_vpd_and_mdist_component(
|
|
|
678
679
|
vpd_xlabel=None,
|
|
679
680
|
vpd_ylabel=None,
|
|
680
681
|
figsize_inches=8,
|
|
681
|
-
wspace=0.05,
|
|
682
|
-
hspace=0.05,
|
|
683
682
|
figsize_wadjust=0.0,
|
|
684
683
|
figsize_hadjust=-0.6,
|
|
685
684
|
xlim=None,
|
|
686
685
|
ylim=None,
|
|
687
686
|
membership_cmap="coolwarm",
|
|
687
|
+
component_colors=None,
|
|
688
688
|
hist_scale="log",
|
|
689
689
|
):
|
|
690
690
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
layout,
|
|
694
|
-
figsize=(figsize_inches + figsize_wadjust, figsize_inches + figsize_hadjust),
|
|
695
|
-
width_ratios=[1, 0.3],
|
|
696
|
-
height_ratios=[0.3, 1],
|
|
697
|
-
gridspec_kw={"wspace": wspace, "hspace": hspace},
|
|
698
|
-
layout="compressed",
|
|
691
|
+
fig = plt.figure(
|
|
692
|
+
figsize=(figsize_inches + figsize_wadjust, figsize_inches + figsize_hadjust)
|
|
699
693
|
)
|
|
694
|
+
gs = GridSpec(4, 4, wspace=0, hspace=0)
|
|
695
|
+
|
|
696
|
+
ax_scatter = fig.add_subplot(gs[1:4, 0:3])
|
|
697
|
+
ax_hist_x = fig.add_subplot(gs[0, 0:3]) # sharex=ax_scatter)
|
|
698
|
+
ax_hist_y = fig.add_subplot(gs[1:4, 3]) # sharey=ax_scatter)
|
|
699
|
+
axs_dict = {"vpd": ax_scatter, "histx": ax_hist_x, "histy": ax_hist_y}
|
|
700
700
|
|
|
701
701
|
capsize = 1.5
|
|
702
702
|
ms = 15
|
|
@@ -766,8 +766,11 @@ def plot_vpd_and_mdist_component(
|
|
|
766
766
|
if ylim is not None:
|
|
767
767
|
axs_dict["vpd"].set(ylim=ylim)
|
|
768
768
|
|
|
769
|
-
|
|
770
|
-
|
|
769
|
+
if component_colors is None:
|
|
770
|
+
cmap = mpl.colormaps["Set1"]
|
|
771
|
+
component_colors = [cmap(i) for i in range(ncomp)]
|
|
772
|
+
else:
|
|
773
|
+
assert len(component_colors) == ncomp, "Component colors length mismatch."
|
|
771
774
|
|
|
772
775
|
# Mdist
|
|
773
776
|
mdist_x_sum = None
|
mgcs_pytools-0.1.4/PKG-INFO
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: MGCS_pytools
|
|
3
|
-
Version: 0.1.4
|
|
4
|
-
Summary: A collection of Python tools for data analysis and visualization made for the MGCS HST Treasury program.
|
|
5
|
-
Author-email: Luca Rosignoli <luca.rosignoli@inaf.it>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/LR-inaf/MGCS_pytools
|
|
8
|
-
Project-URL: Bug Tracker, https://github.com/LR-inaf/MGCS_pytools/issues
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Requires-Dist: numpy
|
|
12
|
-
Requires-Dist: pandas
|
|
13
|
-
Requires-Dist: shapely
|
|
14
|
-
Requires-Dist: scipy
|
|
15
|
-
Requires-Dist: matplotlib
|
|
16
|
-
Requires-Dist: astropy
|
|
17
|
-
Requires-Dist: emcee
|
|
18
|
-
Requires-Dist: corner
|
|
19
|
-
Requires-Dist: tqdm
|
|
20
|
-
Requires-Dist: seaborn
|
|
21
|
-
Requires-Dist: h5py
|
|
22
|
-
Requires-Dist: scikit-learn
|
|
23
|
-
Dynamic: license-file
|
|
24
|
-
|
|
25
|
-
# Python tools used for the Missing Globular Cluster Survey
|
mgcs_pytools-0.1.4/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Python tools used for the Missing Globular Cluster Survey
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: MGCS_pytools
|
|
3
|
-
Version: 0.1.4
|
|
4
|
-
Summary: A collection of Python tools for data analysis and visualization made for the MGCS HST Treasury program.
|
|
5
|
-
Author-email: Luca Rosignoli <luca.rosignoli@inaf.it>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.com/LR-inaf/MGCS_pytools
|
|
8
|
-
Project-URL: Bug Tracker, https://github.com/LR-inaf/MGCS_pytools/issues
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Requires-Dist: numpy
|
|
12
|
-
Requires-Dist: pandas
|
|
13
|
-
Requires-Dist: shapely
|
|
14
|
-
Requires-Dist: scipy
|
|
15
|
-
Requires-Dist: matplotlib
|
|
16
|
-
Requires-Dist: astropy
|
|
17
|
-
Requires-Dist: emcee
|
|
18
|
-
Requires-Dist: corner
|
|
19
|
-
Requires-Dist: tqdm
|
|
20
|
-
Requires-Dist: seaborn
|
|
21
|
-
Requires-Dist: h5py
|
|
22
|
-
Requires-Dist: scikit-learn
|
|
23
|
-
Dynamic: license-file
|
|
24
|
-
|
|
25
|
-
# Python tools used for the Missing Globular Cluster Survey
|
mgcs_pytools-0.1.4/test/test.py
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import pandas as pd
|
|
3
|
-
import numpy as np
|
|
4
|
-
|
|
5
|
-
import statistical_membership.membership as stat_mem
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def main():
|
|
9
|
-
CATALOG_PATH = os.path.join(
|
|
10
|
-
os.getcwd(), "NGC6749.CAT.v1"
|
|
11
|
-
) # Replace with the actual path to your catalog
|
|
12
|
-
OUTPUT_PATH = os.getcwd() # Replace with the actual path to your output directory
|
|
13
|
-
|
|
14
|
-
# v1cat = "/home/linux-machine/NGC6749/NGC6749.CAT.v1"
|
|
15
|
-
|
|
16
|
-
df_cat_v1 = pd.read_csv(os.path.join(CATALOG_PATH, "NGC6749.CAT.v1"), sep="\s+")
|
|
17
|
-
df_cat_v1 = df_cat_v1[df_cat_v1["oktot(54)"] == 1]
|
|
18
|
-
df_cat_v1["membership"] = 0.0
|
|
19
|
-
|
|
20
|
-
cluster_mag = ["m6061c(6)", "m8141c(7)"]
|
|
21
|
-
cluster_mag_corr = [col + "_rdcorr" for col in cluster_mag]
|
|
22
|
-
field_mag = ["m6062c(8)", "m8142c(9)"]
|
|
23
|
-
|
|
24
|
-
df_field = df_cat_v1[df_cat_v1[field_mag[0]] != 0.0]
|
|
25
|
-
df_cluster = df_cat_v1[df_cat_v1[cluster_mag[0]] != 0.0]
|
|
26
|
-
|
|
27
|
-
fov_wfc3 = 163.0**2 # arcsec squared
|
|
28
|
-
fov_acs = 202.0**2 # arcsec squared
|
|
29
|
-
|
|
30
|
-
# reload(stat_mem)
|
|
31
|
-
|
|
32
|
-
# setting up the parameters for the reddening correction
|
|
33
|
-
dr_params = {
|
|
34
|
-
"rband1": 0.903,
|
|
35
|
-
"rband2": 0.597,
|
|
36
|
-
"TO_mag": 22,
|
|
37
|
-
"TO_color": 1.75,
|
|
38
|
-
"nref": 20,
|
|
39
|
-
"xcol": "x(3)",
|
|
40
|
-
"ycol": "y(4)",
|
|
41
|
-
"band1": cluster_mag[0],
|
|
42
|
-
"band2": cluster_mag[1],
|
|
43
|
-
"ord_step": 0.2,
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# ord_max = -0.4 # 0.40
|
|
47
|
-
# ord_min = -2.0 # -0.05
|
|
48
|
-
# roi = np.array([[1.0, ord_max], [2.1, ord_max], [0.3, ord_min], [-0.2, ord_min]])
|
|
49
|
-
# roi = np.array([[-0.8, ord_max], [0, ord_max], [-4, ord_min], [-5, ord_min]])
|
|
50
|
-
# compute ememberhsip and reddening correction
|
|
51
|
-
df_cluster_corr = stat_mem.do_statistical_membership(
|
|
52
|
-
df_cluster,
|
|
53
|
-
df_field,
|
|
54
|
-
field_mag,
|
|
55
|
-
dr_params,
|
|
56
|
-
racol="ra(1)",
|
|
57
|
-
deccol="dec(2)",
|
|
58
|
-
fov_ratio=fov_acs / fov_wfc3,
|
|
59
|
-
minstars=1000,
|
|
60
|
-
memebership_iter=100,
|
|
61
|
-
member_threshold=0.9,
|
|
62
|
-
plot_dred=True,
|
|
63
|
-
plot_voronoi=True,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if __name__ == "__main__":
|
|
68
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/mcmc/legacy/multivariate_2d_posterior.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/__init__.py
RENAMED
|
File without changes
|
{mgcs_pytools-0.1.4 → mgcs_pytools-0.2.1}/src/mgcs_pytools/statistical_membership/region_tools.py
RENAMED
|
File without changes
|
|
File without changes
|