pz-rail-astro-tools 1.0.0__tar.gz → 1.0.2__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.
Potentially problematic release.
This version of pz-rail-astro-tools might be problematic. Click here for more details.
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/PKG-INFO +1 -1
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/pz_rail_astro_tools.egg-info/PKG-INFO +1 -1
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/pz_rail_astro_tools.egg-info/SOURCES.txt +1 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/astro_tools/_version.py +2 -2
- pz_rail_astro_tools-1.0.2/src/rail/examples_data/testdata/rubin_dm_dc2_example2.pq +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/tools/photometry_tools.py +37 -12
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/tests/astro_tools/test_core.py +7 -5
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.copier-answers.yml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/ISSUE_TEMPLATE/0-general_issue.md +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/ISSUE_TEMPLATE/1-bug_report.md +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/ISSUE_TEMPLATE/2-feature_request.md +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/pull_request_template.md +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/workflows/add-issue-to-project-tracker.yml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/workflows/linting.yml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/workflows/publish-to-pypi.yml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/workflows/smoke-test.yml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/workflows/testing-and-coverage.yml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.gitignore +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.pre-commit-config.yaml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/LICENSE +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/README.md +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/environment.yml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/pyproject.toml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/setup.cfg +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/setup.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/pz_rail_astro_tools.egg-info/dependency_links.txt +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/pz_rail_astro_tools.egg-info/requires.txt +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/pz_rail_astro_tools.egg-info/top_level.txt +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/astro_tools/__init__.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/creation/degraders/grid_selection.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/creation/degraders/lsst_error_model.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/creation/degraders/observing_condition_degrader.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/creation/degraders/photometric_errors.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/creation/degraders/spectroscopic_degraders.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/creation/degraders/spectroscopic_selections.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/creation/engines/gcr_engine.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/examples_data/creation_data/data/HSC_grid_settings.pkl +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/examples_data/creation_data/data/hsc_ratios_and_specz.hdf5 +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/examples_data/creation_data/data/survey_conditions/DC2-dr6-galcounts-i20-i25.3-nside-128.fits +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/examples_data/creation_data/data/survey_conditions/DC2-mask-neg-nside-128.fits +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_airmass_i_and_nightlt1825_HEAL.fits +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_fiveSigmaDepth_i_and_nightlt1825_HEAL.fits +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/tests/astro_tools/gcr_test_data/schema.yaml +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/tests/astro_tools/gcr_test_data/test_object_tract_4850.hdf5 +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/tests/astro_tools/test_degraders.py +0 -0
- {pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/tests/astro_tools/test_gcr_engine.py +0 -0
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/pz_rail_astro_tools.egg-info/SOURCES.txt
RENAMED
|
@@ -35,6 +35,7 @@ src/rail/examples_data/creation_data/data/survey_conditions/DC2-dr6-galcounts-i2
|
|
|
35
35
|
src/rail/examples_data/creation_data/data/survey_conditions/DC2-mask-neg-nside-128.fits
|
|
36
36
|
src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_airmass_i_and_nightlt1825_HEAL.fits
|
|
37
37
|
src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_fiveSigmaDepth_i_and_nightlt1825_HEAL.fits
|
|
38
|
+
src/rail/examples_data/testdata/rubin_dm_dc2_example2.pq
|
|
38
39
|
src/rail/tools/photometry_tools.py
|
|
39
40
|
tests/astro_tools/test_core.py
|
|
40
41
|
tests/astro_tools/test_degraders.py
|
|
Binary file
|
|
@@ -13,6 +13,7 @@ from ceci.config import StageParameter as Param
|
|
|
13
13
|
from rail.core.data import PqHandle
|
|
14
14
|
from rail.core.stage import RailStage
|
|
15
15
|
from rail.core.data import PqHandle, Hdf5Handle
|
|
16
|
+
from rail.core.common_params import SHARED_PARAMS
|
|
16
17
|
|
|
17
18
|
import hyperbolic # https://github.com/jlvdb/hyperbolic
|
|
18
19
|
|
|
@@ -20,8 +21,6 @@ dustmaps_config = tables_io.lazy_modules.lazyImport('dustmaps.config')
|
|
|
20
21
|
dustmaps_sfd = tables_io.lazy_modules.lazyImport('dustmaps.sfd')
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
24
|
# default column names in DC2
|
|
26
25
|
LSST_BANDS = 'ugrizy'
|
|
27
26
|
DEFAULT_MAG_COLS = [f"mag_{band}_lsst" for band in LSST_BANDS]
|
|
@@ -333,7 +332,7 @@ class HyperbolicMagnitudes(PhotometryManipulator):
|
|
|
333
332
|
Input table with photometry (magnitudes or flux columns and their respective
|
|
334
333
|
uncertainties) as defined by the configuration.
|
|
335
334
|
parameters : `PqHandle`
|
|
336
|
-
Table
|
|
335
|
+
Table witdh smoothing parameters per photometric band, determined by
|
|
337
336
|
`HyperbolicSmoothing`.
|
|
338
337
|
|
|
339
338
|
Returns
|
|
@@ -412,16 +411,18 @@ class LSSTFluxToMagConverter(RailStage):
|
|
|
412
411
|
return self.get_handle('output')
|
|
413
412
|
|
|
414
413
|
|
|
415
|
-
class
|
|
414
|
+
class DustMapBase(RailStage):
|
|
416
415
|
"""Utility stage that does dereddening
|
|
417
416
|
|
|
418
417
|
Note: set copy_all_cols=True to copy all
|
|
419
418
|
columns in data, copy_cols will be ignored
|
|
420
419
|
"""
|
|
421
|
-
name = '
|
|
420
|
+
name = 'DustMapBase'
|
|
422
421
|
|
|
423
422
|
config_options = RailStage.config_options.copy()
|
|
424
423
|
config_options.update(bands='ugrizy')
|
|
424
|
+
config_options.update(ra_name='ra')
|
|
425
|
+
config_options.update(dec_name='dec')
|
|
425
426
|
config_options.update(mag_name="mag_{band}_lsst")
|
|
426
427
|
config_options.update(band_a_env=[4.81,3.64,2.70,2.06,1.58,1.31])
|
|
427
428
|
config_options.update(dustmap_name='sfd')
|
|
@@ -429,8 +430,8 @@ class Dereddener(RailStage):
|
|
|
429
430
|
config_options.update(copy_cols=[])
|
|
430
431
|
config_options.update(copy_all_cols=False)
|
|
431
432
|
|
|
432
|
-
inputs = [('input',
|
|
433
|
-
outputs = [('output',
|
|
433
|
+
inputs = [('input', PqHandle)]
|
|
434
|
+
outputs = [('output', PqHandle)]
|
|
434
435
|
|
|
435
436
|
def fetch_map(self):
|
|
436
437
|
dust_map_dict = dict(sfd=dustmaps_sfd)
|
|
@@ -439,12 +440,15 @@ class Dereddener(RailStage):
|
|
|
439
440
|
except KeyError as msg: # pragma: no cover
|
|
440
441
|
raise KeyError(f"Unknown dustmap {self.config.dustmap_name}, options are {list(dust_map_dict.keys())}") from msg
|
|
441
442
|
|
|
442
|
-
|
|
443
|
+
dustmap_dir = os.path.expandvars(self.config.dustmap_dir)
|
|
444
|
+
dustmap_path = os.path.join(dustmap_dir, self.config.dustmap_name)
|
|
445
|
+
if os.path.exists(dustmap_path): # pragma: no cover
|
|
443
446
|
# already downloaded, return
|
|
444
447
|
return
|
|
445
448
|
|
|
446
449
|
dust_map_config = dustmaps_config.config
|
|
447
|
-
dust_map_config['data_dir'] = self.config.dustmap_dir
|
|
450
|
+
# dust_map_config['data_dir'] = self.config.dustmap_dir
|
|
451
|
+
dust_map_config['data_dir'] = dustmap_dir
|
|
448
452
|
fetch_func = dust_map_submod.fetch
|
|
449
453
|
fetch_func()
|
|
450
454
|
|
|
@@ -455,7 +459,7 @@ class Dereddener(RailStage):
|
|
|
455
459
|
def run(self):
|
|
456
460
|
data = self.get_data('input', allow_missing=True)
|
|
457
461
|
out_data = {}
|
|
458
|
-
coords = SkyCoord(data[
|
|
462
|
+
coords = SkyCoord(data[self.config.ra_name], data[self.config.dec_name], unit = 'deg',frame='fk5')
|
|
459
463
|
dust_map_dict = dict(sfd=dustmaps_sfd.SFDQuery)
|
|
460
464
|
try:
|
|
461
465
|
dust_map_class = dust_map_dict[self.config.dustmap_name]
|
|
@@ -469,7 +473,7 @@ class Dereddener(RailStage):
|
|
|
469
473
|
for i, band_ in enumerate(self.config.bands):
|
|
470
474
|
band_mag_name = self.config.mag_name.format(band=band_)
|
|
471
475
|
mag_vals = data[band_mag_name]
|
|
472
|
-
out_data[band_mag_name] = mag_vals
|
|
476
|
+
out_data[band_mag_name] = self._calc_values(mag_vals, ebvvec, self.config.band_a_env[i])
|
|
473
477
|
band_mag_name_list.append(band_mag_name)
|
|
474
478
|
|
|
475
479
|
# check if copy_all_cols set to true:
|
|
@@ -482,7 +486,8 @@ class Dereddener(RailStage):
|
|
|
482
486
|
if col_ not in band_mag_name_list:
|
|
483
487
|
out_data[col_] = data[col_]
|
|
484
488
|
|
|
485
|
-
|
|
489
|
+
out_data_pd = pd.DataFrame(out_data)
|
|
490
|
+
self.add_data('output', out_data_pd)
|
|
486
491
|
|
|
487
492
|
def __call__(self, data):
|
|
488
493
|
"""Return a converted table
|
|
@@ -500,3 +505,23 @@ class Dereddener(RailStage):
|
|
|
500
505
|
self.set_data('input', data)
|
|
501
506
|
self.run()
|
|
502
507
|
return self.get_handle('output')
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
class Dereddener(DustMapBase):
|
|
511
|
+
"""Utility stage that does dereddening
|
|
512
|
+
|
|
513
|
+
"""
|
|
514
|
+
name = 'Dereddener'
|
|
515
|
+
|
|
516
|
+
def _calc_values(self, mag_vals, ebvvec, band_a_env):
|
|
517
|
+
return mag_vals - ebvvec*band_a_env
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
class Reddener(DustMapBase):
|
|
521
|
+
"""Utility stage that does reddening
|
|
522
|
+
|
|
523
|
+
"""
|
|
524
|
+
name = 'Reddener'
|
|
525
|
+
|
|
526
|
+
def _calc_values(self, mag_vals, ebvvec, band_a_env):
|
|
527
|
+
return mag_vals + ebvvec*band_a_env
|
|
@@ -20,8 +20,8 @@ from rail.core.data import (
|
|
|
20
20
|
TableHandle,
|
|
21
21
|
)
|
|
22
22
|
from rail.core.stage import RailStage
|
|
23
|
-
from rail.tools.photometry_tools import HyperbolicMagnitudes, HyperbolicSmoothing, PhotometryManipulator, LSSTFluxToMagConverter, Dereddener
|
|
24
|
-
from rail.utils.path_utils import RAILDIR
|
|
23
|
+
from rail.tools.photometry_tools import HyperbolicMagnitudes, HyperbolicSmoothing, PhotometryManipulator, LSSTFluxToMagConverter, Dereddener, Reddener
|
|
24
|
+
from rail.utils.path_utils import RAILDIR, find_rail_file
|
|
25
25
|
#from rail.tools.util_stages import (
|
|
26
26
|
# LSSTFluxToMagConverter,
|
|
27
27
|
# Dereddener,
|
|
@@ -37,7 +37,7 @@ def test_flux2mag():
|
|
|
37
37
|
DS = RailStage.data_store
|
|
38
38
|
DS.clear()
|
|
39
39
|
|
|
40
|
-
testFile = os.path.join(
|
|
40
|
+
testFile = find_rail_file(os.path.join("examples_data", "testdata", "rubin_dm_dc2_example2.pq"))
|
|
41
41
|
test_data = DS.read_file("test_data", TableHandle, testFile)
|
|
42
42
|
|
|
43
43
|
fluxToMag = LSSTFluxToMagConverter.make_stage(name='flux2mag')
|
|
@@ -49,10 +49,10 @@ def test_dereddener():
|
|
|
49
49
|
DS = RailStage.data_store
|
|
50
50
|
DS.clear()
|
|
51
51
|
|
|
52
|
-
testFile = os.path.join(
|
|
52
|
+
testFile = find_rail_file(os.path.join("examples_data", "testdata", "rubin_dm_dc2_example2.pq"))
|
|
53
53
|
test_data = DS.read_file("test_data", TableHandle, testFile)
|
|
54
54
|
|
|
55
|
-
fluxToMag = LSSTFluxToMagConverter.make_stage(name='flux2mag', copy_cols=dict(ra='ra',
|
|
55
|
+
fluxToMag = LSSTFluxToMagConverter.make_stage(name='flux2mag', copy_cols=dict(ra='ra', dec='decl'))
|
|
56
56
|
|
|
57
57
|
is_temp_dir = False
|
|
58
58
|
dustmap_dir = os.environ.get('RAIL_DUSTMAP_DIR')
|
|
@@ -62,10 +62,12 @@ def test_dereddener():
|
|
|
62
62
|
is_temp_dir = True
|
|
63
63
|
|
|
64
64
|
dereddener = Dereddener.make_stage(name='dereddner', dustmap_dir=dustmap_dir)
|
|
65
|
+
reddener = Reddener.make_stage(name='reddner', dustmap_dir=dustmap_dir)
|
|
65
66
|
dereddener.fetch_map()
|
|
66
67
|
|
|
67
68
|
flux_data = fluxToMag(test_data)
|
|
68
69
|
dered_data = dereddener(flux_data)
|
|
70
|
+
red_data = reddener(flux_data)
|
|
69
71
|
|
|
70
72
|
if is_temp_dir:
|
|
71
73
|
tmp_dustmap_dir.cleanup()
|
|
File without changes
|
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/ISSUE_TEMPLATE/0-general_issue.md
RENAMED
|
File without changes
|
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/ISSUE_TEMPLATE/1-bug_report.md
RENAMED
|
File without changes
|
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/ISSUE_TEMPLATE/2-feature_request.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/workflows/publish-to-pypi.yml
RENAMED
|
File without changes
|
|
File without changes
|
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/.github/workflows/testing-and-coverage.yml
RENAMED
|
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
|
|
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
|
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/src/rail/creation/engines/gcr_engine.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/tests/astro_tools/gcr_test_data/schema.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pz_rail_astro_tools-1.0.0 → pz_rail_astro_tools-1.0.2}/tests/astro_tools/test_gcr_engine.py
RENAMED
|
File without changes
|