pz-rail-astro-tools 1.0.1__tar.gz → 1.0.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.

Potentially problematic release.


This version of pz-rail-astro-tools might be problematic. Click here for more details.

Files changed (46) hide show
  1. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.copier-answers.yml +1 -1
  2. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/workflows/testing-and-coverage.yml +4 -2
  3. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/PKG-INFO +4 -2
  4. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/pyproject.toml +3 -1
  5. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/pz_rail_astro_tools.egg-info/PKG-INFO +4 -2
  6. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/pz_rail_astro_tools.egg-info/requires.txt +3 -1
  7. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/astro_tools/_version.py +2 -2
  8. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/creation/degraders/grid_selection.py +2 -2
  9. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/creation/degraders/lsst_error_model.py +2 -2
  10. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/creation/degraders/observing_condition_degrader.py +2 -2
  11. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/creation/degraders/photometric_errors.py +6 -14
  12. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/creation/degraders/spectroscopic_degraders.py +4 -4
  13. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/creation/degraders/spectroscopic_selections.py +3 -3
  14. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/creation/engines/gcr_engine.py +2 -2
  15. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/tools/photometry_tools.py +7 -10
  16. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/tests/astro_tools/test_degraders.py +20 -0
  17. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/ISSUE_TEMPLATE/0-general_issue.md +0 -0
  18. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/ISSUE_TEMPLATE/1-bug_report.md +0 -0
  19. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/ISSUE_TEMPLATE/2-feature_request.md +0 -0
  20. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/pull_request_template.md +0 -0
  21. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/workflows/add-issue-to-project-tracker.yml +0 -0
  22. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/workflows/linting.yml +0 -0
  23. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/workflows/publish-to-pypi.yml +0 -0
  24. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.github/workflows/smoke-test.yml +0 -0
  25. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.gitignore +0 -0
  26. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/.pre-commit-config.yaml +0 -0
  27. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/LICENSE +0 -0
  28. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/README.md +0 -0
  29. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/environment.yml +0 -0
  30. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/setup.cfg +0 -0
  31. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/setup.py +0 -0
  32. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/pz_rail_astro_tools.egg-info/SOURCES.txt +0 -0
  33. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/pz_rail_astro_tools.egg-info/dependency_links.txt +0 -0
  34. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/pz_rail_astro_tools.egg-info/top_level.txt +0 -0
  35. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/astro_tools/__init__.py +0 -0
  36. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/examples_data/creation_data/data/HSC_grid_settings.pkl +0 -0
  37. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/examples_data/creation_data/data/hsc_ratios_and_specz.hdf5 +0 -0
  38. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/examples_data/creation_data/data/survey_conditions/DC2-dr6-galcounts-i20-i25.3-nside-128.fits +0 -0
  39. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/examples_data/creation_data/data/survey_conditions/DC2-mask-neg-nside-128.fits +0 -0
  40. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_airmass_i_and_nightlt1825_HEAL.fits +0 -0
  41. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_fiveSigmaDepth_i_and_nightlt1825_HEAL.fits +0 -0
  42. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/src/rail/examples_data/testdata/rubin_dm_dc2_example2.pq +0 -0
  43. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/tests/astro_tools/gcr_test_data/schema.yaml +0 -0
  44. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/tests/astro_tools/gcr_test_data/test_object_tract_4850.hdf5 +0 -0
  45. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/tests/astro_tools/test_core.py +0 -0
  46. {pz_rail_astro_tools-1.0.1 → pz_rail_astro_tools-1.0.3}/tests/astro_tools/test_gcr_engine.py +0 -0
@@ -1,5 +1,5 @@
1
1
  # Changes here will be overwritten by Copier
2
- _commit: v0.3.2
2
+ _commit: v0.3.3
3
3
  _src_path: gh:LSSTDESC/RAIL-project-template
4
4
  author_email: lsst-desc-rail-admin@slac.stanford.edu
5
5
  author_name: LSST Dark Energy Science Collaboration (DESC)
