pz-rail-astro-tools 1.0.5__py3-none-any.whl → 1.0.7__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pz-rail-astro-tools
3
- Version: 1.0.5
3
+ Version: 1.0.7
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,9 +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 >=1.0.3
37
+ Requires-Dist: pz-rail-base>=1.0.3
38
38
  Requires-Dist: numpy
39
- Requires-Dist: pandas >=2.2.2
39
+ Requires-Dist: pandas>=2.2.2
40
40
  Requires-Dist: astropy
41
41
  Requires-Dist: healpy
42
42
  Requires-Dist: photerr
@@ -45,11 +45,11 @@ Requires-Dist: pz-hyperbolic-temp
45
45
  Requires-Dist: lsstdesc-gcr-catalogs
46
46
  Requires-Dist: FoFCatalogMatching
47
47
  Provides-Extra: dev
48
- Requires-Dist: tables-io[full] ; extra == 'dev'
49
- Requires-Dist: pytest ; extra == 'dev'
50
- Requires-Dist: pytest-cov ; extra == 'dev'
51
- Requires-Dist: pre-commit ; extra == 'dev'
52
- Requires-Dist: pylint ; extra == 'dev'
48
+ Requires-Dist: tables-io[full]; extra == "dev"
49
+ Requires-Dist: pytest; extra == "dev"
50
+ Requires-Dist: pytest-cov; extra == "dev"
51
+ Requires-Dist: pre-commit; extra == "dev"
52
+ Requires-Dist: pylint; extra == "dev"
53
53
 
54
54
  # pz-rail-astro-tools
55
55
 
@@ -1,12 +1,11 @@
1
1
  rail/astro_tools/__init__.py,sha256=4J-E0Ug0RP3Y38g8kJ6auAPDPEI4Osf19tuSOAACfxk,432
2
- rail/astro_tools/_version.py,sha256=ClFIlbf5O23dVWC6oD6t3m2n6nB22IOt3V9t-YX_mG0,411
3
- rail/creation/degraders/bl_demo.ipynb,sha256=GgaIU1hH_6WgnAJxWDzg79j-fO3_bvjOXbwRIzdAgnM,5633
2
+ rail/astro_tools/_version.py,sha256=B_2jTRPLk-a7dhEz8Rto7VRGwxfpXrqO4mYrudjn7bw,411
4
3
  rail/creation/degraders/grid_selection.py,sha256=gJKM0AYdG-HgvjTS3ovupbyoB5bxKhZn9FAAb94pQXY,12429
5
4
  rail/creation/degraders/observing_condition_degrader.py,sha256=y6Nal_kSdAz6N8amY4oV6mQ3upa2nIgVbV9P6F0PKwA,19977
6
5
  rail/creation/degraders/photometric_errors.py,sha256=xeLI5dH4P-kseClMsy7vTes6EBXh2Ca8_-9-nnFt3b0,4396
7
6
  rail/creation/degraders/spectroscopic_degraders.py,sha256=27kylHksXf4MhgdfefSL7C2S3WCK-0YQ1Oc8dOHIBhc,5350
8
7
  rail/creation/degraders/spectroscopic_selections.py,sha256=TXlghBWLAniokbUpgw4IQVf3y3R6BwralS0ddiVgMp4,22205
9
- rail/creation/degraders/unrec_bl_model.py,sha256=mfc3WMfX5QEqZqdeaCRek4I44MYlcXEx-1CkrHSbEIA,3870
8
+ rail/creation/degraders/unrec_bl_model.py,sha256=YEei4uAdVrWYwO2mhW0KHU2-oUwWaz1F6Ft3UfkJjQ4,7065
10
9
  rail/creation/engines/gcr_engine.py,sha256=LSp599uQGu8GcFNUmib792ScQwSB_Og8VxPLTt9aSNU,2981
11
10
  rail/examples_data/creation_data/data/HSC_grid_settings.pkl,sha256=zpJoSR9TSnDyL64DPXivIMam3fn6GOZoyoJoeBj2LAk,141
12
11
  rail/examples_data/creation_data/data/hsc_ratios_and_specz.hdf5,sha256=liH54wuuuHxToqjoAwQ_fFmEefk3haNweVThMwdDKN4,13823712
@@ -18,9 +17,10 @@ rail/examples_data/testdata/rubin_dm_dc2_example2.pq,sha256=_Iihbbcz1A332QAkaMiF
18
17
  rail/pipelines/degradation/apply_phot_errors.py,sha256=vj2avYWxfavORIXzJ7925V9YkuRmRMBSP0C8-DmgkSw,1958
