def CCSattachProxy(target): """ Improve reliability """ for i in range(3): logging.info("{}: {}".format(target, i)) try: return CCS.attachProxy(target) except RuntimeException as ex: logging.error(ex) time.sleep(1) pass raise
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from org.lsst.ccs.subsystem.focalplane.states import FocalPlaneState from java.time import Duration from ccs import proxies #import bot_bench import time import array import os CLEARDELAY=0.07 #CLEARDELAY=2.35 fp = CCS.attachProxy("focal-plane") # this will be override by CCS.aliases agentName = fp.getAgentProperty("agentName") if agentName != "focal-plane": fp = CCS.attachProxy(agentName) # re-attach to ccs subsystem autoSave = True imageTimeout = Duration.ofSeconds(60) symlinkToFast = True # These need to be changed when we switch R_and_D -> rawData symLinkFromLocation = "/gpfs/slac/lsst/fs3/g/data/rawData/focal-plane/" symLinkToLocation = "/gpfs/slac/lsst/fs3/g/fast/rawData/focal-plane/" def sanityCheck(): # Was this ever implemented on focal-plane? #biasOn = fp.isBackBiasOn() #if not biasOn: # print "WARNING: Back bias is not on"
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.scripting import ScriptingStatusBusListener from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import time try: bot = CCS.attachProxy("bot-motorplatform") except: print "BOT subsystem not available, attempting to continue" # raise def sanityCheck(): state = bot.getState() alert = state.getState(AlertState) if alert != AlertState.NOMINAL: print "WARNING: bot-motorplatform subsystem is in alert state %s" % alert def setLampOffset(x=0, y=0): sanityCheck() print "Setting BOT lamp offset (%g,%g)" % (x, y) bot.enable("X") bot.enable("Y") bot.setLampOffset(x, y) bot.disable("X") bot.disable("Y")
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import time bb = CCS.attachProxy("bot-bench") def sanityCheck(): state = bb.getState() alert = state.getState(AlertState) if alert!=AlertState.NOMINAL: print "WARNING: bot_bench subsystem is in alert state %s" % alert def setNDFilter(filter): sanityCheck() print "Setting ND filter "+filter bb.NeutralFWheel().setNamedPosition(filter) def setColorFilter(filter): sanityCheck() print "Setting Color filter "+filter bb.ColorFWheel().setNamedPosition(filter) def setSpotFilter(filter): sanityCheck() print "Setting Spot filter "+filter bb.SpotProjFWheel().setNamedPosition(filter) # Open the flat field projector shutter
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import bot_bench import array fp = CCS.attachProxy("focal-plane") autoSave = True imageTimeout = Duration.ofSeconds(60) def sanityCheck(): # Was this ever implemented on focal-plane? #biasOn = fp.isBackBiasOn() #if not biasOn: # print "WARNING: Back bias is not on" state = fp.getState() alert = state.getState(AlertState) if alert != AlertState.NOMINAL: print "WARNING: focal-plane subsystem is in alert state %s" % alert def clear(n=1): print "Clearing CCDs (%d)" % n fp.clear(n) fp.waitForSequencer(Duration.ofSeconds(10))
from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import time ndFilter = False colorFilter = True spot = False shutter = True fe55Shutter = False cb = None ts8mono = None try: cb = CCS.attachProxy("comcam-bench") except: print("No comcam-bench yet!") pass try: ts8mono = CCS.attachSubsystem("ts8-bench/Monochromator") except: print("No comcam-bench yet!") pass def sanityCheck(): state = cb.getState() alert = state.getState(AlertState) if alert != AlertState.NOMINAL: print "WARNING: bot_bench subsystem is in alert state %s" % alert
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import time import re bb = CCS.attachProxy("ts8-bench") def sanityCheck(): state = bb.getState() alert = state.getState(AlertState) if alert!=AlertState.NOMINAL: print "WARNING: bot_bench subsystem is in alert state %s" % alert def setNDFilter(filter): sanityCheck() print "Setting 1 and 2 SlitWidth",filter bb.Monochromator().setSlitSize(1,int(re.match(r"slit(\d+)",filter).group(1))) bb.Monochromator().setSlitSize(2,int(re.match(r"slit(\d+)",filter).group(1))) def setColorFilter(filter): sanityCheck() print "Setting color filter ",filter bb.Monochromator().setWaveAndFilter(int(filter)) def setSpotFilter(filter): sanityCheck() print "Setting Spot filter "+filter bb.SpotProjFWheel().setNamedPosition(filter)
#!/usr/bin/env ccs-script from org.lsst.ccs.scripting import CCS from org.lsst.ccs.bus.states import AlertState from java.time import Duration from ccs import proxies import bot_bench fp = CCS.attachProxy("comcam-fp") autoSave = True imageTimeout = Duration.ofSeconds(60) def sanityCheck(): #biasOn = fp.isBackBiasOn() #if not biasOn: # print "WARNING: Back bias is not on" state = fp.getState() alert = state.getState(AlertState) if alert != AlertState.NOMINAL: print "WARNING: focal-plane subsystem is in alert state %s" % alert def clear(n=1): print "Clearing CCDs (%d)" % n fp.clear(n) fp.waitForSequencer(Duration.ofSeconds(10)) def takeBias(fitsHeaderData): # TODO: This may not be the best way to take bias images
parser.add_option("--symlink", dest="symlink") parser.add_option("--skip", dest="skip") parser.add_option("--limit", dest="limit") (options, args) = parser.parse_args() if len(args) != 1: parser.print_help() exit(1) #CCS.aliases = {'focal-plane': 'focal-plane-sim', 'bot-bench': 'bot-bench-sim'} #CCS.aliases = {'focal-plane': 'ts8-fp', 'bot-bench': 'bot-bench' } # Assume if run is set we are running under eTraveler if options.run: fp = CCS.attachProxy('focal-plane') time.sleep(10.0) versions.write_versions(fp) configs.write_config(fp, ['Sequencer', 'Rafts']) import config cfg = config.parseConfig(args[0]) config.execute( cfg, { "dry_run": options.dry_run, "run": options.run, "symlink": options.symlink, "skip": options.skip, "limit": options.limit })