From 3ac80a670dc00a8139247189c54a704ed13ebaf5 Mon Sep 17 00:00:00 2001 From: Jeremy Buhler Date: Mon, 25 Nov 2024 14:09:29 -0600 Subject: [PATCH 1/2] * Allow passing None for resolution matrices in EMLines_Multiline constructor. In this case, make the resolution matrices no-ops (trivial diagonal matrices). * Per John's request, do not use resolution matrices for per-line profiles in final emtable construction --- py/fastspecfit/emline_fit/interface.py | 10 ++++++++-- py/fastspecfit/emlines.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/py/fastspecfit/emline_fit/interface.py b/py/fastspecfit/emline_fit/interface.py index 9c271fe7..2fd5bf3b 100644 --- a/py/fastspecfit/emline_fit/interface.py +++ b/py/fastspecfit/emline_fit/interface.py @@ -3,6 +3,8 @@ from numba import jit +from fastspecfit.resolution import Resolution + from .params_mapping import ParamsMapping from .sparse_rep import EMLineJacobian @@ -330,6 +332,11 @@ def _suppress_negative_fluxes(endpts, M): for j in range(e-s): M[i,j] = np.maximum(M[i,j], 0.) + if resolution_matrices is None: + # create trivial diagonal resolution matrices + rm = [ Resolution(np.ones((1, e - s))) for (s, e) in camerapix ] + resolution_matrices = tuple(rm) + self.line_models = [] _build_multimodel_core(line_parameters, obs_bin_centers, @@ -344,8 +351,7 @@ def _suppress_negative_fluxes(endpts, M): for endpts, M in self.line_models: _suppress_negative_fluxes(endpts, M) - - + def getLine(self, line): """ Return a model for one emission line. diff --git a/py/fastspecfit/emlines.py b/py/fastspecfit/emlines.py index 355badab..b1f3fd13 100644 --- a/py/fastspecfit/emlines.py +++ b/py/fastspecfit/emlines.py @@ -861,7 +861,7 @@ def get_line_profiles(values): line_wavelengths = self.line_table['restwave'].value return EMLine_MultiLines( parameters, emlinewave, redshift, line_wavelengths, - resolution_matrices, camerapix) + resolution_matrices=None, camerapix=camerapix) # omit per-camera resolution matrix transformations values = linemodel['value'].value obsamps = linemodel.meta['obsamps'] From 569ea11511c5ca6663ab9d30a4ee053770532718 Mon Sep 17 00:00:00 2001 From: Jeremy Buhler Date: Mon, 25 Nov 2024 15:08:55 -0600 Subject: [PATCH 2/2] normalize indent/blank lines as per fastspecfit standard --- py/fastspecfit/emline_fit/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/fastspecfit/emline_fit/interface.py b/py/fastspecfit/emline_fit/interface.py index 2fd5bf3b..dc6f037f 100644 --- a/py/fastspecfit/emline_fit/interface.py +++ b/py/fastspecfit/emline_fit/interface.py @@ -336,7 +336,7 @@ def _suppress_negative_fluxes(endpts, M): # create trivial diagonal resolution matrices rm = [ Resolution(np.ones((1, e - s))) for (s, e) in camerapix ] resolution_matrices = tuple(rm) - + self.line_models = [] _build_multimodel_core(line_parameters, obs_bin_centers, @@ -351,7 +351,7 @@ def _suppress_negative_fluxes(endpts, M): for endpts, M in self.line_models: _suppress_negative_fluxes(endpts, M) - + def getLine(self, line): """ Return a model for one emission line.