-
Type:
Story
-
Status: Done (View Workflow)
-
Priority:
Normal
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Sprint:2DDRP-2021 A3
If I run the code in constructFiberProfilesTask.py to make new fiberProfiles from a single exposure and then use them to extract the spectra from the same data they should be identically 1.0, but they are not (see
). The code was actually unpacked into this stand-alone fragment from a notebook, but I think it's doing the same thing as the combine method (remove the %matplotlib notebook to run as a python script).
import os import numpy as np import matplotlib.pyplot as plt %matplotlib notebook import lsst.daf.persistence as dafPersist # --------------------------------- base, rerun = "/projects/HSC/PFS/Subaru", os.path.join("rhl", "sunss") dataDir = os.path.join(base, "rerun", rerun) calibRoot = os.path.join(base, "CALIB-SuNSS") butler = dafPersist.Butler(dataDir, calibRoot=calibRoot) # --------------------------------- import pfs.drp.stella.buildFiberProfiles BuildFiberProfilesTask = pfs.drp.stella.buildFiberProfiles.BuildFiberProfilesTask config = BuildFiberProfilesTask.ConfigClass() config.doBlindFind = False buildFiberProfilesTask = BuildFiberProfilesTask(config) # --------------------------------- dataId = dict(visit=46243, spectrograph=1, arm='r') # domeflat exp = butler.get("calexp", dataId) detMap = butler.get("detectorMap", dataId) pfsConfig = butler.get("pfsConfig", dataId) results = buildFiberProfilesTask.run(exp, detMap, pfsConfig) profiles, centers = results.profiles, results.centers traces = profiles.makeFiberTracesFromDetectorMap(detMap) spectra0 = traces.extractSpectra(exp.maskedImage) for i, ss in enumerate(spectra0): profiles[ss.fiberId].norm = ss.flux traces = profiles.makeFiberTracesFromDetectorMap(detMap) spectra = traces.extractSpectra(exp.maskedImage) # --------------------------------- fig = 1; plt.close(fig); fig = plt.figure(fig) for ss in spectra: if 4 < ss.fiberId < 140: plt.plot(ss.flux/np.median(ss.flux), alpha=0.5) plt.ylim(1 + 0.01*np.array([-1, 1])) plt.xlabel("pixel") plt.ylabel("Extracted flux") plt.title(f"{'%(visit)d %(arm)s%(spectrograph)d' % dataId}");