[PIPE2D-1242] Investigate significant `sawtooth` in sky-subtracted spectra in n-band Created: 27/Jun/23 Updated: 08/Jul/23 Resolved: 08/Jul/23 |
|
| Status: | Done |
| Project: | DRP 2-D Pipeline |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Normal |
| Reporter: | Kiyoto Yabe | Assignee: | price |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Sprint: | Eng12July |
| Description |
|
Looking at the reduced spectrum of a bright calspec target (the processing tag is `edr2-20230621` with CALIB-2023-04-v3+w.2023.25), it was found that sky-subtraction in n-band was bad showing a sawtooth-like pattern. Investigate the reason of this.
|
| Comments |
| Comment by arnaud.lefur [ 04/Jul/23 ] |
|
So I looked at this today, I've looked at the flat used to build fiberProfiles. |
| Comment by rhl [ 04/Jul/23 ] |
|
I don't understand your conclusion. The normalisation should recover the input spectra used to estimate it in the first place, so if it doesn't I'd have thought that that meant that there was a bug in the code. |
| Comment by arnaud.lefur [ 04/Jul/23 ] |
|
The previous plot just show that we're missing some flux and that's coming from the fiberProfiles. Looking at the pfsArm file, if you compare pfsArm.flux and pfsArm.norm |
| Comment by arnaud.lefur [ 04/Jul/23 ] |
|
So I've regenerated the profiles, and re-reduced the data, now the normalisation in the pfsArm makes sense : |
| Comment by arnaud.lefur [ 04/Jul/23 ] |
|
With the new profile the sawtooth feature did disappear I've also looked at 91401, which is another quartz taken on all 3 arms, (90845, used for the profiles generation is n-arm only) |
| Comment by arnaud.lefur [ 05/Jul/23 ] |
|
Looking a bit closely at the mergeArms.py code, it seems to be there is a bug indeed, in normalizeSpectra function. for ss in spectra:
badBitmask = ss.flags.get(*self.config.mask)
for ii in range(len(ss)):
dispersion = calculateDispersion(ss.wavelength[ii])
nn = interpolateFlux(ss.wavelength[ii], ss.norm[ii]/dispersion, wavelength, fill=0.0)
interpolateFlux already applies the jacobian by default, so it looks like it's applied twice. |
| Comment by price [ 07/Jul/23 ] |
|
The n1 fiber profiles were created with the following command: constructFiberProfiles.py /work/drp --calib=/work/price/CALIB-2023-04-v1 --rerun=price/pipe2d-1221 --id visit=91014 arm=n spectrograph=1 --config isr.doFlat=True profiles.profileRadius=2 profiles.profileSwath=2000 profiles.profileOversample=5 --batch-type=none --no-versions |
| Comment by price [ 07/Jul/23 ] |
|
It turns out that the profiles for n1 are just plain awful: I've no idea how that happened, but re-running the constructFiberProfiles command, I get much better profiles: And the normalisation is much better too: I'm going to create a new CALIB directory with these profiles. |
| Comment by price [ 07/Jul/23 ] |
|
Built a new calib directory:
price@pfsa-usr02-gb:/work/drp $ cp -r CALIB-2023-04-v2 CALIB-2023-04-v3
price@pfsa-usr02-gb:/work/drp/CALIB-2023-04-v3/FIBERPROFILES $ rm pfsFiberProfiles-2023-04-20-090845-n1.fits
price@pfsa-usr02-gb:/work/drp/CALIB-2023-04-v3 $ sqlite3 calibRegistry.sqlite3 'DELETE FROM fiberProfiles WHERE arm = "n"; DELETE FROM fiberProfiles_visit WHERE arm = "n";'
ingestPfsCalibs.py /work/drp --calib /work/drp/CALIB-2023-04-v3 /work/drp/rerun/price/pipe2d-1242/FIBERPROFILES/pfsFiberProfiles-2023-04-21-091014-n1.fits --validity 10000 -c clobber=True --mode=copy
price@pfsa-usr02-gb:/work/drp $ ln -s CALIB-2023-04-v3 CALIB
|
| Comment by naoyuki.tamura [ 07/Jul/23 ] |
|
Looks like another place where even a simple QA process would be very helpful. |
| Comment by price [ 08/Jul/23 ] |
|
The conversation about the code snippet arnaud.lefur pointed out has been moved to |
| Comment by Kiyoto Yabe [ 08/Jul/23 ] |
|
The entire process is still running but I checked that visit, which has been finished, that particular feature is gone now. |
| Comment by price [ 08/Jul/23 ] |
|
Merged to master a small fix to FiberProfileSet.plot. |