19
18
  rail/pipelines/degradation/blending.py,sha256=oxZHy1Tai70wT4g4xnBr24z2LxmR1p_J6lMoTN0nFc8,564
20
19
  rail/pipelines/degradation/spectroscopic_selection_pipeline.py,sha256=D0sDi6nrasv5CvQkLXgmMp0QbDrhGFRXzt6sWjlbD68,2028
20
+ rail/pipelines/degradation/truth_to_observed.py,sha256=7Mbgxgzn2gn0MCRPyDLk4zQO00liVQNwsfDbmXKrbYM,2635
21
21
  rail/tools/photometry_tools.py,sha256=wfKAeMz5T_CYDPC661MHtU1aJXVqomvahZl87KuE7uY,19541
22
- pz_rail_astro_tools-1.0.5.dist-info/LICENSE,sha256=tLMEN21HbzvT-7umOVVvPjaJZbQxCa-2bAeYLwG5Q04,1102
23
- pz_rail_astro_tools-1.0.5.dist-info/METADATA,sha256=tbPI6gnnaLabQK0FraTJcEelWyTgVHjAEWdNU-c6iCo,4040
24
- pz_rail_astro_tools-1.0.5.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
25
- pz_rail_astro_tools-1.0.5.dist-info/top_level.txt,sha256=6R6sqn-85I8YZTzmB9gv7sqckB2QaOTHbu-QLGTWBRE,5
26
- pz_rail_astro_tools-1.0.5.dist-info/RECORD,,
22
+ pz_rail_astro_tools-1.0.7.dist-info/LICENSE,sha256=tLMEN21HbzvT-7umOVVvPjaJZbQxCa-2bAeYLwG5Q04,1102
23
+ pz_rail_astro_tools-1.0.7.dist-info/METADATA,sha256=-QxK7OAGDIX2aGlvh1lsYFwEy-wMmN96H1MubkZGoqA,4033
24
+ pz_rail_astro_tools-1.0.7.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
25
+ pz_rail_astro_tools-1.0.7.dist-info/top_level.txt,sha256=6R6sqn-85I8YZTzmB9gv7sqckB2QaOTHbu-QLGTWBRE,5
26
+ pz_rail_astro_tools-1.0.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.2.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -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.5'
16
- __version_tuple__ = version_tuple = (1, 0, 5)
15
+ __version__ = version = '1.0.7'
16
+ __version_tuple__ = version_tuple = (1, 0, 7)
@@ -2,6 +2,8 @@
2
2
 
3
3
  from ceci.config import StageParameter as Param
4
4
  from rail.creation.degrader import Degrader
5
+ from rail.core.data import PqHandle
6
+ from rail.core.common_params import SHARED_PARAMS
5
7
  import numpy as np, pandas as pd
6
8
  import FoFCatalogMatching
7
9
 
@@ -19,7 +21,9 @@ class UnrecBlModel(Degrader):
19
21
  config_options.update(ra_label=Param(str, 'ra', msg='ra column name'),
20
22
  dec_label=Param(str, 'dec', msg='dec column name'),
21
23
  linking_lengths=Param(float, 1.0, msg='linking_lengths for FoF matching'),
22
- bands=Param(str, 'ugrizy', msg='name of filters'),
24
+ bands=SHARED_PARAMS,
25
+ ref_band=SHARED_PARAMS,
26
+ redshift_col=SHARED_PARAMS,
23
27
  match_size=Param(bool, False, msg='consider object size for finding blends'),
24
28
  match_shape=Param(bool, False, msg='consider object shape for finding blends'),
25
29
  obj_size=Param(str, 'obj_size', msg='object size column name'),
@@ -27,6 +31,48 @@ class UnrecBlModel(Degrader):
27
31
  b=Param(str, 'semi_minor', msg='semi minor axis column name'),
28
32
  theta=Param(str, 'orientation', msg='orientation angle column name'))
29
33
 
