Skip to content

Commit

Permalink
bugfix for wavecal
Browse files Browse the repository at this point in the history
  • Loading branch information
AWehrhahn committed Mar 23, 2022
1 parent f038dc3 commit 5d7b00d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pyreduce/wavelength_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,19 @@ def build_2d_solution(self, lines, plot=False):
m_ord = lines["order"][mask]

if self.dimensionality == "1D":
nord = int(m_ord.max() + 1)
nord = self.nord
coef = np.zeros((nord, self.degree + 1))
for i in range(nord):
select = m_ord == i
if np.count_nonzero(select) < 2:
# Not enough lines for wavelength solution
logger.warning(
"Not enough valid lines found wavelength calibration in order % i",
i,
)
coef[i] = np.nan
continue

deg = max(min(self.degree, np.count_nonzero(select) - 2), 0)
coef[i, -(deg + 1) :] = np.polyfit(
m_pix[select], m_wave[select], deg=deg
Expand Down

0 comments on commit 5d7b00d

Please sign in to comment.