[SIM2D-126] Work around unphysical detectorMap features Created: 02/Sep/20  Updated: 05/Jan/21  Resolved: 25/Sep/20

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

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

Attachments: PNG File wavelength_m_339_fixed.png     PNG File wavelength_m_339.png    
Story Points: 1
Sprint: 2DDRP-2021 A
Reviewers: hassan

 Description   

The detectorMaps coming from the simulator have non-physical features at either end, possibly due to spline artifacts. Here is a plot of the residual after removing a constant dispersion (wavelength change per pixel) as a function of detector row for one of the central fibers of the m arm, showing the problem:

Jim Gunn says, "There is nothing physical which could cause this." We suspect the problem is in the splining of the optical model in the simulator. A workaround is to drop the second, third, third-to-last and second-to-last knots for the wavelength solution from the detectorMap, e.g.:

import numpy as np
from pfs.drp.stella import SplinedDetectorMap
detMap = SplinedDetectorMap.readFits("/home/pfs/pfs/drp_pfs_data/detectorMap/detectorMap-sim-m1.fits")
def selectArray(array):
    result = np.empty(len(array) - 4, dtype=np.float32)
    result[0] = array[0]
    result[-1] = array[-1]
    result[1:-1] = array[3:-3]
    return result

SplinedDetectorMap(detMap.bbox, detMap.fiberId, [detMap.getXCenterSpline(ff).getX() for ff in detMap.fiberId], [detMap.getXCenterSpline(ff).getY() for ff in detMap.fiberId], [selectArray(detMap.getWavelengthSpline(ff).getX()) for ff in detMap.fiberId], [selectArray(detMap.getWavelengthSpline(ff).getY()) for ff in detMap.fiberId], detMap.getSpatialOffsets(), detMap.getSpectralOffsets(), detMap.visitInfo, detMap.getMetadata()).writeFits("detectorMap-simhack-m1.fits")

This ticket will implement this workaround in the simulator.



 Comments   
Comment by price [ 02/Sep/20 ]

I suspect we never noticed for the b and r arms because the ends are highly attenuated (dichroic and detector responses), while for the m arm they are not.

Comment by price [ 02/Sep/20 ]

I fixed the simulator, and generated some new detectorMaps that we can use for bootstrapping.

Comment by price [ 08/Sep/20 ]

Here's a plot of the wavelength residual (from a basic linear wavelength solution) after the fix:

>>> from pfs.drp.stella import SplinedDetectorMap
>>> detMap = SplinedDetectorMap.readFits("detectorMap-sim-m1.fits")
>>> wl = detMap.getWavelength(339)
>>> disp = (wl.max() - wl.min())/len(wl)
>>> import numpy as np
>>> row = np.arange(len(wl))
>>> linear = wl.min() + disp*row
>>> residual = wl - linear
>>> import matplotlib.pyplot as plt
>>> plt.plot(row, residual, "k-")
>>> plt.xlabel("Row")
>>> plt.ylabel("Wavelength residual (nm)")
>>> plt.show()
Comment by price [ 25/Sep/20 ]

Merged to master.

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