34
+ outputs = [("output", PqHandle), ("compInd", PqHandle)]
35
+
36
+ blend_info_cols = ['group_id', 'n_obj', 'brightest_flux', 'total_flux', 'z_brightest', 'z_weighted', 'z_mean', 'z_stdev']
37
+
38
+ def __call__(self, sample, seed: int = None):
39
+ """The main interface method for ``Degrader``.
40
+
41
+ Applies degradation.
42
+
43
+ This will attach the sample to this `Degrader` (for introspection and
44
+ provenance tracking).
45
+
46
+ Then it will call the run() and finalize() methods, which need to be
47
+ implemented by the sub-classes.
48
+
49
+ The run() method will need to register the data that it creates to this
50
+ Estimator by using ``self.add_data('output', output_data)``.
51
+
52
+ Finally, this will return a PqHandle providing access to that output
53
+ data.
54
+
55
+ Parameters
56
+ ----------
57
+ sample : table-like
58
+ The sample to be degraded
59
+ seed : int, default=None
60
+ An integer to set the numpy random seed
61
+
62
+ Returns
63
+ -------
64
+ output_data : PqHandle
65
+ A handle giving access to a table with degraded sample
66
+ """
67
+ if seed is not None:
68
+ self.config.seed = seed
69
+
70
+ self.set_data("input", sample)
71
+ self.run()
72
+ self.finalize()
73
+
74
+ return {'output':self.get_handle("output"), 'compInd':self.get_handle("compInd")}
75
+
30
76
  def __match_bl__(self, data):
31
77
 
32
78
  """Group sources with friends of friends"""
@@ -43,42 +89,75 @@ class UnrecBlModel(Degrader):
43
89
  ## adding the group id as the last column to data
44
90
  matchData = pd.merge(data, results, left_index=True, right_index=True)
45
91
 
46
- return matchData
92
+ return matchData, results
47
93
 
48
94
  def __merge_bl__(self, data):
49
95
 
50
96
  """Merge sources within a group into unrecognized blends."""
51
-
97
+
52
98
  group_id = data['group_id']
53
99
  unique_id = np.unique(group_id)
54
100
 
55
101
  ra_label, dec_label = self.config.ra_label, self.config.dec_label
56
-
57
- cols = list(data.columns)
58
- ra_ind = cols.index(ra_label)
59
- dec_ind = cols.index(dec_label)
60
- bands_ind = {b:cols.index(b) for b in self.config.bands}
102
+ cols = [ra_label, dec_label] + [b for b in self.config.bands] + self.blend_info_cols
61
103
 
62
104
  N_rows = len(unique_id)
63
105
  N_cols = len(cols)
64
106
 
107
+ # compute the fluxes once for all the galaxies
108
+ fluxes = {b:10**(-data[b]/2.5) for b in self.config.bands}
109
+
110
+ # pull the column indices
111
+ idx_ra = cols.index(ra_label)
112
+ idx_dec = cols.index(dec_label)
113
+ idx_n_obj = cols.index('n_obj')
114
+ idx_brightest_flux = cols.index('brightest_flux')
115
+ idx_total_flux = cols.index('total_flux')
116
+ idx_z_brightest = cols.index('z_brightest')
117
+ idx_z_mean = cols.index('z_mean')
118
+ idx_z_weighted = cols.index('z_weighted')
119
+ idx_z_stdev = cols.index('z_stdev')
120
+
65
121
  mergeData = np.zeros((N_rows, N_cols))
66
-
67
122
  for i, id in enumerate(unique_id):
68
123
 
69
- this_group = data.query(f'group_id=={id}')
124
+ # Get the mask for this grouping
125
+ mask = data['group_id'] == id
126
+
127
+ # Get the data and fluxes for this grouping
128
+ this_group = data[mask]
129
+ these_fluxes = {b:fluxes[b][mask] for b in self.config.bands}
130
+
131
+ # Pull put some useful stuff
132
+ n_obj = len(this_group)
133
+ ref_fluxes = these_fluxes[self.config.ref_band]
134
+ these_redshifts = this_group[self.config.redshift_col]
70
135
 
71
136
  ## take the average position for the blended source
72
- mergeData[i, ra_ind] = this_group[ra_label].mean()
73
- mergeData[i, dec_ind] = this_group[dec_label].mean()
137
+ mergeData[i, idx_ra] = this_group[ra_label].mean()
138
+ mergeData[i, idx_dec] = this_group[dec_label].mean()
74
139
 
75
140
  ## sum up the fluxes into the blended source
76
141
  for b in self.config.bands:
