pz-rail-astro-tools 1.0.7__py3-none-any.whl → 1.1.0__py3-none-any.whl
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.7.dist-info → pz_rail_astro_tools-1.1.0.dist-info}/METADATA +2 -2
- {pz_rail_astro_tools-1.0.7.dist-info → pz_rail_astro_tools-1.1.0.dist-info}/RECORD +10 -10
- {pz_rail_astro_tools-1.0.7.dist-info → pz_rail_astro_tools-1.1.0.dist-info}/WHEEL +1 -1
- rail/astro_tools/_version.py +2 -2
- rail/creation/degraders/photometric_errors.py +9 -3
- rail/creation/degraders/unrec_bl_model.py +10 -4
- rail/pipelines/degradation/apply_phot_errors.py +2 -0
- rail/pipelines/degradation/truth_to_observed.py +7 -1
- {pz_rail_astro_tools-1.0.7.dist-info → pz_rail_astro_tools-1.1.0.dist-info}/LICENSE +0 -0
- {pz_rail_astro_tools-1.0.7.dist-info → pz_rail_astro_tools-1.1.0.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
rail/astro_tools/__init__.py,sha256=4J-E0Ug0RP3Y38g8kJ6auAPDPEI4Osf19tuSOAACfxk,432
|
|
2
|
-
rail/astro_tools/_version.py,sha256=
|
|
2
|
+
rail/astro_tools/_version.py,sha256=CqDGE4B1ZqZ-56mxeOFcXRTmlxrdOh4ayrjbcPjziE4,411
|
|
3
3
|
rail/creation/degraders/grid_selection.py,sha256=gJKM0AYdG-HgvjTS3ovupbyoB5bxKhZn9FAAb94pQXY,12429
|
|
4
4
|
rail/creation/degraders/observing_condition_degrader.py,sha256=y6Nal_kSdAz6N8amY4oV6mQ3upa2nIgVbV9P6F0PKwA,19977
|
|
5
|
-
rail/creation/degraders/photometric_errors.py,sha256=
|
|
5
|
+
rail/creation/degraders/photometric_errors.py,sha256=jx7JL5-lzKm6IbNTYwHqkEeGZduXC59Tad2UNwEJWlc,4703
|
|
6
6
|
rail/creation/degraders/spectroscopic_degraders.py,sha256=27kylHksXf4MhgdfefSL7C2S3WCK-0YQ1Oc8dOHIBhc,5350
|
|
7
7
|
rail/creation/degraders/spectroscopic_selections.py,sha256=TXlghBWLAniokbUpgw4IQVf3y3R6BwralS0ddiVgMp4,22205
|
|
8
|
-
rail/creation/degraders/unrec_bl_model.py,sha256=
|
|
8
|
+
rail/creation/degraders/unrec_bl_model.py,sha256=E89DVV67FcHozCjtUz4ty3Ak3q8H9lnNnh5wNWi_R8M,7476
|
|
9
9
|
rail/creation/engines/gcr_engine.py,sha256=LSp599uQGu8GcFNUmib792ScQwSB_Og8VxPLTt9aSNU,2981
|
|
10
10
|
rail/examples_data/creation_data/data/HSC_grid_settings.pkl,sha256=zpJoSR9TSnDyL64DPXivIMam3fn6GOZoyoJoeBj2LAk,141
|
|
11
11
|
rail/examples_data/creation_data/data/hsc_ratios_and_specz.hdf5,sha256=liH54wuuuHxToqjoAwQ_fFmEefk3haNweVThMwdDKN4,13823712
|
|
@@ -14,13 +14,13 @@ rail/examples_data/creation_data/data/survey_conditions/DC2-mask-neg-nside-128.f
|
|
|
14
14
|
rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_airmass_i_and_nightlt1825_HEAL.fits,sha256=twvyce70G3h1MQnGGFQJG9wZc8UbuNqXc6mjtiuaL1s,1581120
|
|
15
15
|
rail/examples_data/creation_data/data/survey_conditions/minion_1016_dc2_Median_fiveSigmaDepth_i_and_nightlt1825_HEAL.fits,sha256=RbMMFSVJQxGhZnL4BnISE9VTNljfTZwV6Bax6NxverY,1581120
|
|
16
16
|
rail/examples_data/testdata/rubin_dm_dc2_example2.pq,sha256=_Iihbbcz1A332QAkaMiFacT4QAbBQBMTOwpfrS7AclE,25884
|
|
17
|
-
rail/pipelines/degradation/apply_phot_errors.py,sha256=
|
|
17
|
+
rail/pipelines/degradation/apply_phot_errors.py,sha256=E6H1Qza1IkO9VWqqxeny6MYkw3gURWscwKxzgUHEOko,2087
|
|
18
18
|
rail/pipelines/degradation/blending.py,sha256=oxZHy1Tai70wT4g4xnBr24z2LxmR1p_J6lMoTN0nFc8,564
|
|
19
19
|
rail/pipelines/degradation/spectroscopic_selection_pipeline.py,sha256=D0sDi6nrasv5CvQkLXgmMp0QbDrhGFRXzt6sWjlbD68,2028
|
|
20
|
-
rail/pipelines/degradation/truth_to_observed.py,sha256=
|
|
20
|
+
rail/pipelines/degradation/truth_to_observed.py,sha256=nfzMKdZd69_P1HnHy56UcjMUpFdRHf6g55oNhlW5Gzg,2995
|
|
21
21
|
rail/tools/photometry_tools.py,sha256=wfKAeMz5T_CYDPC661MHtU1aJXVqomvahZl87KuE7uY,19541
|
|
22
|
-
pz_rail_astro_tools-1.0.
|
|
23
|
-
pz_rail_astro_tools-1.0.
|
|
24
|
-
pz_rail_astro_tools-1.0.
|
|
25
|
-
pz_rail_astro_tools-1.0.
|
|
26
|
-
pz_rail_astro_tools-1.0.
|
|
22
|
+
pz_rail_astro_tools-1.1.0.dist-info/LICENSE,sha256=tLMEN21HbzvT-7umOVVvPjaJZbQxCa-2bAeYLwG5Q04,1102
|
|
23
|
+
pz_rail_astro_tools-1.1.0.dist-info/METADATA,sha256=dt1QkfApkKIjqXp25OoXehGfM7W1_bVhpok1bugejaY,4033
|
|
24
|
+
pz_rail_astro_tools-1.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
25
|
+
pz_rail_astro_tools-1.1.0.dist-info/top_level.txt,sha256=6R6sqn-85I8YZTzmB9gv7sqckB2QaOTHbu-QLGTWBRE,5
|
|
26
|
+
pz_rail_astro_tools-1.1.0.dist-info/RECORD,,
|
rail/astro_tools/_version.py
CHANGED
|
@@ -47,21 +47,27 @@ class PhotoErrorModel(Noisifier):
|
|
|
47
47
|
default = val.default
|
|
48
48
|
|
|
49
49
|
# Add this param to config_options
|
|
50
|
-
|
|
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
|
-
|
|
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] =
|
|
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
|
|
File without changes
|
|
File without changes
|