Uploaded image for project: 'DRP 2-D Pipeline'
  1. DRP 2-D Pipeline
  2. PIPE2D-1342

Slit offsets should be applied _before_ modelling the optics and detectors

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Open (View Workflow)
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      The DetectorMap code to adjust the spatial (and spectral) offsets of individual fibres appears to adjust the position of the traces on the detector rather than moving the trace relative to the full optical model (including the gap between the two CCDs in the optical arms).

      This didn't matter when we were making small adjustments, but to model the drift flat data we need to handle the higher-order corrections, and the chip gaps.

      On slack I'd complained that there was structure in the resulting images, but on further consideration I think that this is beating between the non-integral step and the fact that the motion is treated as a set of steps (i.e. there is structure on the scale of the step, but it appears at a larger scale). This is not a problem.

      The code to make this model looks like this (using rerun rhl/tmp in Hilo).

      from pfs.datamodel import TargetType
      from pfs.drp.stella import SpectrumSet, FiberTraceSet
      from pfs.drp.stella.buildFiberProfiles import BuildFiberProfilesTask
      
      dataId = {'visit': 103274, 'arm': 'r', 'spectrograph': 3}
      
      exp = butler.get("calexp", dataId)
      detMap = butler.get("detectorMap_used", dataId)
      pfsConfig = butler.get("pfsConfig", dataId).select(spectrograph=dataId["spectrograph"])
      
      fiberId = pfsConfig.select(spectrograph=dataId["spectrograph"], targetType=TargetType.DCB).fiberId
      
      spec = butler.get("pfsArm", dataId)
      spec.flux[(spec.mask & ~spec.flags["REFLINE"]) != 0x0] = np.NaN
      spectra = SpectrumSet.fromPfsArm(spec)
      #
      # Build the profiles
      #
      config = BuildFiberProfilesTask.ConfigClass()
      config.profileRadius = 5
      buildFiberProfilesTask = BuildFiberProfilesTask(config)
      
      fiberProfiles = buildFiberProfilesTask.run(exp, None, detectorMap=detMap, pfsConfig=pfsConfig).profiles    
      #
      # Simulate drifted data
      #
      driftedModel = None
      for dx in np.arange(-20, 20, 0.55):
          detMap = butler.get("detectorMap_used", dataId)
      
          for fid in fiberId:
              detMap.setSlitOffsets(fid, detMap.getSpatialOffset(fid) + dx, detMap.getSpectralOffset(fid))
      
          fts = fiberProfiles.makeFiberTracesFromDetectorMap(detMap)
      
          image = spectra.makeImage(exp.getDimensions(), fts)
          if driftedModel is None:
              driftedModel = image
          else:
              driftedModel += image
      

        Attachments

          Activity

            People

            • Assignee:
              price price
              Reporter:
              rhl rhl
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: