def testCameraGeomUtils(self): for cw in self.cameraList: camera = cw.camera cameraGeomUtils.showCamera( camera, referenceDetectorName=camera[0].getName()) ds9.incrDefaultFrame() for det in (camera[0], camera[1]): cameraGeomUtils.showCcd(det, isTrimmed=True, inCameraCoords=False) ds9.incrDefaultFrame() cameraGeomUtils.showCcd(det, isTrimmed=True, inCameraCoords=True) ds9.incrDefaultFrame() cameraGeomUtils.showCcd(det, isTrimmed=False, inCameraCoords=False) ds9.incrDefaultFrame() cameraGeomUtils.showCcd(det, isTrimmed=False, inCameraCoords=True) ds9.incrDefaultFrame() for amp in det: cameraGeomUtils.showAmp(amp) ds9.incrDefaultFrame()
def displayCamera(args): """Display camera element according to command-line arguments @param[in] args: argparse.Namespace list of command-line arguments """ mapper = obs_hsc.HscMapper() camera = mapper.camera frame = 0 if args.showAmp: frame = 0 for ampStr in args.showAmp: if checkStr(ampStr, 'amp'): ccd, amp = ampStr.split() detector = camera[ccd] amplifier = detector[amp] cameraGeomUtils.showAmp(amplifier, frame=frame) frame += 1 if args.showCcd: frame = 0 for ccdStr in args.showCcd: if checkStr(ccdStr, 'ccd'): detector = camera[ccdStr] cameraGeomUtils.showCcd(detector, frame=frame) frame += 1 raftMap = {'0': [], '1': []} for det in camera: dName = det.getName() if dName.startswith('1'): raftMap['1'].append(dName) elif dName.startswith('0'): raftMap['0'].append(dName) else: raise RuntimeError("Did not recognize detector name") if args.showRaft: frame = 0 for raftStr in args.showRaft: if checkStr(raftStr, 'raft'): detectorList = [] for detector in camera: detName = detector.getName() if detName in raftMap[raftStr.lower()]: detectorList.append(detector) tmpCamera = Camera(raftStr, detectorList, camera._transformMap) cameraGeomUtils.showCamera(tmpCamera, frame=frame, binSize=1) frame += 1 if args.showCamera: cameraGeomUtils.showCamera(camera, frame=frame, binSize=args.cameraBinSize) if args.plotFocalPlane: cameraGeomUtils.plotFocalPlane(camera, 2., 2.)
def displayCamera(args): """Display camera element according to command-line arguments @param[in] args: argparse.Namespace list of command-line arguments """ mapper = obs_hsc.HscMapper() camera = mapper.camera frame = 0 if args.showAmp: frame = 0 for ampStr in args.showAmp: if checkStr(ampStr, "amp"): ccd, amp = ampStr.split() detector = camera[ccd] amplifier = detector[amp] cameraGeomUtils.showAmp(amplifier, frame=frame) frame += 1 if args.showCcd: frame = 0 for ccdStr in args.showCcd: if checkStr(ccdStr, "ccd"): detector = camera[ccdStr] cameraGeomUtils.showCcd(detector, frame=frame) frame += 1 raftMap = {"0": [], "1": []} for det in camera: dName = det.getName() if dName.startswith("1"): raftMap["1"].append(dName) elif dName.startswith("0"): raftMap["0"].append(dName) else: raise RuntimeError("Did not recognize detector name") if args.showRaft: frame = 0 for raftStr in args.showRaft: if checkStr(raftStr, "raft"): detectorList = [] for detector in camera: detName = detector.getName() if detName in raftMap[raftStr.lower()]: detectorList.append(detector) tmpCamera = Camera(raftStr, detectorList, camera._transformMap) cameraGeomUtils.showCamera(tmpCamera, frame=frame, binSize=1) frame += 1 if args.showCamera: cameraGeomUtils.showCamera(camera, frame=frame, binSize=args.cameraBinSize) if args.plotFocalPlane: cameraGeomUtils.plotFocalPlane(camera, 2.0, 2.0)
def testCameraGeomUtils(self): for cw in self.cameraList: camera = cw.camera disp = afwDisplay.Display() cameraGeomUtils.showCamera(camera, display=disp) disp.incrDefaultFrame() for det in (camera[10], camera[20]): cameraGeomUtils.showCcd(det, inCameraCoords=False) disp.incrDefaultFrame() cameraGeomUtils.showCcd(det, inCameraCoords=True) disp.incrDefaultFrame() cameraGeomUtils.showCcd(det, inCameraCoords=False) disp.incrDefaultFrame() cameraGeomUtils.showCcd(det, inCameraCoords=True) disp.incrDefaultFrame() for amp in det: cameraGeomUtils.showAmp(amp, display=disp, imageFactory=afwImage.ImageF) disp.incrDefaultFrame()
def testCameraGeomUtils(self): if not display: print "display variable not set; skipping cameraGeomUtils test" return for cw in self.cameraList: camera = cw.camera cameraGeomUtils.showCamera(camera, referenceDetectorName=camera[0].getName()) ds9.incrDefaultFrame() for det in (camera[0], camera[1]): cameraGeomUtils.showCcd(det, isTrimmed=True, inCameraCoords=False) ds9.incrDefaultFrame() cameraGeomUtils.showCcd(det, isTrimmed=True, inCameraCoords=True) ds9.incrDefaultFrame() cameraGeomUtils.showCcd(det, isTrimmed=False, inCameraCoords=False) ds9.incrDefaultFrame() cameraGeomUtils.showCcd(det, isTrimmed=False, inCameraCoords=True) ds9.incrDefaultFrame() for amp in det: cameraGeomUtils.showAmp(amp) ds9.incrDefaultFrame()
seg_file='../data/segmentation_itl.txt') output = fits.HDUList() output.append(fits.PrimaryHDU()) for col in '10': for row in '01234567': amp_name = 'R22_S11_C' + col + row outfile = 'C%s%s_image.fits' % (col, row) image_source.write_amplifier_image(amp_name, outfile) output.append(fits.open(outfile)[0]) output.writeto('mef.fits', clobber=True) # Flip the eimage in the x-direction so that we are viewing it through L3. eimage = fits.open(eimage_file) eimage[0].data = eimage[0].data[:, ::-1] eimage.writeto('eimage_xflip.fits', clobber=True) # Use cameraGeomUtils to display a segment. mapper = lsstSim.LsstSimMapper() camera = mapper.camera raft = 'R:2,2' ccd = 'S:1,1' sensor = camera[' '.join((raft, ccd))] amp = sensor['0,3'] amp = set_itl_bboxes(amp) cameraGeomUtils.showAmp(amp, imageSource=image_source, display=ds9.getDisplay(frame=0), imageFactory=afwImage.ImageI)
sensor_id = 'R22_S11' image_source = ImageSource(imarr, exptime, sensor_id, seg_file=seg_file) output = fits.HDUList() output.append(fits.PrimaryHDU()) for col in '10': for row in '01234567': amp_name = 'R22_S11_C' + col + row outfile = 'C%s%s_image.fits' % (col, row) image_source.write_amplifier_image(amp_name, outfile) output.append(fits.open(outfile)[0]) output.writeto('mef.fits', clobber=True) # Flip the eimage in the x-direction so that we are viewing it through L3. eimage = fits.open(eimage_file) eimage[0].data = eimage[0].data[:, ::-1] eimage.writeto('eimage_xflip.fits', clobber=True) # Use cameraGeomUtils to display a segment. mapper = lsstSim.LsstSimMapper() camera = mapper.camera raft = 'R:2,2' ccd = 'S:1,1' sensor = camera[' '.join((raft, ccd))] amp = sensor['0,3'] amp = set_itl_bboxes(amp) cameraGeomUtils.showAmp(amp, imageSource=image_source, display=ds9.getDisplay(frame=0), imageFactory=afwImage.ImageI)
if len(sys.argv) == 1: parser.print_help() sys.exit(1) mapper = obs_cfht.MegacamMapper() camera = mapper.camera frame = 0 disp = afwDisplay.Display(frame=frame) if args.showAmp: for ampStr in args.showAmp: if checkStr(ampStr, 'amp'): ccd, amp = ampStr.split() detector = camera[ccd] amplifier = detector[amp] cameraGeomUtils.showAmp(amplifier, display=disp) frame += 1 disp = afwDisplay.Display(frame=frame) if args.showCcd: for ccdStr in args.showCcd: if checkStr(ccdStr, 'ccd'): detector = camera[ccdStr] cameraGeomUtils.showCcd(detector, display=disp) frame += 1 disp = afwDisplay.Display(frame=frame) raftMap = {'north': ['ccd%02d'%val for val in range(18)], 'south': ['ccd%02d'%val for val in range(18, 36)]} if args.showRaft: for raftStr in args.showRaft:
def displayCamera(args): """Display camera element according to command-line arguments. Parameters ---------- args : `argparse.Namespace` Command-line arguments to parse. """ hsc = HyperSuprimeCam() camera = hsc.getCamera() frame = 0 if args.showAmp: frame = 0 for ampStr in args.showAmp: if checkStr(ampStr, 'amp'): ccd, amp = ampStr.split() detector = camera[ccd] amplifier = detector[amp] disp = afwDisplay.Display(frame=frame) cameraGeomUtils.showAmp(amplifier, display=disp) frame += 1 if args.showCcd: frame = 0 for ccdStr in args.showCcd: if checkStr(ccdStr, 'ccd'): detector = camera[ccdStr] disp = afwDisplay.Display(frame=frame) cameraGeomUtils.showCcd(detector, display=disp) frame += 1 raftMap = {'0': [], '1': []} for det in camera: dName = det.getName() if dName.startswith('1'): raftMap['1'].append(dName) elif dName.startswith('0'): raftMap['0'].append(dName) else: raise RuntimeError("Did not recognize detector name") if args.showRaft: frame = 0 for raftStr in args.showRaft: disp = afwDisplay.Display(frame) if checkStr(raftStr, 'raft'): detectorNameList = [] for detector in camera: detName = detector.getName() if detName in raftMap[raftStr.lower()]: detectorNameList.append(detName) cameraGeomUtils.showCamera(camera, detectorNameList=detectorNameList, display=disp, binSize=4) frame += 1 if args.showCamera: disp = afwDisplay.Display(frame) cameraGeomUtils.showCamera(camera, display=disp, binSize=args.cameraBinSize) if args.plotFocalPlane: cameraGeomUtils.plotFocalPlane(camera, 2., 2.)
if len(sys.argv) == 1: parser.print_help() sys.exit(1) mapper = obs_cfht.MegacamMapper() camera = mapper.camera frame = 0 ampMap = {'a': '0,0', 'b': '1,0'} if args.showAmp: for ampStr in args.showAmp: if checkStr(ampStr, 'amp'): ccd, amp = ampStr.split() detector = camera[ccd] amplifier = detector[ampMap[amp.lower()]] cameraGeomUtils.showAmp(amplifier, frame=frame) frame += 1 if args.showCcd: for ccdStr in args.showCcd: if checkStr(ccdStr, 'ccd'): detector = camera[ccdStr] cameraGeomUtils.showCcd(detector, frame=frame) frame += 1 raftMap = { 'north': ['ccd%02d' % val for val in range(18)], 'south': ['ccd%02d' % val for val in range(18, 36)] } if args.showRaft: for raftStr in args.showRaft:
def displayCamera(args): """Display camera element according to command-line arguments. Parameters ---------- args : `argparse.Namespace` Command-line arguments to parse. """ mapper = obs_hsc.HscMapper(root=".") camera = mapper.camera frame = 0 if args.showAmp: frame = 0 for ampStr in args.showAmp: if checkStr(ampStr, 'amp'): ccd, amp = ampStr.split() detector = camera[ccd] amplifier = detector[amp] disp = afwDisplay.Display(frame=frame) cameraGeomUtils.showAmp(amplifier, display=disp) frame += 1 if args.showCcd: frame = 0 for ccdStr in args.showCcd: if checkStr(ccdStr, 'ccd'): detector = camera[ccdStr] disp = afwDisplay.Display(frame=frame) cameraGeomUtils.showCcd(detector, display=disp) frame += 1 raftMap = {'0': [], '1': []} for det in camera: dName = det.getName() if dName.startswith('1'): raftMap['1'].append(dName) elif dName.startswith('0'): raftMap['0'].append(dName) else: raise RuntimeError("Did not recognize detector name") if args.showRaft: frame = 0 for raftStr in args.showRaft: disp = afwDisplay.Display(frame) if checkStr(raftStr, 'raft'): detectorNameList = [] for detector in camera: detName = detector.getName() if detName in raftMap[raftStr.lower()]: detectorNameList.append(detName) cameraGeomUtils.showCamera(camera, detectorNameList=detectorNameList, display=disp, binSize=4) frame += 1 if args.showCamera: disp = afwDisplay.Display(frame) cameraGeomUtils.showCamera(camera, display=disp, binSize=args.cameraBinSize) if args.plotFocalPlane: cameraGeomUtils.plotFocalPlane(camera, 2., 2.)
if len(sys.argv) == 1: parser.print_help() sys.exit(1) instrument = MegaPrime() camera = instrument.getCamera() frame = 0 disp = afwDisplay.Display(frame=frame) if args.showAmp: for ampStr in args.showAmp: if checkStr(ampStr, 'amp'): ccd, amp = ampStr.split() detector = camera[ccd] amplifier = detector[amp] cameraGeomUtils.showAmp(amplifier, display=disp) frame += 1 disp = afwDisplay.Display(frame=frame) if args.showCcd: for ccdStr in args.showCcd: if checkStr(ccdStr, 'ccd'): detector = camera[ccdStr] cameraGeomUtils.showCcd(detector, display=disp) frame += 1 disp = afwDisplay.Display(frame=frame) raftMap = {'north': ['ccd%02d'%val for val in range(18)], 'south': ['ccd%02d'%val for val in range(18, 36)]} if args.showRaft: for raftStr in args.showRaft:
if len(sys.argv) == 1: parser.print_help() sys.exit(1) mapper = obs_cfht.MegacamMapper() camera = mapper.camera frame = 0 ampMap = {'a':'0,0', 'b':'1,0'} if args.showAmp: for ampStr in args.showAmp: if checkStr(ampStr, 'amp'): ccd, amp = ampStr.split() detector = camera[ccd] amplifier = detector[ampMap[amp.lower()]] cameraGeomUtils.showAmp(amplifier, frame=frame) frame += 1 if args.showCcd: for ccdStr in args.showCcd: if checkStr(ccdStr, 'ccd'): detector = camera[ccdStr] cameraGeomUtils.showCcd(detector, frame=frame) frame += 1 raftMap = {'north':['ccd%02d'%val for val in range(18)], 'south':['ccd%02d'%val for val in range(18, 36)]} if args.showRaft: for raftStr in args.showRaft: if checkStr(raftStr, 'raft'): detectorList = []