Skip to content

Commit

Permalink
Merge pull request #207 from desihub/more-fixes
Browse files Browse the repository at this point in the history
a few more (rare!) bug fixes tickled by Loa/Y3 processing
  • Loading branch information
moustakas authored Jan 8, 2025
2 parents 4b3441d + 4724152 commit 56c612f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ Change Log

*

3.1.2 (2025-01-07)
3.1.2 (2025-01-08)
------------------

* A handful more bug fixes [`PR #207`_].
* Miscellaneous bug fixes revealed in Loa/Y3 processing [`PR #206`_].

.. _`PR #206`: https://github.com/desihub/fastspecfit/pull/206
.. _`PR #207`: https://github.com/desihub/fastspecfit/pull/207

3.1.1 (2025-01-05)
------------------
Expand Down
2 changes: 2 additions & 0 deletions py/fastspecfit/emlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ def optimize(self, linemodel,
# happen at high redshift and with the red camera masked, e.g.,
# iron/main/dark/6642/39633239580608311).
linemodel.meta['nfev'] = 0
linemodel.meta['obsamps'] = np.zeros(len(self.line_table))
linemodel['value'] = 0.
return linemodel
else:
obj = EMLine_Objective(obs_bin_centers,
Expand Down
10 changes: 9 additions & 1 deletion py/fastspecfit/linemasker.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ def _get_contpix(zlinewaves, sigmas, nsigma_factor=1., linemask=None,
pix.update({'patch_contpix': {}, 'dropped': [], 'merged': [], 'merged_from': []})
patchids = list(patchMap.keys())
npatch = len(patchids)
patchmaplines = np.hstack([patchMap[key][0] for key in patchMap.keys()])
patchmaplines = []
for key in patchMap.keys():
patchmaplines.append(patchMap[key][0])
if len(patchmaplines) > 0:
patchmaplines = np.hstack(patchmaplines)

FACTOR_DEFAULT = 2.
FACTORS = [2., 3., 4.]
Expand Down Expand Up @@ -140,6 +144,9 @@ def _get_contpix(zlinewaves, sigmas, nsigma_factor=1., linemask=None,
# line.
J = _get_contpix(zlinewave, sigma, nsigma_factor=FACTOR_DEFAULT,
linemask=None, zlyawave=zlyawave)
if len(J) == 0:
J = _get_contpix(zlinewave, sigma, nsigma_factor=FACTOR_DEFAULT,
linemask=None, zlyawave=zlyawave, use_ivar=False)
J2 = np.delete(J, np.isin(J, pix['linepix'][linename]))
# extreme check for, e.g., Lya on load/sv1/bright/6682/39632989667198594
if len(J2) > 0:
Expand All @@ -150,6 +157,7 @@ def _get_contpix(zlinewaves, sigmas, nsigma_factor=1., linemask=None,
else:
errmsg = f'Unable to measure the continuum pixels for line {linename}'
log.critical(errmsg)
import pdb ; pdb.set_trace()
raise ValueError(errmsg)

else:
Expand Down

0 comments on commit 56c612f

Please sign in to comment.