[PIPE2D-1289] Refactor fitting of detectorMaps to specify what should be fit Created: 29/Aug/23  Updated: 30/Sep/23  Resolved: 30/Sep/23

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

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

Sprint: Eng13Oct

 Description   

We need to be able to simply specify what elements of a detectorMap are to be fit.



 Comments   
Comment by price [ 21/Sep/23 ]

detectorMap fitting occurs in two contexts: fitDetectorMap (called by reduceArc) and adjustDetectorMap (called by reduceExposure, etc).
fitDetectorMap fits separately a distortion field (PolynomialDistortion or DoubleDistortion, depending on whether the detector is monolithic or not) and a set of slit offsets in x and y. The distortion field is fit by solving a linear least-squares matrix problem, and the current user control consists solely of selecting the polynomial order (which is identical in x and y). The slit offsets are fit by iteratively measuring the mean residual after removing the distortion field, and the current user control consists solely of selecting whether the slit offsets will be fit or not.
adjustDetectorMap fits a distortion field (RotScaleDistortion or DoubleRotScaleDistortion, depending on whether the detector is monolithic or not). The distortion field is fit by solving a linear least-squares matrix problem, and there is no user control beyond turning this task on or off.

In order to satisfy the requirements introduced by this ticket, I propose to:

  • add an array of booleans to the linear least-squares fitting (PolynomialDistortion, DoubleDistortion, RotScaleDistortion, DoubleRotScaleDistortion) that specifies if a parameter should not be fit (and therefore default to zero).
  • add a configuration parameter that allows the user to directly set these booleans.
  • add configuration parameters that allow the user to specify which fibers should have x or y slit offsets measured.
Comment by price [ 22/Sep/23 ]

We agreed at our weekly meeting that we would be able to provide values in addition to turning parameters on/off (i.e., don't default the value to zero if not being fit).

rhl asked for a more detailed description of the detectorMap fitting process:

The MultipleDistortionsDetectorMap consists of the following layers:

  • The "base" model is a SplinedDetectorMap, which comes from the optical model.
  • Slit offsets are applied (a spatial and spectral offset per fiber) to the optical model.
  • A series of distortion fields are applied on top of these, which may be of different kinds. We currently have defined:
    + PolynomialDistortion: a 2D normalised polynomial (ordinary polynomial normalised to the range -1,+1)
    + DoubleDistortion: one PolynomialDistortion for each CCD
    + RotScaleDistortion: translation, rotation and scale (common between x and y)
    + DoubleRotScaleDistortion: one RotScaleDistortion for each CCD

When running reduceArc (which calls fitDetectorMap), we have the measured distortions from the lines and traces relative to the base model. We iteratively:

  • Set all the slit offsets to the mean of the measured offsets
  • Fit a distortion field:
    + PolynomialDistortion for arm=n (monolithic detector)
    + DoubleDistortion for arm=b and arm=r (two CCDs)
  • Iteratively measure the slit offsets per fiber from the residuals

When running reduceExposure (which calls adjustDetectorMap), we have the measured distortions from the lines and traces relative to the best detectorMap. We iteratively fit a distortion field (RotScaleDistortion for arm=n monolithic detector; DoubleDistortion for arm=b and arm=r two CCDs).

Comment by price [ 30/Sep/23 ]

Also added MosaicPolynomialDistortion, which I think is more the sort of distortion model RHL was thinking (single distortion field, but with additional affine transform for the one of the CCDs) and fixed a few fitting things.

Merged to master.

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