From 38bc260cb8b03ca5b7ac6aa8ab2d8fc066321c3f Mon Sep 17 00:00:00 2001 From: Peter Yoachim Date: Wed, 18 Oct 2023 11:31:16 -0700 Subject: [PATCH 1/2] force wavelenth arrays to be idenical for twilight solar spectra --- rubin_sim/skybrightness/interp_components.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rubin_sim/skybrightness/interp_components.py b/rubin_sim/skybrightness/interp_components.py index 918cc76aa..27f9add6b 100644 --- a/rubin_sim/skybrightness/interp_components.py +++ b/rubin_sim/skybrightness/interp_components.py @@ -381,8 +381,11 @@ def __init__(self, mags=False, dark_sky_mags=None, fit_results=None): bp_temp.resample_bandpass( wavelen_min=self.solar_spec.wavelen.min(), wavelen_max=self.solar_spec.wavelen.max(), - wavelen_step=0.2, + wavelen_step=self.solar_spec.wavelen[1] - self.solar_spec.wavelen[0], ) + # Force wavelengths to be identical so + # it doesn't try to resample again later + bp_temp.wavelen = self.solar_spec.wavelen canon_filters[filter_name] = bp_temp # Tack on the LSST filters From f3ac82af518af4ba9fba255063b80fd728094182 Mon Sep 17 00:00:00 2001 From: Peter Yoachim Date: Thu, 19 Oct 2023 10:18:50 -0700 Subject: [PATCH 2/2] ruff --- rubin_sim/skybrightness/interp_components.py | 93 +++++++++++++------- 1 file changed, 59 insertions(+), 34 deletions(-) diff --git a/rubin_sim/skybrightness/interp_components.py b/rubin_sim/skybrightness/interp_components.py index 27f9add6b..1715b3fe3 100644 --- a/rubin_sim/skybrightness/interp_components.py +++ b/rubin_sim/skybrightness/interp_components.py @@ -78,17 +78,21 @@ def load_spec_files(filenames, mags=False): The ESO npz files contain the following arrays: * filter_wave: The central wavelengths of the pre-computed magnitudes * wave: wavelengths for the spectra - * spec: array of spectra and magnitudes along with the relevant variable inputs. For example, - airglow has dtype = [('airmass', '= 1.0) )[0] - # Compute the expected flux in each of the filters that we have fits for + # Compute the expected flux in each of the filters that + # we have fits for fluxes = [] for filter_name in self.filter_names: out_of_range = np.where(interp_points["sunAlt"] > np.max(limits))[0] @@ -682,8 +706,9 @@ def _weighting(self, interp_points, values): class ZodiacalInterp(BaseSingleInterp): """ - Interpolate the zodiacal light based on the airmass and the healpix ID where - the healpixels are in ecliptic coordinates, with the sun at ecliptic longitude zero + Interpolate the zodiacal light based on the airmass + and the healpix ID where the healpixels are in ecliptic + coordinates, with the sun at ecliptic longitude zero """ def __init__(self, comp_name="Zodiacal", sorted_order=["airmass", "hpid"], mags=False):