[PIPE2D-1047] Spline error in 1-D sky subtraction Created: 27/May/22  Updated: 02/Jun/22  Resolved: 02/Jun/22

Status: Done
Project: DRP 2-D Pipeline
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Story Priority: Normal
Reporter: rhl Assignee: price
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2022-06-01 at 10.37.11 PM.png    
Reviewers: hassan

 Description   

Christian Kragh Jespersen reports that processing `72034 r1` gives this traceback, ending in Failed to initialise spline for type akima, length 4.

reduceExposure.py /projects/HSC/PFS/Subaru --calib /projects/HSC/PFS/Subaru/CALIB-PFI-20211220/ --rerun ckj/moon3_250522 --id visit=72034 arm=r -c isr.doFlat=False isr.doApplyGains=True photometerLines.doSubtractLines=True photometerLines.continuum.numKnots=100 photometerLines.continuum.maskLineRadius=2 doSubtractContinuum=True fitContinuum.numKnots=100 fitContinuum.maskLineRadius=2 -j 20
"/projects/HSC/PFS/stack/20220525/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/pipe_base/g590c34a36e+5da9528084/python/lsst/pipe/base/cmdLineTask.py", line 436, in __call__
  result = self.runTask(task, dataRef, kwargs)
 File "/projects/HSC/PFS/stack/20220525/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/pipe_base/g590c34a36e+5da9528084/python/lsst/pipe/base/cmdLineTask.py", line 504, in runTask
  return task.runDataRef(dataRef, **kwargs)
 File "/projects/HSC/PFS/stack/20220525/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/drp_stella/merge-20220525/python/pfs/drp/stella/reduceExposure.py", line 305, in runDataRef
  continua = self.fitContinuum.run(spectra)
 File "/projects/HSC/PFS/stack/20220525/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/drp_stella/merge-20220525/python/pfs/drp/stella/fitContinuum.py", line 76, in run
  result = self.fitContinuum(spec, lines)
 File "/projects/HSC/PFS/stack/20220525/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/drp_stella/merge-20220525/python/pfs/drp/stella/fitContinuum.py", line 122, in fitContinuum
  return self._fitContinuumImpl(flux, good & keep)
 File "/projects/HSC/PFS/stack/20220525/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/drp_stella/merge-20220525/python/pfs/drp/stella/fitContinuum.py", line 149, in _fitContinuumImpl
  interp = makeInterpolate(knots[use], binned[use], self.fitType)
lsst.pex.exceptions.wrappers.OutOfRangeError:
 File "src/math/Interpolate.cc", line 202, in lsst::afw::math::InterpolateGsl::InterpolateGsl(const std::vector<double>&, const std::vector<double>&, lsst::afw::math::Interpolate::Style)
  Failed to initialise spline for type akima, length 4 {0}
lsst::pex::exceptions::OutOfRangeError: 'Failed to initialise spline for type akima, length 4'


 Comments   
Comment by price [ 02/Jun/22 ]

Some NANs in the photometry were messing up the spectra due to photometerLines.doSubtractLines=True.

Comment by hassan [ 02/Jun/22 ]

Changes in PR https://github.com/Subaru-PFS/drp_stella/pull/271 look fine. Tested changes by repeating above reduceExposure run. Run completed with no errors.

Comment by hassan [ 02/Jun/22 ]

However, not sure of quality of extracted spectra. See 'spectral image' generated from the showAllSpectraAsImage utility using the `pfsArm` product .As the original spline error as been addressed, I consider this ticket as reviewed, and the above might be better tracked in a separate ticket.

Comment by price [ 02/Jun/22 ]

The extracted spectra look weird because the configuration options include both subtracting the continuum (doSubtractContinuum=True) and subtracting the sky emission lines (photometerLines.doSubtractLines=True).

Comment by price [ 02/Jun/22 ]

Merged to master.

Generated at Sat Feb 10 16:02:01 JST 2024 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.