Skip to content

Commit

Permalink
Merge pull request #49 from lsst-camera-dh/LSSTTD-1362_use_new_ccs_jy…
Browse files Browse the repository at this point in the history
…thon_commands

use new ccs jython commands for raft-level acquisitions
  • Loading branch information
jchiang87 authored Jan 31, 2019
2 parents 9af8d56 + 34ccf3e commit 5bba726
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

def verify_rebs(ts8, logger=logger):
"List the REBs that are attached."
rebs = ts8.synchCommand(10, "getREBDeviceNames").getResult()
rebs = ts8.synchCommand(10, "getREBDeviceNames")
logger.info("%i REBs found:", len(rebs))
for reb in rebs:
logger.info(" %s", reb)
Expand All @@ -41,7 +41,7 @@ def setup_sequencer(ts8, sequence_file=sequence_file, nclears=10,
ts8.synchCommand(10, command)

command = 'exposeAcquireAndSave 100 False False ""'
logger.info(ts8.synchCommand(300, command).getResult())
logger.info(ts8.synchCommand(300, command))

if __name__ == '__main__':
if subsystems is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def reb_power_on(ccs_sub, rebid, power_line, ccd_type, raise_exception=True):
logger.info("*****************************************************")

reb_device \
= list(ccs_sub.ts8.synchCommand(10, 'getREBDevices').getResult())[rebid]
= list(ccs_sub.ts8.synchCommand(10, 'getREBDevices'))[rebid]

# Power on the REB using the power-up sequence. (10.4.2.2, step 2)
ccs_sub.rebps.synchCommand(10, 'sequencePower', power_line, True)
Expand Down Expand Up @@ -104,8 +104,7 @@ def reb_power_on(ccs_sub, rebid, power_line, ccd_type, raise_exception=True):
outfile = '/'.join((tsCWD, outfile))
logger.info('Writing powerOn output to %s', outfile)
with open(outfile, 'w') as output:
output.write(str(ccs_sub.ts8.synchCommand(900, 'powerOn',
rebid).getResult()))
output.write(str(ccs_sub.ts8.synchCommand(900, 'powerOn', rebid)))
os.chmod(outfile, 0664)
logger.info("------ %s power-on complete ------\n", reb_slot)
except java.lang.Exception as eobj:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
plotter.plot()
plt.savefig('%s_%s_%s.png' % (section, local_time,
siteUtils.getUnitId()))
except StandardError as eobj:
except Exception as eobj:
print("Exception caught while producing trending plot:")
print(str(eobj))
print("continuing...")
Expand Down
6 changes: 3 additions & 3 deletions harnessed_jobs/ts8_cool_down/v0/ccs_ts8_cool_down.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
ts_state = 0
while ts_state == 0:
try:
ts_state = ccs_sub.ts.synchCommand(10, "isTestStandReady").getResult()
ctemp = ccs_sub.cryo.synchCommand(20, "getTemp B").getResult()
ts_state = ccs_sub.ts.synchCommand(10, "isTestStandReady")
ctemp = ccs_sub.cryo.synchCommand(20, "getTemp B")
logger.info("time = %s, temp = %f", time.time(), ctemp)
except StandardError as eobj:
logger.info("Exception caught while waiting for test stand ready state")
Expand All @@ -44,4 +44,4 @@

# Final check of test stand readiness.
reply = ready_state.get()
result = ccs_sub.ts.synchCommand(120, "goTestStand").getResult()
result = ccs_sub.ts.synchCommand(120, "goTestStand")
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run(self):
wl = float(tokens[1])
exptime = float(tokens[2])
rwl = self.set_wavelength(wl)
filt = self.sub.mono.synchCommand(60, "getFilter").getResult()
filt = self.sub.mono.synchCommand(60, "getFilter")
logger.info("Wavelength: %f; Filter: %f" % (rwl, filt))
time.sleep(4.)

Expand Down
34 changes: 17 additions & 17 deletions python/eo_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def hit_target_pressure(vac_sub, target, wait=5, tmax=7200, logger=logger):
The logger object.
"""
tstart = time.time()
pressure = vac_sub.synchCommand(20, "readPressure").getResult()
pressure = vac_sub.synchCommand(20, "readPressure")
while pressure > target or pressure < 0:
logger.info("time = %s, pressure = %f", time.time(), pressure)
if (time.time() - tstart) > tmax:
raise RuntimeError("Exceeded allowed pump-down time for "
+ "target pressure %s" % target)
time.sleep(wait)
pressure = vac_sub.synchCommand(20, "readPressure").getResult()
pressure = vac_sub.synchCommand(20, "readPressure")

AcqMetadata = namedtuple('AcqMetadata', 'cwd raft_id run_number'.split())

Expand Down Expand Up @@ -226,7 +226,7 @@ def set_wavelength(self, wl):
The desired wavelength in nm.
"""
command = "setWaveAndFilter %s" % wl
rwl = self.sub.mono.synchCommand(60, command).getResult()
rwl = self.sub.mono.synchCommand(60, command)
self.sub.ts8.synchCommand(10, "setMonoWavelength", rwl)
return rwl

Expand Down Expand Up @@ -322,7 +322,7 @@ def take_image(self, seqno, exptime, openShutter, actuateXed,
timeout = int(max(timeout, exptime + 20))
for itry in range(max_tries):
try:
result = self.sub.ts8.synchCommand(timeout, command).getResult()
result = self.sub.ts8.synchCommand(timeout, command)
return result
except (StandardError, java.lang.Exception) as eobj:
self.logger.info("EOAcquisition.take_image: try %i failed",
Expand Down Expand Up @@ -408,7 +408,7 @@ def measured_flux(self, wl, seqno=0, fluxcal_time=2.):
file_path = glob.glob(os.path.join(self.md.cwd, '*', fits_file))[0]
command = "getFluxStats %s" % file_path
flux_sum += \
float(self.sub.ts8.synchCommand(10, command).getResult())
float(self.sub.ts8.synchCommand(10, command))
return flux_sum/len(fits_files)

def compute_exptime(self, target_counts, meas_flux):
Expand Down Expand Up @@ -438,7 +438,7 @@ def getParallelHighConfig(self):
get phi0, phi1, phi2 existing values of pclkHighP
"""
command = "printConfigurableParameters"
res = str(self.sub.ts8dac0.synchCommand(10, command).getResult())
res = str(self.sub.ts8dac0.synchCommand(10, command))
m = re.search(r"pclkHighP: ([-\d]+\.\d+),", res)
if not m:
self.logger.info("m is None, res=%s", res)
Expand All @@ -447,7 +447,7 @@ def getParallelHighConfig(self):
if phi0 < 1.0:
self.logger.info("ts8dac0.pclkHighP=%s < 1.0", phi0)
return None
res = str(self.sub.ts8dac1.synchCommand(10, command).getResult())
res = str(self.sub.ts8dac1.synchCommand(10, command))
m = re.search(r"pclkHighP: ([-\d]+\.\d+),", res)
if not m:
self.logger.info("m is None, res=%s", res)
Expand All @@ -456,7 +456,7 @@ def getParallelHighConfig(self):
if phi1 < 1.0:
self.logger.info("ts8dac1.pclkHighP=%s < 1.0", phi1)
return None
res = str(self.sub.ts8dac2.synchCommand(10, command).getResult())
res = str(self.sub.ts8dac2.synchCommand(10, command))
m = re.search(r"pclkHighP: ([-\d]+\.\d+),", res)
if not m:
self.logger.info("m is None, res=%s", res)
Expand All @@ -472,7 +472,7 @@ def getParallelLowConfig(self):
get plo0, plo1, plo2 existing values of pclkLowP
"""
command = "printConfigurableParameters"
res = str(self.sub.ts8dac0.synchCommand(10, command).getResult())
res = str(self.sub.ts8dac0.synchCommand(10, command))
m = re.search(r"pclkLowP: ([-\d]+\.\d+),", res)
if not m:
self.logger.info("m is None, res=%s", res)
Expand All @@ -481,7 +481,7 @@ def getParallelLowConfig(self):
if plo0 > 0.5:
self.logger.info("ts8dac0.pclkLowP: %s > 0.5", plo0)
return None
res = str(self.sub.ts8dac1.synchCommand(10, command).getResult())
res = str(self.sub.ts8dac1.synchCommand(10, command))
m = re.search(r"pclkLowP: ([-\d]+\.\d+),", res)
if not m:
self.logger.info("m is None, res=%s", res)
Expand All @@ -490,7 +490,7 @@ def getParallelLowConfig(self):
if plo1 > 0.5:
self.logger.info("ts8dac1.pclkLowP: %s > 0.5", plo1)
return None
res = str(self.sub.ts8dac2.synchCommand(10, command).getResult())
res = str(self.sub.ts8dac2.synchCommand(10, command))
m = re.search(r"pclkLowP: ([-\d]+\.\d+),", res)
if not m:
self.logger.info("m is None, res=%s", res)
Expand All @@ -503,7 +503,7 @@ def getParallelLowConfig(self):

def get_ccdtype(self):
""" return ccdtype as a string"""
res = str(self.sub.ts8.synchCommand(10, "getCcdType").getResult())
res = str(self.sub.ts8.synchCommand(10, "getCcdType"))
if re.match(r"^e2v$", res):
return "e2v"
elif re.match(r"^itl$", res):
Expand All @@ -518,13 +518,13 @@ def verify_sequencer_params(self):
"""
#- CleaningNummber = [0, 0, 0]
res = str(self.sub.ts8.synchCommand(10,
"getSequencerParameter", "CleaningNumber").getResult())
"getSequencerParameter", "CleaningNumber"))
if not re.match(r"\[0, 0, 0\]", res):
self.logger.info("SeqParam CleaningNumber:%s invalid", res)
raise java.lang.Exception("Bad Sequencer: CleaningNumber=0 required")
#- ClearCount = [1, 1, 1]
res = str(self.sub.ts8.synchCommand(10,
"getSequencerParameter", "ClearCount").getResult())
"getSequencerParameter", "ClearCount"))
if not re.match(r"\[1, 1, 1\]", res):
self.logger.info("SeqParam ClearCount:%s invalid", res)
raise java.lang.Exception("Bad Sequencer: ClearCount=1 required")
Expand Down Expand Up @@ -598,7 +598,7 @@ def ccd_clear(self, nclears):
for _ in range(nclears):
self.sub.ts8.synchCommand(10, "setSequencerStart", "Clear")
self.sub.ts8.synchCommand(10, "startSequencer")
self.sub.ts8.synchCommand(10, "waitSequencerDone", 1000).getResult()
self.sub.ts8.synchCommand(10, "waitSequencerDone", 1000)
self.sub.ts8.synchCommand(10, "setSequencerStart", "Bias")
if ccdtype == 'e2v':
if unipolar:
Expand Down Expand Up @@ -670,7 +670,7 @@ def start_accumulation(self):
running = False
while not running:
try:
running = self.sub.pd.synchCommand(20, "isAccumInProgress").getResult()
running = self.sub.pd.synchCommand(20, "isAccumInProgress")
except StandardError as eobj:
self.logger.info("PhotodiodeReadout.start_accumulation:")
self.logger.info(str(eobj))
Expand All @@ -691,7 +691,7 @@ def write_readings(self, seqno, icount=1):

result = self.sub.pd.synchCommand(1000, "readBuffer", pd_filename)
self.logger.info("Photodiode readout accumulation finished at %f, %s",
time.time() - self._start_time, result.getResult())
time.time() - self._start_time, result)

return pd_filename

Expand Down
6 changes: 3 additions & 3 deletions python/rebCurrentLimits.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def check_rebps_limits(self, rebid, enforce_lower_limits=True,
for limits in self.values():
ps_channel_name = 'REB%d.%s' % (rebid, limits.reb_ps_name)
ps_current = self.rebps.synchCommand(10, 'readChannelValue',
ps_channel_name).getResult()
ps_channel_name)
self.logger.info("%s: %s mA", ps_channel_name, ps_current)
if ((enforce_lower_limits and ps_current < limits.low_lim)
or ps_current > limits.high_lim):
Expand Down Expand Up @@ -101,10 +101,10 @@ def check_comparative_ranges(self, rebid, raise_exception=True):
continue
ps_channel_name = 'REB%d.%s' % (rebid, limits.reb_ps_name)
ps_current = self.rebps.synchCommand(10, 'readChannelValue',
ps_channel_name).getResult()
ps_channel_name)
reb_channel_name = 'R00.Reb%d.%s' % (rebid, channel_name)
reb_current = self.ts8.synchCommand(10, 'readChannelValue',
reb_channel_name).getResult()
reb_channel_name)
if abs(ps_current - reb_current) > limits.comp_range:
message \
= "Currents for %s and %s lie outside comparative range." \
Expand Down

0 comments on commit 5bba726

Please sign in to comment.