MGCS-pytools 0.1.2__tar.gz → 0.1.4__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.1.2 → mgcs_pytools-0.1.4}/PKG-INFO +1 -1
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/pyproject.toml +1 -1
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/MGCS_pytools.egg-info/PKG-INFO +1 -1
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/membership.py +36 -15
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/LICENSE +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/README.md +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/setup.cfg +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/MGCS_pytools.egg-info/SOURCES.txt +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/MGCS_pytools.egg-info/dependency_links.txt +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/MGCS_pytools.egg-info/requires.txt +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/MGCS_pytools.egg-info/top_level.txt +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/__init__.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/mcmc/__init__.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/mcmc/bivariate_normal.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/mcmc/legacy/multivariate_2d_posterior.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/mcmc/mcmc.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/mcmc/set_posterior.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/mcmc/utils.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/__init__.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/cvt_grid.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/dr_correction.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/region_tools.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/utils/__init__.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/utils/plotting.py +0 -0
- {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/test/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MGCS_pytools
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A collection of Python tools for data analysis and visualization made for the MGCS HST Treasury program.
|
|
5
5
|
Author-email: Luca Rosignoli <luca.rosignoli@inaf.it>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -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.1.4"
|
|
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"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: MGCS_pytools
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A collection of Python tools for data analysis and visualization made for the MGCS HST Treasury program.
|
|
5
5
|
Author-email: Luca Rosignoli <luca.rosignoli@inaf.it>
|
|
6
6
|
License-Expression: MIT
|
{mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/membership.py
RENAMED
|
@@ -22,10 +22,7 @@ from .dr_correction import compute_differential_reddening
|
|
|
22
22
|
from .cvt_grid import cvtGrid
|
|
23
23
|
from .region_tools import get_regions_count, get_pts_in_regions
|
|
24
24
|
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
# sys.path.append("..") # add parent directory to path
|
|
28
|
-
from ..mcmc.utils import plotting as utplot
|
|
25
|
+
from mgcs_pytools.utils import plotting as utplot
|
|
29
26
|
|
|
30
27
|
#
|
|
31
28
|
#
|
|
@@ -226,6 +223,7 @@ def do_statistical_membership(
|
|
|
226
223
|
df_field_input: DataFrame,
|
|
227
224
|
field_mag_col: list[str],
|
|
228
225
|
dr_params: dict[str, str],
|
|
226
|
+
parallel_fov: float,
|
|
229
227
|
member_threshold: float = 0.8,
|
|
230
228
|
minstars: int = 200,
|
|
231
229
|
racol: str = "RA",
|
|
@@ -233,7 +231,7 @@ def do_statistical_membership(
|
|
|
233
231
|
process_iter: int = 3,
|
|
234
232
|
min_star_per_cell: int = 3,
|
|
235
233
|
membership_iter: int = 1000,
|
|
236
|
-
fov_ratio: float = 1.0,
|
|
234
|
+
# fov_ratio: float = 1.0,
|
|
237
235
|
roi: list[float] | None = None,
|
|
238
236
|
plot_dred: bool = False,
|
|
239
237
|
plot_voronoi: bool = False,
|
|
@@ -254,6 +252,8 @@ def do_statistical_membership(
|
|
|
254
252
|
Dictionary containing the names of the columns with the magnitudes
|
|
255
253
|
to use for the differential reddening correction.
|
|
256
254
|
Example: {"band1": "F606W", "band2": "F814W"}
|
|
255
|
+
parallel_fov: float
|
|
256
|
+
Size of the parallel FoV in deg square.
|
|
257
257
|
member_threshold: float, optional
|
|
258
258
|
Membership threshold to consider a star as a member of the cluster.
|
|
259
259
|
Default is 0.8.
|
|
@@ -317,7 +317,7 @@ def do_statistical_membership(
|
|
|
317
317
|
+ (df_cluster[deccol].max() - df_cluster[deccol].min()) / 2
|
|
318
318
|
)
|
|
319
319
|
|
|
320
|
-
fov_ratio = [subfov.area /
|
|
320
|
+
fov_ratio = [subfov.area / parallel_fov for subfov in subfovs]
|
|
321
321
|
|
|
322
322
|
field_pts = [
|
|
323
323
|
Point(row[field_mag_col[0]] - row[field_mag_col[1]], row[field_mag_col[0]])
|
|
@@ -336,7 +336,9 @@ def do_statistical_membership(
|
|
|
336
336
|
df_cluster["delta_ebv"] = 0.0
|
|
337
337
|
df_cluster["membership"] = 1.0
|
|
338
338
|
|
|
339
|
-
|
|
339
|
+
it = 0
|
|
340
|
+
# for it in range(process_iter):
|
|
341
|
+
while True:
|
|
340
342
|
print(f"ITERATION {it+1}")
|
|
341
343
|
|
|
342
344
|
# reddening differential correction
|
|
@@ -357,6 +359,7 @@ def do_statistical_membership(
|
|
|
357
359
|
roi=roi,
|
|
358
360
|
plot=plot_dred,
|
|
359
361
|
)
|
|
362
|
+
|
|
360
363
|
roi = poli
|
|
361
364
|
df_cluster[dr_band1_corr] = b1_corr
|
|
362
365
|
df_cluster[dr_band2_corr] = b2_corr
|
|
@@ -365,18 +368,17 @@ def do_statistical_membership(
|
|
|
365
368
|
if plot_dred:
|
|
366
369
|
# plot new cmd
|
|
367
370
|
_, ax = plt.subplots(layout="constrained")
|
|
371
|
+
|
|
368
372
|
utplot.plot_cmd(
|
|
373
|
+
df_cluster[dr_band1_corr],
|
|
374
|
+
df_cluster[dr_band2_corr],
|
|
369
375
|
ax,
|
|
370
|
-
df_cluster,
|
|
371
|
-
[dr_band1_corr, dr_band2_corr],
|
|
372
|
-
color="black",
|
|
373
|
-
inverty=True,
|
|
374
376
|
)
|
|
375
|
-
ax.set(xlim=(0.5, 3.5), ylim=(26.5, 14))
|
|
377
|
+
# ax.set(xlim=(0.5, 3.5), ylim=(26.5, 14))
|
|
376
378
|
|
|
377
379
|
# plot reddening map
|
|
378
380
|
_ = utplot.plot_reddening_map(
|
|
379
|
-
df_cluster[
|
|
381
|
+
df_cluster[racol],
|
|
380
382
|
df_cluster[deccol],
|
|
381
383
|
ra_center,
|
|
382
384
|
dec_center,
|
|
@@ -387,9 +389,23 @@ def do_statistical_membership(
|
|
|
387
389
|
plt.pause(1.0)
|
|
388
390
|
|
|
389
391
|
print("...differential reddening completed")
|
|
390
|
-
print(
|
|
392
|
+
print(
|
|
393
|
+
f"EBV stat (mean, min, max): {np.median(EBV):.6f}, {EBV.min():.6f}, {EBV.max():.6f}"
|
|
394
|
+
)
|
|
395
|
+
# _, ax = plt.subplots()
|
|
396
|
+
# ax.hist(EBV, bins=30, color="gray", edgecolor="black", density=True)
|
|
397
|
+
# plt.show()
|
|
398
|
+
print("number of stars with null ebv: ", np.sum(EBV == 0.0) / EBV.shape[0])
|
|
399
|
+
photometric_error = np.median(
|
|
400
|
+
(
|
|
401
|
+
df_cluster[dr_params["band1_error"]] ** 2
|
|
402
|
+
+ df_cluster[dr_params["band2_error"]] ** 2
|
|
403
|
+
)
|
|
404
|
+
** 0.5
|
|
405
|
+
)
|
|
406
|
+
print(f"Mean photometric error: {photometric_error:.6f}")
|
|
391
407
|
|
|
392
|
-
print("Start
|
|
408
|
+
print("Start decontamination process..")
|
|
393
409
|
for i, (group, fovr) in enumerate(zip(groups, fov_ratio)):
|
|
394
410
|
|
|
395
411
|
# updating the membership of the groups
|
|
@@ -470,4 +486,9 @@ def do_statistical_membership(
|
|
|
470
486
|
membership[:, 1]
|
|
471
487
|
)
|
|
472
488
|
|
|
489
|
+
if abs(np.median(EBV)) < abs(photometric_error) and it > 0:
|
|
490
|
+
print("Differential reddening converged, stopping iterations.")
|
|
491
|
+
break
|
|
492
|
+
it += 1
|
|
493
|
+
|
|
473
494
|
return df_cluster
|
|
File without changes
|
|
File without changes
|
|
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.2 → mgcs_pytools-0.1.4}/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.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/__init__.py
RENAMED
|
File without changes
|
{mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/cvt_grid.py
RENAMED
|
File without changes
|
{mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/dr_correction.py
RENAMED
|
File without changes
|
{mgcs_pytools-0.1.2 → mgcs_pytools-0.1.4}/src/mgcs_pytools/statistical_membership/region_tools.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|