pz-rail-astro-tools 1.0.7__tar.gz → 1.0.8__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 (51) hide show
  1. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/PKG-INFO +2 -2
  2. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/pz_rail_astro_tools.egg-info/PKG-INFO +2 -2
  3. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/astro_tools/_version.py +2 -2
  4. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/creation/degraders/photometric_errors.py +9 -3
  5. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/creation/degraders/unrec_bl_model.py +10 -4
  6. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/pipelines/degradation/apply_phot_errors.py +2 -0
  7. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/pipelines/degradation/truth_to_observed.py +7 -1
  8. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/tests/astro_tools/test_degraders.py +1 -0
  9. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.copier-answers.yml +0 -0
  10. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/ISSUE_TEMPLATE/0-general_issue.md +0 -0
  11. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/ISSUE_TEMPLATE/1-bug_report.md +0 -0
  12. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/ISSUE_TEMPLATE/2-feature_request.md +0 -0
  13. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/pull_request_template.md +0 -0
  14. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/workflows/add-issue-to-project-tracker.yml +0 -0
  15. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/workflows/linting.yml +0 -0
  16. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/workflows/publish-to-pypi.yml +0 -0
  17. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/workflows/smoke-test.yml +0 -0
  18. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.github/workflows/testing-and-coverage.yml +0 -0
  19. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.gitignore +0 -0
  20. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/.pre-commit-config.yaml +0 -0
  21. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/LICENSE +0 -0
  22. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/README.md +0 -0
  23. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/environment.yml +0 -0
  24. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/pyproject.toml +0 -0
  25. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/setup.cfg +0 -0
  26. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/setup.py +0 -0
  27. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/pz_rail_astro_tools.egg-info/SOURCES.txt +0 -0
  28. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/pz_rail_astro_tools.egg-info/dependency_links.txt +0 -0
  29. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/pz_rail_astro_tools.egg-info/requires.txt +0 -0
  30. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/pz_rail_astro_tools.egg-info/top_level.txt +0 -0
  31. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/astro_tools/__init__.py +0 -0
  32. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/creation/degraders/grid_selection.py +0 -0
  33. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/creation/degraders/observing_condition_degrader.py +0 -0
  34. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/creation/degraders/spectroscopic_degraders.py +0 -0
  35. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/creation/degraders/spectroscopic_selections.py +0 -0
  36. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/creation/engines/gcr_engine.py +0 -0
  37. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/examples_data/creation_data/data/HSC_grid_settings.pkl +0 -0
  38. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/examples_data/creation_data/data/hsc_ratios_and_specz.hdf5 +0 -0
  39. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/examples_data/creation_data/data/survey_conditions/DC2-dr6-galcounts-i20-i25.3-nside-128.fits +0 -0
  40. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/examples_data/creation_data/data/survey_conditions/DC2-mask-neg-nside-128.fits +0 -0
  41. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_airmass_i_and_nightlt1825_HEAL.fits +0 -0
  42. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_fiveSigmaDepth_i_and_nightlt1825_HEAL.fits +0 -0
  43. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/examples_data/testdata/rubin_dm_dc2_example2.pq +0 -0
  44. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/pipelines/degradation/blending.py +0 -0
  45. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/pipelines/degradation/spectroscopic_selection_pipeline.py +0 -0
  46. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/src/rail/tools/photometry_tools.py +0 -0
  47. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/tests/astro_tools/gcr_test_data/schema.yaml +0 -0
  48. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/tests/astro_tools/gcr_test_data/test_object_tract_4850.hdf5 +0 -0
  49. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/tests/astro_tools/test_core.py +0 -0
  50. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/tests/astro_tools/test_gcr_engine.py +0 -0
  51. {pz_rail_astro_tools-1.0.7 → pz_rail_astro_tools-1.0.8}/tests/astro_tools/test_pipline.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pz-rail-astro-tools
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Author-email: "LSST Dark Energy Science Collaboration (DESC)" <lsst-desc-rail-admin@slac.stanford.edu>
5
5
  License: MIT License
6
6
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: pz-rail-astro-tools
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Author-email: "LSST Dark Energy Science Collaboration (DESC)" <lsst-desc-rail-admin@slac.stanford.edu>
5
5
  License: MIT License
