From 00730e54736e5f16728e70a871407a250505b6a3 Mon Sep 17 00:00:00 2001 From: hangqianjun Date: Wed, 22 Nov 2023 07:01:12 -0800 Subject: [PATCH 1/2] test upstream --- src/rail/tools/util_photometry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rail/tools/util_photometry.py b/src/rail/tools/util_photometry.py index a71b49b..16e8429 100644 --- a/src/rail/tools/util_photometry.py +++ b/src/rail/tools/util_photometry.py @@ -414,7 +414,9 @@ def __call__(self, data): class Dereddener(RailStage): """Utility stage that does dereddening - + + Note: set copy_cols="all" to copy all + columns in data """ name = 'Dereddener' From 308a31f25cec83a265b5be77f5d19d4b2f960e09 Mon Sep 17 00:00:00 2001 From: hangqianjun Date: Wed, 22 Nov 2023 07:12:00 -0800 Subject: [PATCH 2/2] added the ALL option in dereddener --- src/rail/tools/util_photometry.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/rail/tools/util_photometry.py b/src/rail/tools/util_photometry.py index 16e8429..6f9cd2f 100644 --- a/src/rail/tools/util_photometry.py +++ b/src/rail/tools/util_photometry.py @@ -415,7 +415,7 @@ def __call__(self, data): class Dereddener(RailStage): """Utility stage that does dereddening - Note: set copy_cols="all" to copy all + Note: set copy_cols="ALL" to copy all columns in data """ name = 'Dereddener' @@ -464,12 +464,23 @@ def run(self): except KeyError as msg: # pragma: no cover raise KeyError(f"Unknown dustmap {self.config.dustmap_name}, options are {list(dust_map_dict.keys())}") from msg ebvvec = dust_map(coords) + band_mag_name_list=[] for i, band_ in enumerate(self.config.bands): band_mag_name = self.config.mag_name.format(band=band_) mag_vals = data[band_mag_name] out_data[band_mag_name] = mag_vals - ebvvec*self.config.band_a_env[i] - for col_ in self.config.copy_cols: # pragma: no cover - out_data[col_] = data[col_] + band_mag_name_list.append(band_mag_name) + + # check if copy_cols is a list, or is set to ALL: + if isinstance(self.config.copy_cols, list): # pragma: no cover + for col_ in self.config.copy_cols: # pragma: no cover + out_data[col_] = data[col_] + elif self.config.copy_cols=="ALL": # pragma: no cover + for col_ in data: + # make sure we do not overwrite the photometry columns + if col_ not in band_mag_name_list: + out_data[col_] = data[col_] + self.add_data('output', out_data) def __call__(self, data):