Skip to content

Commit

Permalink
Merge pull request #33 from lsst-camera-dh/LSSTTD-1231
Browse files Browse the repository at this point in the history
Enable the monochromator slit width to be set independently for each exposure
  • Loading branch information
jchiang87 authored Mar 21, 2018
2 parents e3f19cb + 5b9d906 commit c8b00c6
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def run(self):
self.image_clears()
self.bias_image(seqno)

slit_width_changed = self._set_slitwidth(tokens, 2)
if slit_width_changed:
meas_flux = self.measured_flux(self.wl)
self.logger.info("flat_pair_acq: measured flux =", meas_flux)

# Compute exposure time in ms to obtain the desired signal level.
target_counts = float(tokens[1]) # e-/pixel
exptime = self.compute_exptime(target_counts, meas_flux)
Expand Down
1 change: 1 addition & 0 deletions harnessed_jobs/qe_raft_acq/v0/ccs_qe_raft_acq.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def run(self):

wl = float(tokens[1])
target_counts = float(tokens[2])
self._set_slitwidth(tokens, 3)
meas_flux = self.measured_flux(wl)
exptime = self.compute_exptime(target_counts, meas_flux)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,31 @@ def setup_sequencer(ts8, sequence_file=sequence_file, nclears=10,
ccs_sub.ts8.synchCommand(10, "setTestStand TS8")

test_type = 'CONN'
image_type = 'FLAT'

command = "setTestType %s" % test_type
ccs_sub.ts8.synchCommand(10, command)

command = "setImageType %s" % image_type
ccs_sub.ts8.synchCommand(10, command)

openShutter = False
actuateXED = False
filename_format = "${CCDSerialLSST}_${testType}_${imageType}_%04d_${RunNumber}_${timestamp}.fits"

# Take 5 bias frames to clear the CCDs and enable a noise
# measurement.
image_type = 'BIAS'
command = "setImageType %s" % image_type
ccs_sub.ts8.synchCommand(10, command)
exptime = 0
for i in range(5):
filename = filename_format % i
command = 'exposeAcquireAndSave %i %s %s "%s"' % \
(exptime, openShutter, actuateXED, filename)
ccs_sub.ts8.synchCommand(100, command)
logger.info("%s taken with exptime %i ms", image_type, exptime)

# Take the flats for the 3 exposure times used at BNL.
image_type = 'FLAT'
command = "setImageType %s" % image_type
ccs_sub.ts8.synchCommand(10, command)

# Take frames for three different exposure times.
exptimes = (100, 1000, 4000)
for exptime in exptimes:
Expand Down
1 change: 1 addition & 0 deletions harnessed_jobs/sflat_raft_acq/v0/ccs_sflat_raft_acq.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def run(self):
wl = float(tokens[1])
target_flux = float(tokens[2])
nframes = int(tokens[3])
self._set_slitwidth(tokens, 4)
test_type = "SFLAT_%3.3d" % wl
if target_flux < 1e4:
flux_level = 'L'
Expand Down
33 changes: 31 additions & 2 deletions python/eo_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import time
from collections import namedtuple
import logging
import java.lang
try:
import java.lang
except ImportError:
print("could not import java.lang")
from ccs_scripting_tools import CcsSubsystems, CCS
from ts8_utils import set_ccd_info, write_REB_info

Expand Down Expand Up @@ -87,7 +90,7 @@ class EOAcquisition(object):
Base class for TS8 electro-optical data acquisition.
"""
def __init__(self, seqfile, acq_config_file, acqname, metadata,
subsystems, ccd_names, logger=logger):
subsystems, ccd_names, logger=logger, slit_id=2):
"""
Parameters
----------
Expand All @@ -106,6 +109,13 @@ def __init__(self, seqfile, acq_config_file, acqname, metadata,
names for the CcsSubsystems class, i.e., 'ts', 'ts8', 'pd',
and 'mono'. If None, then the default subsystems, 'ts', 'ts8',
'ts/PhotoDiode', and 'ts/Monochromator', will be attached.
ccd_names : dict
Dictionary of namedtuple containing the CCD .sensor_id and
.maufacturer_sn information, keyed by slot name.
logger : logging.Logger
Log commands using the logger.info(...) function.
slit_id: int [2]
ID of the monochormator slit to set via ._set_slitwidth(...)
"""
if subsystems is None:
subsystems = dict(ts8='ts8', pd='ts8/Monitor',
Expand All @@ -123,10 +133,14 @@ def __init__(self, seqfile, acq_config_file, acqname, metadata,
self.acqname = acqname
self.md = metadata
self.logger = logger
self.slit_id = slit_id
self._set_ts8_metadata()
self._get_exptime_limits()
self._get_image_counts()
self._set_default_wavelength()
self.current_slitwidth \
= int(self.eo_config.get('DEFAULT_SLITWIDTH', default=240))
self.set_slitwidth(self.current_slitwidth, self.slit_id)
self._read_instructions(acq_config_file)
self._fn_pattern = "${CCDSerialLSST}_${testType}_${imageType}_${SequenceInfo}_${RunNumber}_${timestamp}.fits"
self.sub.ts8.synchCommand(90, "loadSequencer", self.seqfile)
Expand Down Expand Up @@ -184,6 +198,21 @@ def _set_default_wavelength(self):
default="550.0"))
self.set_wavelength(self.wl)

def _set_slitwidth(self, tokens, index):
slit_width_changed = False
try:
width = int(tokens[index])
except IndexError:
width = int(self.eo_config.get('DEFAULT_SLITWIDTH', default=240))
if width != self.current_slitwidth:
self.set_slitwidth(width, self.slit_id)
self.current_slitwidth = width
slit_width_changed = True
return slit_width_changed

def set_slitwidth(self, width, slit_id):
self.sub.mono.synchCommand(10, 'setSlitSize', slit_id, width)

def set_wavelength(self, wl):
"""
Set the monochromator wavelength.
Expand Down
Loading

0 comments on commit c8b00c6

Please sign in to comment.