77
- mergeData[i, bands_ind[b]] = -2.5*np.log10(np.sum(10**(-this_group[b]/2.5)))
78
-
79
- mergeData[:,-1] = unique_id
142
+ mergeData[i, cols.index(b)] = -2.5*np.log10(np.sum(these_fluxes[b]))
143
+
144
+ brighest_idx = np.argmax(ref_fluxes)
145
+
146
+ mergeData[i, idx_n_obj] = n_obj
147
+ mergeData[i, idx_brightest_flux] = ref_fluxes.max()
148
+ mergeData[i, idx_total_flux] = np.sum(ref_fluxes)
149
+ mergeData[i, idx_z_brightest] = these_redshifts.iloc[brighest_idx]
150
+ mergeData[i, idx_z_mean] = np.mean(these_redshifts)
151
+ mergeData[i, idx_z_weighted] = np.sum(these_redshifts*ref_fluxes)/np.sum(ref_fluxes)
152
+ if n_obj > 1:
153
+ mergeData[i, idx_z_stdev] = np.std(these_redshifts)
154
+ else:
155
+ mergeData[i, idx_z_stdev] = 0.
156
+
157
+ mergeData[:,cols.index('group_id')] = unique_id
80
158
  mergeData_df = pd.DataFrame(data=mergeData, columns=cols)
81
159
  mergeData_df['group_id'] = mergeData_df['group_id'].astype(int)
160
+ mergeData_df['n_obj'] = mergeData_df['n_obj'].astype(int)
82
161
 
83
162
  return mergeData_df
84
163
 
@@ -89,10 +168,11 @@ class UnrecBlModel(Degrader):
89
168
  data = self.get_data("input")
90
169
 
91
170
  # Match for close-by objects
92
- matchData = self.__match_bl__(data)
171
+ matchData, compInd = self.__match_bl__(data)
93
172
 
94
173
  # Merge matched objects into unrec-bl
95
174
  blData = self.__merge_bl__(matchData)
96
175
 
97
- # Return the new catalog
176
+ # Return the new catalog and component index in original catalog
98
177
  self.add_data("output", blData)
