MGCS-pytools 0.1.2__tar.gz → 0.1.3__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.
Files changed (25) hide show
  1. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/PKG-INFO +1 -1
  2. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/pyproject.toml +1 -1
  3. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/MGCS_pytools.egg-info/PKG-INFO +1 -1
  4. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/statistical_membership/membership.py +31 -13
  5. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/LICENSE +0 -0
  6. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/README.md +0 -0
  7. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/setup.cfg +0 -0
  8. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/MGCS_pytools.egg-info/SOURCES.txt +0 -0
  9. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/MGCS_pytools.egg-info/dependency_links.txt +0 -0
  10. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/MGCS_pytools.egg-info/requires.txt +0 -0
  11. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/MGCS_pytools.egg-info/top_level.txt +0 -0
  12. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/__init__.py +0 -0
  13. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/mcmc/__init__.py +0 -0
  14. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/mcmc/bivariate_normal.py +0 -0
  15. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/mcmc/legacy/multivariate_2d_posterior.py +0 -0
  16. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/mcmc/mcmc.py +0 -0
  17. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/mcmc/set_posterior.py +0 -0
  18. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/mcmc/utils.py +0 -0
  19. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/statistical_membership/__init__.py +0 -0
  20. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/statistical_membership/cvt_grid.py +0 -0
  21. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/statistical_membership/dr_correction.py +0 -0
  22. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/statistical_membership/region_tools.py +0 -0
  23. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/utils/__init__.py +0 -0
  24. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/src/mgcs_pytools/utils/plotting.py +0 -0
  25. {mgcs_pytools-0.1.2 → mgcs_pytools-0.1.3}/test/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MGCS_pytools
3
- Version: 0.1.2
3
+ Version: 0.1.3
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.2"
7
+ version = "0.1.3"
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.2
3
+ Version: 0.1.3
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
@@ -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 sys
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
  #
@@ -336,7 +333,9 @@ def do_statistical_membership(
336
333
  df_cluster["delta_ebv"] = 0.0
337
334
  df_cluster["membership"] = 1.0
338
335
 
339
- for it in range(process_iter):
336
+ it = 0
337
+ # for it in range(process_iter):
338
+ while True:
340
339
  print(f"ITERATION {it+1}")
341
340
 
342
341
  # reddening differential correction
@@ -357,6 +356,7 @@ def do_statistical_membership(
357
356
  roi=roi,
358
357
  plot=plot_dred,
359
358
  )
359
+
360
360
  roi = poli
361
361
  df_cluster[dr_band1_corr] = b1_corr
362
362
  df_cluster[dr_band2_corr] = b2_corr
@@ -365,18 +365,17 @@ def do_statistical_membership(
365
365
  if plot_dred:
366
366
  # plot new cmd
367
367
  _, ax = plt.subplots(layout="constrained")
368
+
368
369
  utplot.plot_cmd(
370
+ df_cluster[dr_band1_corr],
371
+ df_cluster[dr_band2_corr],
369
372
  ax,
370
- df_cluster,
371
- [dr_band1_corr, dr_band2_corr],
372
- color="black",
373
- inverty=True,
374
373
  )
375
- ax.set(xlim=(0.5, 3.5), ylim=(26.5, 14))
374
+ # ax.set(xlim=(0.5, 3.5), ylim=(26.5, 14))
376
375
 
377
376
  # plot reddening map
378
377
  _ = utplot.plot_reddening_map(
379
- df_cluster["ra(1)"],
378
+ df_cluster[racol],
380
379
  df_cluster[deccol],
381
380
  ra_center,
382
381
  dec_center,
@@ -387,9 +386,23 @@ def do_statistical_membership(
387
386
  plt.pause(1.0)
388
387
 
389
388
  print("...differential reddening completed")
390
- print(f"EBV stat: {EBV.mean():.4f}, {EBV.min():.4f}, {EBV.max():.4f}")
389
+ print(
390
+ f"EBV stat (mean, min, max): {np.median(EBV):.6f}, {EBV.min():.6f}, {EBV.max():.6f}"
391
+ )
392
+ # _, ax = plt.subplots()
393
+ # ax.hist(EBV, bins=30, color="gray", edgecolor="black", density=True)
394
+ # plt.show()
395
+ print("number of stars with null ebv: ", np.sum(EBV == 0.0) / EBV.shape[0])
396
+ photometric_error = np.median(
397
+ (
398
+ df_cluster[dr_params["band1_error"]] ** 2
399
+ + df_cluster[dr_params["band2_error"]] ** 2
400
+ )
401
+ ** 0.5
402
+ )
403
+ print(f"Mean photometric error: {photometric_error:.6f}")
391
404
 
392
- print("Start decontamionation process..")
405
+ print("Start decontamination process..")
393
406
  for i, (group, fovr) in enumerate(zip(groups, fov_ratio)):
394
407
 
395
408
  # updating the membership of the groups
@@ -470,4 +483,9 @@ def do_statistical_membership(
470
483
  membership[:, 1]
471
484
  )
472
485
 
486
+ if abs(np.median(EBV)) < abs(photometric_error) and it > 0:
487
+ print("Differential reddening converged, stopping iterations.")
488
+ break
489
+ it += 1
490
+
473
491
  return df_cluster
File without changes
File without changes
File without changes
File without changes