[PIPE2D-1324] Support fitting x/y offsets when updating the detectorMap Created: 01/Nov/23  Updated: 03/Nov/23  Resolved: 03/Nov/23

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

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

Attachments: PNG File tmp0 (3).png     PNG File tmp0 (4).png    

 Description   

When analysing the 2023-07 ("run12") data it turned out that the apparent fibre positions in the calibrations differ from data taken the next night by up to c. 0.4 pixels in the spatial direction.

Please add an option to correct a per-fibre offset in x and/or y. A per-fibre median offset from the predicted detectorMap position to the measured x or y centroid seems to work well.

Specifically, 96938 r3 looks "good" and 97055 r3 looks "bad"

Processing the data with 

reduceExposure.py /work/drp --calib /work/drp/CALIB --rerun rhl/tmp -c isr.doFlat=False isr.doFlatNir=True isr.doDark=False doAdjustDetectorMap=False doMeasureLines=False useCalexp=True --id visit=96938^97055 arm=r spectrograph=3 

and then analysing it with (using drp_stella as of 2023-10-31 4:52pm EST):

from datetime import datetime
import os
import re
import numpy as np

%matplotlib ipympl
import matplotlib.pyplot as plt

import lsst.daf.persistence as dafPersist
import pfs.drp.stella.utils.stability as stability

repo = "/work/drp" 

rerun = "rhl/tmp"
dataDir = os.path.join(repo, "rerun", rerun)
butler = dafPersist.Butler(dataDir)

if False:    # Quartzes going into detectorMap
    visit = 96938
else:        # quartzes taken during the run
    visit = 97055

arm, spectrograph = 'r', 3

dataId = dict(visit=visit, arm=arm, spectrograph=spectrograph)
isQuartz = True

detMap = butler.get("detectorMap_used", dataId)
als = stability.addTraceLambdaToArclines(butler.get('arcLines', dataId), detMap)

fitType = "per fiber" if False else "median" if True else None
hexBin = True   # useful with fully populated slits, or even SuNSS
nsigma = -4 # clip at nsigma, if > 0
plotWavelength = True
byRow = False       # plot dx and dy against row, not column
usePixels = True    # if True, report wavelength residuals in pixels, not nm
showChi = False
maxCentroidErr = 10
minSN = 0
lamErrMax = -0.04
soften = 0.012
arrowSize = 0.30   # for arrows and range in dx and dy plots; pixels

if True:
    fig = "tmp0"; plt.close(fig); fig = plt.figure(fig)
    fig = stability.plotArcResiduals(als, detMap, fitType=fitType, plotWavelength=plotWavelength,
                                     isQuartz=isQuartz, byRow=byRow,
                                     vmin=-arrowSize, vmax=arrowSize,
                                     title=f"{visit} {'%(arm)s%(spectrograph)d' % dataId}",
                                     usePixels=usePixels, showChi=showChi, hexBin=hexBin,
                                     soften=soften, lamErrMax=lamErrMax, nsigma=nsigma, figure=fig)       

Produces the first figure . Changing fitType from

{"median"}

to "per fiber" produces the second figure.

The new option should produce the second, low-residual, plot without any extra fitting



 Comments   
Comment by price [ 03/Nov/23 ]

Added ability to measure slit offsets when adjusting the detectorMap, and this appears to do the job.

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