178
+ self.add_data("compInd", compInd)
@@ -0,0 +1,83 @@
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
+ from rail.creation.degraders.unrec_bl_model import UnrecBlModel
18
+
19
+ from .spectroscopic_selection_pipeline import SELECTORS, CommonConfigParams
20
+ from .apply_phot_errors import ERROR_MODELS
21
+
22
+
23
+ if 'PZ_DUSTMAP_DIR' not in os.environ: # pragma: no cover
24
+ os.environ['PZ_DUSTMAP_DIR'] = '.'
25
+
26
+ dustmap_dir = os.path.expandvars("${PZ_DUSTMAP_DIR}")
27
+
28
+
29
+ class TruthToObservedPipeline(RailPipeline):
30
+
31
+ default_input_dict = dict(input='dummy.in')
32
+
33
+ def __init__(self, error_models=None, selectors=None, blending=False):
34
+ RailPipeline.__init__(self)
35
+
36
+ DS = RailStage.data_store
37
+ DS.__class__.allow_overwrite = True
38
+
39
+ if error_models is None:
40
+ error_models = ERROR_MODELS.copy()
41
+
42
+ if selectors is None:
43
+ selectors = SELECTORS.copy()
44
+
45
+ config_pars = CommonConfigParams.copy()
46
+
47
+ self.reddener = Reddener.build(
48
+ dustmap_dir=dustmap_dir,
49
+ copy_all_cols=True,
50
+ )
51
+ previous_stage = self.reddener
52
+
53
+ if blending:
54
+ self.unrec_bl = UnrecBlModel.build()
55
+ previous_stage = self.unrec_bl
56
+
57
+ for key, val in error_models.items():
58
+ error_model_class = ceci.PipelineStage.get_stage(val['ErrorModel'], val['Module'])
59
+ the_error_model = error_model_class.make_and_connect(
60
+ name=f'error_model_{key}',
61
+ connections=dict(input=previous_stage.io.output),
62
+ hdf5_groupname='',
63
+ )
64
+ self.add_stage(the_error_model)
65
+ previous_stage = the_error_model
66
+
67
+ dereddener_errors = Dereddener.make_and_connect(
68
+ name=f"deredden_{key}",
69
+ dustmap_dir=dustmap_dir,
70
+ connections=dict(input=previous_stage.io.output),
71
+ copy_all_cols=True,
72
+ )
73
+ self.add_stage(dereddener_errors)
74
+ previous_stage = dereddener_errors
75
+
76
+ for key2, val2 in selectors.items():
77
+ the_class = ceci.PipelineStage.get_stage(val2['Select'], val2['Module'])
78
+ the_selector = the_class.make_and_connect(
79
+ name=f'select_{key}_{key2}',
80
+ connections=dict(input=previous_stage.io.output),
81
+ **config_pars,
82
+ )
83
+ self.add_stage(the_selector)
@@ -1,206 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "id": "2610a0f0-0c71-4401-896f-734442bcd66d",
6
- "metadata": {},
7
- "source": [
8
- "## Blending Degrader demo\n",
9
- "\n",
10
- "author: Shuang Liang\n",
11
- "\n",
12
- "This notebook demonstrate the use of `rail.creation.degradation.unrec_bl_model`, which uses Friends of Friends to finds sources close to each other and merge them into unrecognized blends"
13
- ]
14
- },
15
- {
16
- "cell_type": "code",
17
- "execution_count": null,
18
- "id": "f7a6adc3-68e8-4a1d-842f-bfb0960a1c4a",
19
- "metadata": {},
20
- "outputs": [],
21
- "source": [
22
- "from rail.creation.degraders.unrec_bl_model import UnrecBlModel\n",
23
- "\n",
24
- "from rail.core.data import PqHandle\n",
25
- "from rail.core.stage import RailStage\n",
26
- "\n",
27
- "import matplotlib.pyplot as plt\n",
28
- "import pandas as pd, numpy as np"
29
- ]
30
- },
31
- {
32
- "cell_type": "code",
33
- "execution_count": null,
34
- "id": "6912a740-31ea-4987-b06d-81ff17cd895a",
35
- "metadata": {},
36
- "outputs": [],
37
- "source": [
38
- "DS = RailStage.data_store\n",
39
- "DS.__class__.allow_overwrite = True\n"
40
- ]
41
- },
42
- {
43
- "cell_type": "markdown",
44
- "id": "a282c2ed-141b-4507-8254-dc8fbc9864dc",
45
- "metadata": {},
46
- "source": [
47
- "### Create a random catalog with ugrizy+YJHF bands as the the true input"
48
- ]
49
- },
50
- {
51
- "cell_type": "code",
52
- "execution_count": null,
53
- "id": "1078bc2a-fc54-41c3-bd30-6c447bb971d4",
54
- "metadata": {},
55
- "outputs": [],
56
- "source": [
57
- "data = np.random.normal(23, 3, size = (1000,12))\n",
58
- "data[:, 0] = np.random.uniform(low=0, high=0.03, size=1000)\n",
59
- "data[:, 1] = np.random.uniform(low=0, high=0.03, size=1000)\n",
60
- "\n",
61
- "data_df = pd.DataFrame(data=data, # values\n",
62
- " columns=['ra', 'dec', 'u', 'g', 'r', 'i', 'z', 'y', 'Y', 'J', 'H', 'F'])\n",
63
- "\n",
64
- "data_truth = DS.add_data('input', data_df, PqHandle)"
65
- ]
66
- },
67
- {
68
- "cell_type": "code",
69
- "execution_count": null,
70
- "id": "33c99a4d-8375-4003-9a9a-70fa85a3eb82",
71
- "metadata": {},
72
- "outputs": [],
73
- "source": [
74
- "#data_df.to_parquet('bl_test.pq')"
75
- ]
76
- },
77
- {
78
- "cell_type": "code",
79
- "execution_count": null,
80
- "id": "a5636721-a734-4746-bd93-8101bc558b6e",
81
- "metadata": {},
82
- "outputs": [],
83
- "source": [
84
- "plt.scatter(data_truth.data['ra'], data_truth.data['dec'], s=5)\n",
85
- "plt.xlabel(\"Ra [Deg]\", fontsize=14)\n",
86
- "plt.ylabel(\"Dec [Deg]\", fontsize=14)\n",
87
- "plt.show()\n"
88
- ]
89
- },
90
- {
91
- "cell_type": "markdown",
92
- "id": "1da27deb-d167-4f38-8c59-f270184d6ab3",
93
- "metadata": {},
94
- "source": [
95
- "### The blending model"
96
- ]
97
- },
98
- {
99
- "cell_type": "code",
100
- "execution_count": null,
101
- "id": "a07f72a0-e24c-4844-90f0-d5a49ac4362b",
102
- "metadata": {},
103
- "outputs": [],
104
- "source": [
105
- "## radius cut is in arcsecs\n",
106
- "blModel = UnrecBlModel.make_stage(name='unrec_bl_model', ra_label='ra', dec_label='dec', linking_lengths=1.0, \\\n",
107
- " bands='ugrizyYJHF')\n",
108
- "blModel.get_config_dict()\n"
109
- ]
110
- },
111
- {
112
- "cell_type": "code",
113
- "execution_count": null,
114
- "id": "e5f4862a-0621-46d4-8901-7e84b461c424",
115
- "metadata": {},
116
- "outputs": [],
117
- "source": [
118
- "samples_w_bl = blModel(data_truth)\n",
119
- "samples_w_bl()\n"
120
- ]
121
- },
122
- {
123
- "cell_type": "code",
124
- "execution_count": null,
125
- "id": "bc5158dd-f474-4731-b847-b4a7358656b9",
126
- "metadata": {},
127
- "outputs": [],
128
- "source": [
129
- "fig, ax = plt.subplots(figsize=(6, 5), dpi=100)\n",
130
- "\n",
131
- "ax.scatter(data_truth.data['ra'], data_truth.data['dec'], s=10, facecolors='none', edgecolors='b', label='Original')\n",
132
- "ax.scatter(samples_w_bl.data['ra'], samples_w_bl.data['dec'], s=5, c='r', label='w. Unrec-BL')\n",
133
- "\n",
134
- "ax.legend(loc=2, fontsize=12)\n",
135
- "ax.set_xlabel(\"Ra [Deg]\", fontsize=14)\n",
136
- "ax.set_ylabel(\"Dec [Deg]\", fontsize=14)\n",
137
- "\n",
138
- "plt.show()\n"
139
- ]
140
- },
141
- {
142
- "cell_type": "code",
143
- "execution_count": null,
144
- "id": "268b3d37-b7fd-4ac1-8457-2104a87c9e6d",
145
- "metadata": {},
146
- "outputs": [],
147
- "source": [
148
- "b = 'r'\n",
149
- "plt.hist(data_truth.data[b], bins=np.linspace(10, 30, 20), label='Original')\n",
150
- "plt.hist(samples_w_bl.data[b], bins=np.linspace(10, 30, 20), fill=False, label='w. Unrec-BL')\n",
151
- "\n",
152
- "plt.xlabel(fr'Magnitude ${b}$', fontsize=14)\n",
153
- "plt.legend(fontsize=12)\n",
154
- "plt.show()\n"
155
- ]
156
- },
157
- {
158
- "cell_type": "code",
159
- "execution_count": null,
160
- "id": "a1d51c15-1e04-4b22-9abb-9b267965dbeb",
161
- "metadata": {},
162
- "outputs": [],
163
- "source": [
164
- "flux = 10**(-(data_truth.data[b]-28.10)/2.5) # r band zp for lsst is 28.10\n",
165
- "flux_bl = 10**(-(samples_w_bl.data[b]-28.10)/2.5)\n",
166
- "\n",
167
- "plt.hist(flux, bins=np.linspace(0, 10000, 40), label='Original')\n",
168
- "plt.hist(flux_bl, bins=np.linspace(0, 10000, 40), fill=False, label='w. Unrec-BL')\n",
169
- "\n",
170
- "plt.xlabel(fr'Flux ${b}$', fontsize=14)\n",
171
- "plt.yscale('log')\n",
172
- "plt.legend(fontsize=12)\n",
173
- "plt.show()\n"
174
- ]
175
- },
176
- {
177
- "cell_type": "code",
178
- "execution_count": null,
179
- "id": "da2b37c8-4667-4ad2-ad09-b1c68d2612b8",
180
- "metadata": {},
181
- "outputs": [],
182
- "source": []
183
- }
184
- ],
185
- "metadata": {
186
- "kernelspec": {
187
- "display_name": "Python 3 (ipykernel)",
188
- "language": "python",
189
- "name": "python3"
190
- },
191
- "language_info": {
192
- "codemirror_mode": {
193
- "name": "ipython",
194
- "version": 3
195
- },
196
- "file_extension": ".py",
197
- "mimetype": "text/x-python",
198
- "name": "python",
199
- "nbconvert_exporter": "python",
200
- "pygments_lexer": "ipython3",
201
- "version": "3.12.3"
202
- }
203
- },
204
- "nbformat": 4,
205
- "nbformat_minor": 5
206
- }