@@ -15,7 +15,7 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  strategy:
17
17
  matrix:
18
- python-version: ['3.9', '3.10', '3.11']
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@v3
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.1
3
+ Version: 1.0.3
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
@@ -17,7 +17,9 @@ classifiers = [
17
17
  dynamic = ["version"]
18
18
  dependencies = [
19
19
  "deprecated",
20
- "pz-rail-base",
20
+ "pz-rail-base>=1.0.3",
21
+ "numpy",
22
+ "pandas>=2.2.2",
21
23
  "astropy",
22
24
  "healpy",
23
25
  "photerr",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pz-rail-astro-tools
3
- Version: 1.0.1
3
+ Version: 1.0.3
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
@@ -1,5 +1,7 @@
1
1
  deprecated
2
- pz-rail-base
2
+ pz-rail-base>=1.0.3
3
+ numpy
4
+ pandas>=2.2.2
3
5
  astropy
4
6
  healpy
5
7
  photerr
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.0.1'
16
- __version_tuple__ = version_tuple = (1, 0, 1)
15
+ __version__ = version = '1.0.3'
16
+ __version_tuple__ = version_tuple = (1, 0, 3)
@@ -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, comm=None):
60
+ def __init__(self, args, **kwargs):
61
61
 
62
- Selector.__init__(self, args, comm=comm)
62
+ super().__init__(args, **kwargs)
63
63
 
64
64
  if self.config.redshift_cut < 0:
65
65
  raise ValueError("redshift cut must be positive")
@@ -38,13 +38,13 @@ class LSSTErrorModel(Degrader):
38
38
  required=False,
39
39
  )
40
40
 
41
- def __init__(self, args, comm=None):
41
+ def __init__(self, args, **kwargs):
42
42
  """
43
43
  Constructor
44
44
 
45
45
  Does standard Degrader initialization and sets up the error model.
46
46
  """
47
- Degrader.__init__(self, args, comm=comm)
47
+ super().__init__(args, **kwargs)
48
48
  self.error_model = PhotErrErrorModel(
49
49
  **{key: self.config[key] for key in self._photerr_params}
50
50
  )
@@ -116,8 +116,8 @@ class ObsCondition(Noisifier):
116
116
  }
117
117
 
118
118
 
119
- def __init__(self, args, comm=None):
120
- Noisifier.__init__(self, args, comm=comm)
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;
@@ -53,14 +53,6 @@ class PhotoErrorModel(Noisifier):
53
53
  required=False,
54
54
  )
55
55
 
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
56
  def _initNoiseModel(self):
65
57
  """
66
58
  Initialize the noise model by the peNoiseModel
@@ -93,9 +85,9 @@ class LSSTErrorModel(PhotoErrorModel):
93
85
 
94
86
  name = "LSSTErrorModel"
95
87
 
96
- def __init__(self, args, comm=None):
88
+ def __init__(self, args, **kwargs):
97
89
 
98
- PhotoErrorModel.__init__(self, args, comm=comm)
90
+ super().__init__(args, **kwargs)
99
91
 
100
92
  self.set_params(peLsstErrorParams)
101
93
  self.peNoiseModel = peLsstErrorModel
@@ -111,9 +103,9 @@ class RomanErrorModel(PhotoErrorModel):
111
103
 
112
104
  name = "RomanErrorModel"
113
105
 
114
- def __init__(self, args, comm=None):
106
+ def __init__(self, args, **kwargs):
115
107
 
116
- PhotoErrorModel.__init__(self, args, comm=comm)
108
+ super().__init__(args, **kwargs)
117
109
 
118
110
  self.set_params(peRomanErrorParams)
119
111
  self.peNoiseModel = peRomanErrorModel
@@ -128,9 +120,9 @@ class EuclidErrorModel(PhotoErrorModel):
128
120
 
129
121
  name = "EuclidErrorModel"
130
122
 
131
- def __init__(self, args, comm=None):
123
+ def __init__(self, args, **kwargs):
132
124
 
133
- PhotoErrorModel.__init__(self, args, comm=comm)
125
+ super().__init__(args, **kwargs)
134
126
 
135
127
  self.set_params(peEuclidErrorParams)
136
128
  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, comm=None):
47
+ def __init__(self, args, **kwargs):
48
48
  """