6
6
 
@@ -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.7'
16
- __version_tuple__ = version_tuple = (1, 0, 7)
15
+ __version__ = version = '1.0.8'
16
+ __version_tuple__ = version_tuple = (1, 0, 8)
@@ -47,21 +47,27 @@ class PhotoErrorModel(Noisifier):
47
47
  default = val.default
48
48
 
49
49
  # Add this param to config_options
50
- self.config[key] = Param(
50
+ # Use setattr() becuase ceci.StageConfig has
51
+ # implemented __setitem__ to just set the value
52
+ # rather than add the parameters
53
+ param = Param(
51
54
  None, # Let PhotErr handle type checking
52
55
  default,
53
56
  msg="See the main docstring for details about this parameter.",
54
57
  required=False,
55
58
  )
59
+ setattr(self.config, key, param)
56
60
 
57
61
  def reload_pars(self, args):
58
62
  """ This is needed b/c the parameters are dynamically defined,
59
63
  so we have to reload them _after_ then have been defined """
60
- copy_args = args.copy()
61
64
  if isinstance(args, dict):
65
+ # coming from python, add 'config' to the configuration
66
+ copy_args = args.copy()
62
67
  copy_args['config'] = args
63
68
  else: # pragma: no cover
64
- copy_args['config'] = vars(args)
69
+ # coming from cli, just convert to a dict
70
+ copy_args = vars(args).copy()
65
71
  self.load_configs(copy_args)
66
72
  self._io_checked = False
67
73
  self.check_io()
@@ -8,6 +8,8 @@ import numpy as np, pandas as pd
8
8
  import FoFCatalogMatching
9
9
 
10
10
 
11
+ lsst_zp_dict = {'u':12.65, 'g':14.69, 'r':14.56, 'i': 14.38, 'z':13.99, 'y': 13.02}
12
+
11
13
  class UnrecBlModel(Degrader):
12
14
  """Model for Creating Unrecognized Blends.
13
15
 
@@ -22,6 +24,7 @@ class UnrecBlModel(Degrader):
22
24
  dec_label=Param(str, 'dec', msg='dec column name'),
23
25
  linking_lengths=Param(float, 1.0, msg='linking_lengths for FoF matching'),
24
26
  bands=SHARED_PARAMS,
27
+ zp_dict=Param(dict, lsst_zp_dict, msg='magnitude zeropoints dictionary'),
25
28
  ref_band=SHARED_PARAMS,
26
29
  redshift_col=SHARED_PARAMS,
27
30
  match_size=Param(bool, False, msg='consider object size for finding blends'),
@@ -99,17 +102,18 @@ class UnrecBlModel(Degrader):
99
102
  unique_id = np.unique(group_id)
100
103
 
101
104
  ra_label, dec_label = self.config.ra_label, self.config.dec_label
102
- cols = [ra_label, dec_label] + [b for b in self.config.bands] + self.blend_info_cols
105
+ cols = [ra_label, dec_label] + [b for b in self.config.bands] + [self.config.redshift_col] + self.blend_info_cols
103
106
 
104
107
  N_rows = len(unique_id)
105
108
  N_cols = len(cols)
106
109
 
107
110
  # compute the fluxes once for all the galaxies
108
- fluxes = {b:10**(-data[b]/2.5) for b in self.config.bands}
111
+ fluxes = {b:10**(-(data[b] - self.config.zp_dict[b])/2.5) for b in self.config.bands}
109
112
 
110
113
  # pull the column indices
111
114
  idx_ra = cols.index(ra_label)
112
115
  idx_dec = cols.index(dec_label)
116
+ idx_redshift = cols.index(self.config.redshift_col)
113
117
  idx_n_obj = cols.index('n_obj')
114
118
  idx_brightest_flux = cols.index('brightest_flux')
115
119
  idx_total_flux = cols.index('total_flux')
@@ -139,14 +143,16 @@ class UnrecBlModel(Degrader):
139
143
 
140
144
  ## sum up the fluxes into the blended source
141
145
  for b in self.config.bands:
142
- mergeData[i, cols.index(b)] = -2.5*np.log10(np.sum(these_fluxes[b]))
146
+ mergeData[i, cols.index(b)] = -2.5*np.log10(np.sum(these_fluxes[b])) + self.config.zp_dict[b]
143
147
 
144
148
  brighest_idx = np.argmax(ref_fluxes)
149
+ redshifts = these_redshifts.iloc[brighest_idx]
145
150
 
151
+ mergeData[i, idx_redshift] = redshifts
146
152
  mergeData[i, idx_n_obj] = n_obj
147
153
  mergeData[i, idx_brightest_flux] = ref_fluxes.max()
148
154
  mergeData[i, idx_total_flux] = np.sum(ref_fluxes)
149
- mergeData[i, idx_z_brightest] = these_redshifts.iloc[brighest_idx]
155
+ mergeData[i, idx_z_brightest] = redshifts
150
156
  mergeData[i, idx_z_mean] = np.mean(these_redshifts)
151
157
  mergeData[i, idx_z_weighted] = np.sum(these_redshifts*ref_fluxes)/np.sum(ref_fluxes)
152
158
  if n_obj > 1:
@@ -13,6 +13,7 @@ from rail.core.stage import RailStage, RailPipeline
13
13
  import ceci
14
14
 
15
15
  from rail.core.utils import RAILDIR
16
+ from rail.utils import catalog_utils
16
17
 
17
18
  if 'PZ_DUSTMAP_DIR' not in os.environ:
18
19
  os.environ['PZ_DUSTMAP_DIR'] = '.'
@@ -62,6 +63,7 @@ class ApplyPhotErrorsPipeline(RailPipeline):
62
63
  name=f'error_model_{key}',
63
64
  connections=dict(input=previous_stage.io.output),
64
65
  hdf5_groupname='',
66
+ renameDict=catalog_utils.CatalogConfigBase.active_class().band_name_dict(),
65
67
  )
66
68
  self.add_stage(the_error_model)
67
69
  previous_stage = the_error_model
@@ -13,7 +13,7 @@ from rail.core.stage import RailStage, RailPipeline
13
13
  import ceci
14
14
 
15
15
  from rail.core.utils import RAILDIR
16
-
16
+ from rail.utils import catalog_utils
17
17
  from rail.creation.degraders.unrec_bl_model import UnrecBlModel
18
18
 
19
19
  from .spectroscopic_selection_pipeline import SELECTORS, CommonConfigParams
@@ -36,6 +36,9 @@ class TruthToObservedPipeline(RailPipeline):
36
36
  DS = RailStage.data_store
37
37
  DS.__class__.allow_overwrite = True
38
38
 
39
+ active_catalog_config = catalog_utils.CatalogConfigBase.active_class()
40
+ band_name_dict = active_catalog_config.band_name_dict()
41
+
39
42
  if error_models is None:
40
43
  error_models = ERROR_MODELS.copy()
41
44
 
@@ -43,6 +46,8 @@ class TruthToObservedPipeline(RailPipeline):
43
46
  selectors = SELECTORS.copy()
44
47
 
45
48
  config_pars = CommonConfigParams.copy()
49
+ config_pars['colnames'] = band_name_dict.copy()
50
+ config_pars['colnames']['redshift'] = active_catalog_config.redshift_col
46
51
 
47
52
  self.reddener = Reddener.build(
48
53
  dustmap_dir=dustmap_dir,
@@ -60,6 +65,7 @@ class TruthToObservedPipeline(RailPipeline):
60
65
  name=f'error_model_{key}',
61
66
  connections=dict(input=previous_stage.io.output),
62
67
  hdf5_groupname='',
68
+ renameDict=band_name_dict,
63
69
  )
64
70
  self.add_stage(the_error_model)
65
71
  previous_stage = the_error_model
@@ -429,6 +429,7 @@ def test_BLModel(data_for_bl):
429
429
  linking_lengths=1.0,
430
430
  bands='ugrizy',
431
431
  ref_band='i',
432
+ redshift_col='redshift',
432
433
  seed=1234)
433
434
 
434
435
  # Apply the degrader and get the data out