pz-rail-astro-tools 1.0.2__tar.gz → 1.0.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.
Potentially problematic release.
This version of pz-rail-astro-tools might be problematic. Click here for more details.
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.copier-answers.yml +1 -1
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/workflows/testing-and-coverage.yml +4 -2
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/PKG-INFO +4 -2
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/pyproject.toml +3 -1
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/pz_rail_astro_tools.egg-info/PKG-INFO +4 -2
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/pz_rail_astro_tools.egg-info/SOURCES.txt +3 -1
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/pz_rail_astro_tools.egg-info/requires.txt +3 -1
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/astro_tools/__init__.py +0 -1
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/astro_tools/_version.py +2 -2
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/creation/degraders/grid_selection.py +2 -2
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/creation/degraders/observing_condition_degrader.py +2 -2
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/creation/degraders/photometric_errors.py +12 -15
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/creation/degraders/spectroscopic_degraders.py +4 -4
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/creation/degraders/spectroscopic_selections.py +14 -14
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/creation/engines/gcr_engine.py +2 -2
- pz_rail_astro_tools-1.0.4/src/rail/pipelines/utility/apply_phot_errors.py +71 -0
- pz_rail_astro_tools-1.0.4/src/rail/pipelines/utility/spectroscopic_selection_pipeline.py +75 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/tools/photometry_tools.py +6 -9
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/tests/astro_tools/test_degraders.py +27 -1
- pz_rail_astro_tools-1.0.4/tests/astro_tools/test_pipline.py +15 -0
- pz_rail_astro_tools-1.0.2/src/rail/creation/degraders/lsst_error_model.py +0 -61
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/ISSUE_TEMPLATE/0-general_issue.md +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/ISSUE_TEMPLATE/1-bug_report.md +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/ISSUE_TEMPLATE/2-feature_request.md +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/pull_request_template.md +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/workflows/add-issue-to-project-tracker.yml +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/workflows/linting.yml +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/workflows/publish-to-pypi.yml +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/workflows/smoke-test.yml +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.gitignore +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.pre-commit-config.yaml +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/LICENSE +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/README.md +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/environment.yml +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/setup.cfg +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/setup.py +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/pz_rail_astro_tools.egg-info/dependency_links.txt +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/pz_rail_astro_tools.egg-info/top_level.txt +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/examples_data/creation_data/data/HSC_grid_settings.pkl +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/examples_data/creation_data/data/hsc_ratios_and_specz.hdf5 +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/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.2 → pz_rail_astro_tools-1.0.4}/src/rail/examples_data/creation_data/data/survey_conditions/DC2-mask-neg-nside-128.fits +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/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.2 → pz_rail_astro_tools-1.0.4}/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.2 → pz_rail_astro_tools-1.0.4}/src/rail/examples_data/testdata/rubin_dm_dc2_example2.pq +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/tests/astro_tools/gcr_test_data/schema.yaml +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/tests/astro_tools/gcr_test_data/test_object_tract_4850.hdf5 +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/tests/astro_tools/test_core.py +0 -0
- {pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/tests/astro_tools/test_gcr_engine.py +0 -0
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/workflows/testing-and-coverage.yml
RENAMED
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
16
|
strategy:
|
|
17
17
|
matrix:
|
|
18
|
-
python-version: ['3.
|
|
18
|
+
python-version: ['3.10', '3.11']
|
|
19
19
|
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/checkout@v3
|
|
@@ -35,4 +35,6 @@ jobs:
|
|
|
35
35
|
run: |
|
|
36
36
|
python -m pytest tests --cov=astro_tools --cov-report=xml
|
|
37
37
|
- name: Upload coverage report to codecov
|
|
38
|
-
uses: codecov/codecov-action@
|
|
38
|
+
uses: codecov/codecov-action@v4
|
|
39
|
+
with:
|
|
40
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pz-rail-astro-tools
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Author-email: "LSST Dark Energy Science Collaboration (DESC)" <lsst-desc-rail-admin@slac.stanford.edu>
|
|
5
5
|
License: MIT License
|
|
6
6
|
|
|
@@ -34,7 +34,9 @@ Requires-Python: >=3.9
|
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
License-File: LICENSE
|
|
36
36
|
Requires-Dist: deprecated
|
|
37
|
-
Requires-Dist: pz-rail-base
|
|
37
|
+
Requires-Dist: pz-rail-base>=1.0.3
|
|
38
|
+
Requires-Dist: numpy
|
|
39
|
+
Requires-Dist: pandas>=2.2.2
|
|
38
40
|
Requires-Dist: astropy
|
|
39
41
|
Requires-Dist: healpy
|
|
40
42
|
Requires-Dist: photerr
|
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/pz_rail_astro_tools.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pz-rail-astro-tools
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Author-email: "LSST Dark Energy Science Collaboration (DESC)" <lsst-desc-rail-admin@slac.stanford.edu>
|
|
5
5
|
License: MIT License
|
|
6
6
|
|
|
@@ -34,7 +34,9 @@ Requires-Python: >=3.9
|
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
License-File: LICENSE
|
|
36
36
|
Requires-Dist: deprecated
|
|
37
|
-
Requires-Dist: pz-rail-base
|
|
37
|
+
Requires-Dist: pz-rail-base>=1.0.3
|
|
38
|
+
Requires-Dist: numpy
|
|
39
|
+
Requires-Dist: pandas>=2.2.2
|
|
38
40
|
Requires-Dist: astropy
|
|
39
41
|
Requires-Dist: healpy
|
|
40
42
|
Requires-Dist: photerr
|
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/pz_rail_astro_tools.egg-info/SOURCES.txt
RENAMED
|
@@ -23,7 +23,6 @@ src/pz_rail_astro_tools.egg-info/top_level.txt
|
|
|
23
23
|
src/rail/astro_tools/__init__.py
|
|
24
24
|
src/rail/astro_tools/_version.py
|
|
25
25
|
src/rail/creation/degraders/grid_selection.py
|
|
26
|
-
src/rail/creation/degraders/lsst_error_model.py
|
|
27
26
|
src/rail/creation/degraders/observing_condition_degrader.py
|
|
28
27
|
src/rail/creation/degraders/photometric_errors.py
|
|
29
28
|
src/rail/creation/degraders/spectroscopic_degraders.py
|
|
@@ -36,9 +35,12 @@ src/rail/examples_data/creation_data/data/survey_conditions/DC2-mask-neg-nside-1
|
|
|
36
35
|
src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_airmass_i_and_nightlt1825_HEAL.fits
|
|
37
36
|
src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_fiveSigmaDepth_i_and_nightlt1825_HEAL.fits
|
|
38
37
|
src/rail/examples_data/testdata/rubin_dm_dc2_example2.pq
|
|
38
|
+
src/rail/pipelines/utility/apply_phot_errors.py
|
|
39
|
+
src/rail/pipelines/utility/spectroscopic_selection_pipeline.py
|
|
39
40
|
src/rail/tools/photometry_tools.py
|
|
40
41
|
tests/astro_tools/test_core.py
|
|
41
42
|
tests/astro_tools/test_degraders.py
|
|
42
43
|
tests/astro_tools/test_gcr_engine.py
|
|
44
|
+
tests/astro_tools/test_pipline.py
|
|
43
45
|
tests/astro_tools/gcr_test_data/schema.yaml
|
|
44
46
|
tests/astro_tools/gcr_test_data/test_object_tract_4850.hdf5
|
|
@@ -4,5 +4,4 @@ from rail.creation.degraders.grid_selection import *
|
|
|
4
4
|
from rail.creation.degraders.observing_condition_degrader import *
|
|
5
5
|
from rail.creation.degraders.spectroscopic_degraders import *
|
|
6
6
|
from rail.creation.degraders.spectroscopic_selections import *
|
|
7
|
-
from rail.creation.degraders.lsst_error_model import *
|
|
8
7
|
from rail.tools.photometry_tools import *
|
|
@@ -57,9 +57,9 @@ class GridSelection(Selector):
|
|
|
57
57
|
random_seed=Param(int, 12345, msg="random seed for reproducibility"),
|
|
58
58
|
scaling_factor=Param(float, 1.588, msg="multiplicative factor for ratios to adjust number of galaxies kept"))
|
|
59
59
|
|
|
60
|
-
def __init__(self, args,
|
|
60
|
+
def __init__(self, args, **kwargs):
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
super().__init__(args, **kwargs)
|
|
63
63
|
|
|
64
64
|
if self.config.redshift_cut < 0:
|
|
65
65
|
raise ValueError("redshift cut must be positive")
|
|
@@ -116,8 +116,8 @@ class ObsCondition(Noisifier):
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
def __init__(self, args,
|
|
120
|
-
|
|
119
|
+
def __init__(self, args, **kwargs):
|
|
120
|
+
super().__init__(args, **kwargs)
|
|
121
121
|
|
|
122
122
|
# store a list of keys relevant for
|
|
123
123
|
# survey conditions;
|
|
@@ -4,6 +4,7 @@ error models defined in the package photerr
|
|
|
4
4
|
|
|
5
5
|
Author: John Franklin Crenshaw, Tianqing Zhang
|
|
6
6
|
"""
|
|
7
|
+
import numpy as np
|
|
7
8
|
from dataclasses import MISSING
|
|
8
9
|
|
|
9
10
|
from ceci.config import StageParameter as Param
|
|
@@ -53,14 +54,6 @@ class PhotoErrorModel(Noisifier):
|
|
|
53
54
|
required=False,
|
|
54
55
|
)
|
|
55
56
|
|
|
56
|
-
def __init__(self, args, comm=None):
|
|
57
|
-
"""
|
|
58
|
-
Constructor
|
|
59
|
-
|
|
60
|
-
Does standard Degrader initialization and sets up the error model.
|
|
61
|
-
"""
|
|
62
|
-
Noisifier.__init__(self, args, comm=comm)
|
|
63
|
-
|
|
64
57
|
def _initNoiseModel(self):
|
|
65
58
|
"""
|
|
66
59
|
Initialize the noise model by the peNoiseModel
|
|
@@ -79,7 +72,11 @@ class PhotoErrorModel(Noisifier):
|
|
|
79
72
|
data = self.get_data("input")
|
|
80
73
|
|
|
81
74
|
# Add photometric errors
|
|
82
|
-
|
|
75
|
+
if self.config.seed is not None: # pragma: no cover
|
|
76
|
+
seed = int(self.config.seed)
|
|
77
|
+
else:
|
|
78
|
+
seed = np.random.Generator(np.random.PCG64())
|
|
79
|
+
obsData = self.noiseModel(data, random_state=seed)
|
|
83
80
|
|
|
84
81
|
# Return the new catalog
|
|
85
82
|
self.add_data("output", obsData)
|
|
@@ -93,9 +90,9 @@ class LSSTErrorModel(PhotoErrorModel):
|
|
|
93
90
|
|
|
94
91
|
name = "LSSTErrorModel"
|
|
95
92
|
|
|
96
|
-
def __init__(self, args,
|
|
93
|
+
def __init__(self, args, **kwargs):
|
|
97
94
|
|
|
98
|
-
|
|
95
|
+
super().__init__(args, **kwargs)
|
|
99
96
|
|
|
100
97
|
self.set_params(peLsstErrorParams)
|
|
101
98
|
self.peNoiseModel = peLsstErrorModel
|
|
@@ -111,9 +108,9 @@ class RomanErrorModel(PhotoErrorModel):
|
|
|
111
108
|
|
|
112
109
|
name = "RomanErrorModel"
|
|
113
110
|
|
|
114
|
-
def __init__(self, args,
|
|
111
|
+
def __init__(self, args, **kwargs):
|
|
115
112
|
|
|
116
|
-
|
|
113
|
+
super().__init__(args, **kwargs)
|
|
117
114
|
|
|
118
115
|
self.set_params(peRomanErrorParams)
|
|
119
116
|
self.peNoiseModel = peRomanErrorModel
|
|
@@ -128,9 +125,9 @@ class EuclidErrorModel(PhotoErrorModel):
|
|
|
128
125
|
|
|
129
126
|
name = "EuclidErrorModel"
|
|
130
127
|
|
|
131
|
-
def __init__(self, args,
|
|
128
|
+
def __init__(self, args, **kwargs):
|
|
132
129
|
|
|
133
|
-
|
|
130
|
+
super().__init__(args, **kwargs)
|
|
134
131
|
|
|
135
132
|
self.set_params(peEuclidErrorParams)
|
|
136
133
|
self.peNoiseModel = peEuclidErrorModel
|
|
@@ -44,10 +44,10 @@ class LineConfusion(Noisifier):
|
|
|
44
44
|
wrong_wavelen=float,
|
|
45
45
|
frac_wrong=float)
|
|
46
46
|
|
|
47
|
-
def __init__(self, args,
|
|
47
|
+
def __init__(self, args, **kwargs):
|
|
48
48
|
"""
|
|
49
49
|
"""
|
|
50
|
-
|
|
50
|
+
super().__init__(args, **kwargs)
|
|
51
51
|
# validate parameters
|
|
52
52
|
if self.config.true_wavelen < 0:
|
|
53
53
|
raise ValueError("true_wavelen must be positive, not {self.config.true_wavelen}")
|
|
@@ -115,10 +115,10 @@ class InvRedshiftIncompleteness(Selector):
|
|
|
115
115
|
config_options = Selector.config_options.copy()
|
|
116
116
|
config_options.update(pivot_redshift=float)
|
|
117
117
|
|
|
118
|
-
def __init__(self, args,
|
|
118
|
+
def __init__(self, args, **kwargs):
|
|
119
119
|
"""
|
|
120
120
|
"""
|
|
121
|
-
|
|
121
|
+
super().__init__(args, **kwargs)
|
|
122
122
|
if self.config.pivot_redshift < 0:
|
|
123
123
|
raise ValueError("pivot redshift must be positive, not {self.config.pivot_redshift}")
|
|
124
124
|
|
|
@@ -36,7 +36,7 @@ class SpecSelection(Selector):
|
|
|
36
36
|
Random seed for reproducibility
|
|
37
37
|
"""
|
|
38
38
|
|
|
39
|
-
name = "
|
|
39
|
+
name = "SpecSelection"
|
|
40
40
|
config_options = Selector.config_options.copy()
|
|
41
41
|
config_options.update(
|
|
42
42
|
N_tot=Param(int, 10000, msg="Number of selected sources"),
|
|
@@ -67,8 +67,8 @@ class SpecSelection(Selector):
|
|
|
67
67
|
random_seed=Param(int, 42, msg="random seed for reproducibility"),
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
-
def __init__(self, args,
|
|
71
|
-
|
|
70
|
+
def __init__(self, args, **kwargs):
|
|
71
|
+
super().__init__(args, **kwargs)
|
|
72
72
|
self._validate_settings()
|
|
73
73
|
self.mask = None
|
|
74
74
|
self.rng = None
|
|
@@ -121,9 +121,9 @@ class SpecSelection(Selector):
|
|
|
121
121
|
if band not in self.config.colnames.keys():
|
|
122
122
|
continue
|
|
123
123
|
colname = self.config.colnames[band]
|
|
124
|
-
self.mask &=
|
|
125
|
-
|
|
126
|
-
)
|
|
124
|
+
self.mask &= data[colname] != nondetect_val
|
|
125
|
+
self.mask &= ~np.isnan(data[colname])
|
|
126
|
+
self.mask &= np.isfinite(data[colname])
|
|
127
127
|
|
|
128
128
|
def downsampling_N_tot(self):
|
|
129
129
|
"""Randomly sample down the objects to a given number of data objects.
|
|
@@ -155,7 +155,7 @@ class SpecSelection(Selector):
|
|
|
155
155
|
# get the bands and bandNames present in the data
|
|
156
156
|
data = self.get_data("input", allow_missing=True)
|
|
157
157
|
self.validate_colnames(data)
|
|
158
|
-
self.mask = np.
|
|
158
|
+
self.mask = np.prod(~np.isnan(data.to_numpy()), axis=1)
|
|
159
159
|
self.invalid_cut(data)
|
|
160
160
|
self.selection(data)
|
|
161
161
|
if self.config.downsample is True:
|
|
@@ -180,7 +180,7 @@ class SpecSelection_GAMA(SpecSelection):
|
|
|
180
180
|
The necessary column is r band.
|
|
181
181
|
"""
|
|
182
182
|
|
|
183
|
-
name = "
|
|
183
|
+
name = "SpecSelection_GAMA"
|
|
184
184
|
|
|
185
185
|
def selection(self, data):
|
|
186
186
|
"""GAMA selection function. """
|
|
@@ -208,7 +208,7 @@ class SpecSelection_BOSS(SpecSelection):
|
|
|
208
208
|
For BOSS selection, the data should at least include gri bands.
|
|
209
209
|
"""
|
|
210
210
|
|
|
211
|
-
name = "
|
|
211
|
+
name = "SpecSelection_BOSS"
|
|
212
212
|
|
|
213
213
|
def selection(self, data):
|
|
214
214
|
"""The BOSS selection function."""
|
|
@@ -268,7 +268,7 @@ class SpecSelection_DEEP2(SpecSelection):
|
|
|
268
268
|
conversion degrader is ready, this subclass will be updated accordingly.
|
|
269
269
|
"""
|
|
270
270
|
|
|
271
|
-
name = "
|
|
271
|
+
name = "SpecSelection_DEEP2"
|
|
272
272
|
|
|
273
273
|
def photometryCut(self, data):
|
|
274
274
|
"""Applies DEEP2 photometric cut based on Newman+13.
|
|
@@ -355,7 +355,7 @@ class SpecSelection_VVDSf02(SpecSelection):
|
|
|
355
355
|
Necessary columns are i band magnitude and redshift.
|
|
356
356
|
"""
|
|
357
357
|
|
|
358
|
-
name = "
|
|
358
|
+
name = "SpecSelection_VVDSf02"
|
|
359
359
|
|
|
360
360
|
def photometryCut(self, data):
|
|
361
361
|
"""Photometric cut of VVDS 2h-field based on LeFèvre+05.
|
|
@@ -466,7 +466,7 @@ class SpecSelection_zCOSMOS(SpecSelection):
|
|
|
466
466
|
For zCOSMOS, the data should at least include i band and redshift.
|
|
467
467
|
"""
|
|
468
468
|
|
|
469
|
-
name = "
|
|
469
|
+
name = "SpecSelection_zCOSMOS"
|
|
470
470
|
|
|
471
471
|
def photometryCut(self, data):
|
|
472
472
|
"""Photometry cut for zCOSMOS based on Lilly+09.
|
|
@@ -527,7 +527,7 @@ class SpecSelection_HSC(SpecSelection):
|
|
|
527
527
|
For HSC, the data should at least include giz bands and redshift.
|
|
528
528
|
"""
|
|
529
529
|
|
|
530
|
-
name = "
|
|
530
|
+
name = "SpecSelection_HSC"
|
|
531
531
|
|
|
532
532
|
def photometryCut(self, data):
|
|
533
533
|
"""HSC galaxies were binned in color magnitude space with i-band mag
|
|
@@ -604,4 +604,4 @@ class SpecSelection_HSC(SpecSelection):
|
|
|
604
604
|
# start message
|
|
605
605
|
printMsg = "Applying the HSC selection."
|
|
606
606
|
|
|
607
|
-
return printMsg
|
|
607
|
+
return printMsg
|
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/src/rail/creation/engines/gcr_engine.py
RENAMED
|
@@ -52,8 +52,8 @@ class GCRCreator(Creator):
|
|
|
52
52
|
),
|
|
53
53
|
)
|
|
54
54
|
|
|
55
|
-
def __init__(self, args,
|
|
56
|
-
|
|
55
|
+
def __init__(self, args, **kwargs):
|
|
56
|
+
super().__init__(args, **kwargs)
|
|
57
57
|
|
|
58
58
|
# Provides override for unit test
|
|
59
59
|
self._catalog_override = None
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
# Prerquisites, os, and numpy
|
|
5
|
+
import os
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
# Various rail modules
|
|
9
|
+
from rail.tools.photometry_tools import Dereddener, Reddener
|
|
10
|
+
|
|
11
|
+
from rail.core.stage import RailStage, RailPipeline
|
|
12
|
+
|
|
13
|
+
import ceci
|
|
14
|
+
|
|
15
|
+
from rail.core.utils import RAILDIR
|
|
16
|
+
|
|
17
|
+
if 'PZ_DUSTMAP_DIR' not in os.environ:
|
|
18
|
+
os.environ['PZ_DUSTMAP_DIR'] = '.'
|
|
19
|
+
|
|
20
|
+
dustmap_dir = os.path.expandvars("${PZ_DUSTMAP_DIR}")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
ERROR_MODELS = dict(
|
|
24
|
+
lsst = dict(
|
|
25
|
+
ErrorModel='LSSTErrorModel',
|
|
26
|
+
Module='rail.creation.degraders.photometric_errors',
|
|
27
|
+
),
|
|
28
|
+
roman = dict(
|
|
29
|
+
ErrorModel='RomanErrorModel',
|
|
30
|
+
Module='rail.creation.degraders.photometric_errors',
|
|
31
|
+
),
|
|
32
|
+
#euclid = dict(
|
|
33
|
+
# ErrorModel='EuclidErrorModel',
|
|
34
|
+
# Module='rail.creation.degraders.photometric_errors',
|
|
35
|
+
#),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ApplyPhotErrorsPipeline(RailPipeline):
|
|
41
|
+
|
|
42
|
+
default_input_dict = dict(input='dummy.in')
|
|
43
|
+
|
|
44
|
+
def __init__(self, error_models=None):
|
|
45
|
+
RailPipeline.__init__(self)
|
|
46
|
+
|
|
47
|
+
DS = RailStage.data_store
|
|
48
|
+
DS.__class__.allow_overwrite = True
|
|
49
|
+
|
|
50
|
+
if error_models is None:
|
|
51
|
+
error_models = ERROR_MODELS
|
|
52
|
+
|
|
53
|
+
self.reddener = Reddener.build(
|
|
54
|
+
dustmap_dir=dustmap_dir,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
previous_stage = self.reddener
|
|
58
|
+
for key, val in error_models.items():
|
|
59
|
+
error_model_class = ceci.PipelineStage.get_stage(val['ErrorModel'], val['Module'])
|
|
60
|
+
the_error_model = error_model_class.make_and_connect(
|
|
61
|
+
name=f'error_model_{key}',
|
|
62
|
+
connections=dict(input=previous_stage.io.output),
|
|
63
|
+
hdf5_groupname='',
|
|
64
|
+
)
|
|
65
|
+
self.add_stage(the_error_model)
|
|
66
|
+
previous_stage = the_error_model
|
|
67
|
+
|
|
68
|
+
self.dereddener_errors = Dereddener.build(
|
|
69
|
+
dustmap_dir=dustmap_dir,
|
|
70
|
+
connections=dict(input=previous_stage.io.output),
|
|
71
|
+
)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
# Prerquisites, os, and numpy
|
|
5
|
+
import os
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
# Various rail modules
|
|
9
|
+
|
|
10
|
+
from rail.core.stage import RailStage, RailPipeline
|
|
11
|
+
|
|
12
|
+
import ceci
|
|
13
|
+
|
|
14
|
+
from rail.utils.catalog_utils import CatalogConfigBase
|
|
15
|
+
from rail.core.utils import RAILDIR
|
|
16
|
+
|
|
17
|
+
SELECTORS = dict(
|
|
18
|
+
GAMA = dict(
|
|
19
|
+
Selector='SpecSelection_GAMA',
|
|
20
|
+
Module='rail.creation.degraders.spectroscopic_selections',
|
|
21
|
+
),
|
|
22
|
+
BOSS = dict(
|
|
23
|
+
Selector='SpecSelection_BOSS',
|
|
24
|
+
Module='rail.creation.degraders.spectroscopic_selections',
|
|
25
|
+
),
|
|
26
|
+
VVDSf02 = dict(
|
|
27
|
+
Selector='SpecSelection_VVDSf02',
|
|
28
|
+
Module='rail.creation.degraders.spectroscopic_selections',
|
|
29
|
+
),
|
|
30
|
+
zCOSMOS = dict(
|
|
31
|
+
Selector='SpecSelection_zCOSMOS',
|
|
32
|
+
Module='rail.creation.degraders.spectroscopic_selections',
|
|
33
|
+
),
|
|
34
|
+
HSC = dict(
|
|
35
|
+
Selector='SpecSelection_HSC',
|
|
36
|
+
Module='rail.creation.degraders.spectroscopic_selections',
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
CommonConfigParams = dict(
|
|
42
|
+
N_tot = 100_000,
|
|
43
|
+
nondetect_val = -np.inf,
|
|
44
|
+
downsample= False,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class SpectroscopicSelectionPipeline(RailPipeline):
|
|
49
|
+
|
|
50
|
+
default_input_dict = dict(input='dummy.in')
|
|
51
|
+
|
|
52
|
+
def __init__(self, selectors=None):
|
|
53
|
+
RailPipeline.__init__(self)
|
|
54
|
+
|
|
55
|
+
DS = RailStage.data_store
|
|
56
|
+
DS.__class__.allow_overwrite = True
|
|
57
|
+
|
|
58
|
+
if selectors is None:
|
|
59
|
+
selectors = SELECTORS.copy()
|
|
60
|
+
|
|
61
|
+
config_pars = CommonConfigParams.copy()
|
|
62
|
+
active_catalog = CatalogConfigBase.active_class()
|
|
63
|
+
if active_catalog:
|
|
64
|
+
colnames = active_catalog.band_name_dict()
|
|
65
|
+
colnames['redshift'] = active_catalog.redshift_col
|
|
66
|
+
config_pars['colnames'] = colnames
|
|
67
|
+
|
|
68
|
+
for key, val in selectors.items():
|
|
69
|
+
the_class = ceci.PipelineStage.get_stage(val['Selector'], val['Module'])
|
|
70
|
+
the_selector = the_class.make_and_connect(
|
|
71
|
+
name=f'select_{key}',
|
|
72
|
+
**config_pars,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
self.add_stage(the_selector)
|
|
@@ -95,8 +95,8 @@ class PhotometryManipulator(RailStage, ABC):
|
|
|
95
95
|
inputs = [('input', PqHandle)]
|
|
96
96
|
outputs = [('output', PqHandle)]
|
|
97
97
|
|
|
98
|
-
def __init__(self, args,
|
|
99
|
-
super().__init__(args,
|
|
98
|
+
def __init__(self, args, **kwargs):
|
|
99
|
+
super().__init__(args, **kwargs)
|
|
100
100
|
self._check_config()
|
|
101
101
|
# convenience remapping of parameters
|
|
102
102
|
self.value_columns = self.config.value_columns
|
|
@@ -371,9 +371,6 @@ class LSSTFluxToMagConverter(RailStage):
|
|
|
371
371
|
inputs = [('input', PqHandle)]
|
|
372
372
|
outputs = [('output', Hdf5Handle)]
|
|
373
373
|
|
|
374
|
-
def __init__(self, args, comm=None):
|
|
375
|
-
RailStage.__init__(self, args, comm=comm)
|
|
376
|
-
|
|
377
374
|
def _flux_to_mag(self, flux_vals):
|
|
378
375
|
return -2.5*np.log10(flux_vals) + self.config.mag_offset
|
|
379
376
|
|
|
@@ -452,14 +449,14 @@ class DustMapBase(RailStage):
|
|
|
452
449
|
fetch_func = dust_map_submod.fetch
|
|
453
450
|
fetch_func()
|
|
454
451
|
|
|
455
|
-
|
|
456
|
-
def __init__(self, args, comm=None):
|
|
457
|
-
RailStage.__init__(self, args, comm=comm)
|
|
458
452
|
|
|
459
453
|
def run(self):
|
|
460
454
|
data = self.get_data('input', allow_missing=True)
|
|
461
455
|
out_data = {}
|
|
462
|
-
coords = SkyCoord(
|
|
456
|
+
coords = SkyCoord(
|
|
457
|
+
np.array(data[self.config.ra_name]),
|
|
458
|
+
np.array(data[self.config.dec_name]),
|
|
459
|
+
unit = 'deg',frame='fk5')
|
|
463
460
|
dust_map_dict = dict(sfd=dustmaps_sfd.SFDQuery)
|
|
464
461
|
try:
|
|
465
462
|
dust_map_class = dust_map_dict[self.config.dustmap_name]
|
|
@@ -13,7 +13,7 @@ from rail.creation.degraders.spectroscopic_degraders import InvRedshiftIncomplet
|
|
|
13
13
|
from rail.creation.degraders.spectroscopic_selections import *
|
|
14
14
|
from rail.creation.degraders.observing_condition_degrader import ObsCondition
|
|
15
15
|
from rail.creation.degraders.grid_selection import GridSelection
|
|
16
|
-
from rail.creation.degraders.
|
|
16
|
+
from rail.creation.degraders.photometric_errors import EuclidErrorModel, LSSTErrorModel
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
@pytest.fixture
|
|
@@ -90,6 +90,26 @@ def test_InvRedshiftIncompleteness_returns_correct_shape(data):
|
|
|
90
90
|
assert degraded_data.shape[1] == data.data.shape[1]
|
|
91
91
|
os.remove(degrader.get_output(degrader.get_aliased_tag("output"), final_name=True))
|
|
92
92
|
|
|
93
|
+
|
|
94
|
+
def test_LineConfusion_returns_correct_shape(data):
|
|
95
|
+
"""Make sure returns same number of columns, fewer rows"""
|
|
96
|
+
OII = 3727
|
|
97
|
+
OIII = 5007
|
|
98
|
+
|
|
99
|
+
lc_2p_0II_0III = LineConfusion.make_stage(
|
|
100
|
+
name="lc_2p_0II_0III", true_wavelen=OII, wrong_wavelen=OIII, frac_wrong=0.02
|
|
101
|
+
)
|
|
102
|
+
lc_1p_0III_0II = LineConfusion.make_stage(
|
|
103
|
+
name="lc_1p_0III_0II", true_wavelen=OIII, wrong_wavelen=OII, frac_wrong=0.01
|
|
104
|
+
)
|
|
105
|
+
degraded_data = lc_1p_0III_0II(
|
|
106
|
+
lc_2p_0II_0III(data)
|
|
107
|
+
).data
|
|
108
|
+
assert degraded_data.shape[0] <= data.data.shape[0]
|
|
109
|
+
assert degraded_data.shape[1] == data.data.shape[1]
|
|
110
|
+
os.remove(lc_2p_0II_0III.get_output(lc_2p_0II_0III.get_aliased_tag("output"), final_name=True))
|
|
111
|
+
os.remove(lc_1p_0III_0II.get_output(lc_1p_0III_0II.get_aliased_tag("output"), final_name=True))
|
|
112
|
+
|
|
93
113
|
|
|
94
114
|
@pytest.mark.parametrize(
|
|
95
115
|
"percentile_cut,redshift_cut,errortype",
|
|
@@ -371,3 +391,9 @@ def test_LSSTErrorModel_returns_correct_columns(data):
|
|
|
371
391
|
assert f"{band}_err" in degraded_data.columns
|
|
372
392
|
os.remove(degrader.get_output(degrader.get_aliased_tag("output"), final_name=True))
|
|
373
393
|
|
|
394
|
+
|
|
395
|
+
def test_EucliErrorModel(data):
|
|
396
|
+
# Setup the stage
|
|
397
|
+
degrader = EuclidErrorModel.make_stage()
|
|
398
|
+
|
|
399
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from rail.utils.testing_utils import build_and_read_pipeline
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
@pytest.mark.parametrize(
|
|
7
|
+
"pipeline_class",
|
|
8
|
+
[
|
|
9
|
+
'rail.pipelines.utility.apply_phot_errors.ApplyPhotErrorsPipeline',
|
|
10
|
+
'rail.pipelines.utility.spectroscopic_selection_pipeline.SpectroscopicSelectionPipeline',
|
|
11
|
+
]
|
|
12
|
+
)
|
|
13
|
+
def test_build_and_read_pipeline(pipeline_class):
|
|
14
|
+
build_and_read_pipeline(pipeline_class)
|
|
15
|
+
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"""The LSST Model for photometric errors."""
|
|
2
|
-
from dataclasses import MISSING
|
|
3
|
-
|
|
4
|
-
from ceci.config import StageParameter as Param
|
|
5
|
-
from photerr import LsstErrorModel as PhotErrErrorModel
|
|
6
|
-
from photerr import LsstErrorParams as PhotErrErrorParams
|
|
7
|
-
from rail.creation.degrader import Degrader
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class LSSTErrorModel(Degrader):
|
|
11
|
-
"""The LSST Model for photometric errors.
|
|
12
|
-
|
|
13
|
-
This is a wrapper around the error model from PhotErr. The parameter
|
|
14
|
-
docstring below is dynamically added by the installed version of PhotErr:
|
|
15
|
-
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
# Dynamically add the parameter docstring from PhotErr
|
|
19
|
-
__doc__ += PhotErrErrorParams.__doc__
|
|
20
|
-
|
|
21
|
-
name = "LSSTErrorModel"
|
|
22
|
-
config_options = Degrader.config_options.copy()
|
|
23
|
-
|
|
24
|
-
# Dynamically add all parameters from PhotErr
|
|
25
|
-
_photerr_params = PhotErrErrorParams.__dataclass_fields__
|
|
26
|
-
for key, val in _photerr_params.items():
|
|
27
|
-
# Get the default value
|
|
28
|
-
if val.default is MISSING:
|
|
29
|
-
default = val.default_factory()
|
|
30
|
-
else:
|
|
31
|
-
default = val.default
|
|
32
|
-
|
|
33
|
-
# Add this param to config_options
|
|
34
|
-
config_options[key] = Param(
|
|
35
|
-
None, # Let PhotErr handle type checking
|
|
36
|
-
default,
|
|
37
|
-
msg="See the main docstring for details about this parameter.",
|
|
38
|
-
required=False,
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
def __init__(self, args, comm=None):
|
|
42
|
-
"""
|
|
43
|
-
Constructor
|
|
44
|
-
|
|
45
|
-
Does standard Degrader initialization and sets up the error model.
|
|
46
|
-
"""
|
|
47
|
-
Degrader.__init__(self, args, comm=comm)
|
|
48
|
-
self.error_model = PhotErrErrorModel(
|
|
49
|
-
**{key: self.config[key] for key in self._photerr_params}
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
def run(self):
|
|
53
|
-
"""Return pandas DataFrame with photometric errors."""
|
|
54
|
-
# Load the input catalog
|
|
55
|
-
data = self.get_data("input")
|
|
56
|
-
|
|
57
|
-
# Add photometric errors
|
|
58
|
-
obsData = self.error_model(data, random_state=self.config.seed)
|
|
59
|
-
|
|
60
|
-
# Return the new catalog
|
|
61
|
-
self.add_data("output", obsData)
|
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/ISSUE_TEMPLATE/0-general_issue.md
RENAMED
|
File without changes
|
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.github/ISSUE_TEMPLATE/1-bug_report.md
RENAMED
|
File without changes
|
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/.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.2 → pz_rail_astro_tools-1.0.4}/.github/workflows/publish-to-pypi.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
|
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/tests/astro_tools/gcr_test_data/schema.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pz_rail_astro_tools-1.0.2 → pz_rail_astro_tools-1.0.4}/tests/astro_tools/test_gcr_engine.py
RENAMED
|
File without changes
|