49
49
  """
50
- Noisifier.__init__(self, args, comm=comm)
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, comm=None):
118
+ def __init__(self, args, **kwargs):
119
119
  """
120
120
  """
121
- Selector.__init__(self, args, comm=comm)
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
 
@@ -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, comm=None):
71
- Selector.__init__(self, args, comm=comm)
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
@@ -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.product(~np.isnan(data.to_numpy()), axis=1)
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:
@@ -52,8 +52,8 @@ class GCRCreator(Creator):
52
52
  ),
53
53
  )
54
54
 
55
- def __init__(self, args, comm=None):
56
- Creator.__init__(self, args, comm=comm)
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
@@ -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
 
@@ -94,8 +95,8 @@ class PhotometryManipulator(RailStage, ABC):
94
95
  inputs = [('input', PqHandle)]
95
96
  outputs = [('output', PqHandle)]
96
97
 
97
- def __init__(self, args, comm=None):
98
- super().__init__(args, comm)
98
+ def __init__(self, args, **kwargs):
99
+ super().__init__(args, **kwargs)
99
100
  self._check_config()
100
101
  # convenience remapping of parameters
101
102
  self.value_columns = self.config.value_columns
@@ -331,7 +332,7 @@ class HyperbolicMagnitudes(PhotometryManipulator):
331
332
  Input table with photometry (magnitudes or flux columns and their respective
332
333
  uncertainties) as defined by the configuration.
333
334
  parameters : `PqHandle`
334
- Table with smoothing parameters per photometric band, determined by
335
+ Table witdh smoothing parameters per photometric band, determined by
335
336
  `HyperbolicSmoothing`.
336
337
 
337
338
  Returns
@@ -370,9 +371,6 @@ class LSSTFluxToMagConverter(RailStage):
370
371
  inputs = [('input', PqHandle)]
371
372
  outputs = [('output', Hdf5Handle)]
372
373
 
373
- def __init__(self, args, comm=None):
374
- RailStage.__init__(self, args, comm=comm)
375
-
376
374
  def _flux_to_mag(self, flux_vals):
377
375
  return -2.5*np.log10(flux_vals) + self.config.mag_offset
378
376
 
@@ -420,6 +418,8 @@ class DustMapBase(RailStage):
420
418
 
421
419
  config_options = RailStage.config_options.copy()
422
420
  config_options.update(bands='ugrizy')
421
+ config_options.update(ra_name='ra')
422
+ config_options.update(dec_name='dec')
423
423
  config_options.update(mag_name="mag_{band}_lsst")
424
424
  config_options.update(band_a_env=[4.81,3.64,2.70,2.06,1.58,1.31])
425
425
  config_options.update(dustmap_name='sfd')
@@ -449,14 +449,11 @@ class DustMapBase(RailStage):
449
449
  fetch_func = dust_map_submod.fetch
450
450
  fetch_func()
451
451
 
452
-
453
- def __init__(self, args, comm=None):
454
- RailStage.__init__(self, args, comm=comm)
455
452
 
456
453
  def run(self):
457
454
  data = self.get_data('input', allow_missing=True)
458
455
  out_data = {}
459
- coords = SkyCoord(data['ra'], data['dec'], unit = 'deg',frame='fk5')
456
+ coords = SkyCoord(data[self.config.ra_name], data[self.config.dec_name], unit = 'deg',frame='fk5')
460
457
  dust_map_dict = dict(sfd=dustmaps_sfd.SFDQuery)
461
458
  try:
462
459
  dust_map_class = dust_map_dict[self.config.dustmap_name]
@@ -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",