Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions python/HSDIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,12 +394,11 @@ def add_repeat_waveform(self, transition_list, waveformsInUse):
logger.info("cycles per repeated in add_repeat_waveform: {}".format(
cycles_per_repeat))

first_cycle_err = "An HSDIO state change was detected during the first"
" repeat cycle."
first_cycle_err = "An HSDIO state change was detected during the first repeat cycle."
for t in transition_list:
if self.repeats[t['index']] == -1:
if repeat_sample_clock_cycles < cycles_per_repeat:
logger.error(first_cycle_err)
logger.error(first_cycle_err + "index == -1")
raise PauseError
if not repeats_done or sample_clock_cycles_to_next_ot < 0:
# mark the total time to first other transition, use from before but cant overwrite
Expand Down
5 changes: 4 additions & 1 deletion python/NewportStageController.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ def status(self): return self.WriteThenStore(self.axis+'STAT')[0].rstrip()[-2:]

def whereAmI(self):
output = self.WriteThenStore(self.axis+'R')[1].rstrip()[2:]
while output == '':
c = 0
while output == '' and c < 20:
output = self.WriteThenStore(self.axis+'R')[1].rstrip()[2:]
c += 1
logger.info("finding location, attempt {}/20".format(c))
return float(output)

def findCenter(self,side=-1):
Expand Down
2 changes: 1 addition & 1 deletion python/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Analysis(Prop):
postExperiment(). You can enable multi-threading of analyses using queueAfterMeasurement and queueAfterIteration,
but only if those results are not needed for other things (filtering, other analyses, optimization). If
multi-threading, you can also chose to dropMeasurementIfSlow or dropIterationIfSlow, which will not delete the data
but will just not process it. An analysis can return a success code after analyzeMesurement, which can be used to
but will just not process it. An analysis can return a success code after analyzeMeasurement, which can be used to
filter results. The highest returned code dominates others:
0 or None: good measurement, increment measurement total
1: soft fail, continue with other analyses, but do not increment measurement total
Expand Down
190 changes: 189 additions & 1 deletion python/cs_GUI.enaml
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,161 @@ enamldef HVcontrol(Window):
text = 'Delete'
clicked :: ctrl.delete()

enamldef AutoAligner(Window):
attr ctrl
attr creator

closing :: creator.open_windows.pop(name)
title = 'Hybrid Auto Aligner'

style_class << 'valid' if experiment.valid else 'invalid'
Container:
padding = 0
style_class << 'valid' if experiment.valid else 'invalid'
ScrollArea:
style_class << 'valid' if experiment.valid else 'invalid'
Container:
style_class << 'valid' if experiment.valid else 'invalid'
VGroup:
HGroup:
align_widths = False
hug_width = 'strong'

PushButton: b1:
text = 'open connection'
clicked::
ctrl.openThread()
PushButton: b2:
text='update settings'
clicked::
ctrl.update()
PushButton: b3:
text='close connection'
clicked::
ctrl.close()
Label:
text = 'enable communication with Auto Alignment Server?'
CheckBox:
checked := ctrl.enable
Label:
text = 'Auto Aligner IP address'
Field:
text:= ctrl.IP
Label:
text = 'Auto Aligner port'
IntField:
value := ctrl.port
EvalProp:
prop << ctrl.timeout
HGroup:
align_widths = False
hug_width = 'strong'

EvalProp:
prop << ctrl.enable_aligner
PushButton:
text = 'Query Aligner Status'
clicked::
ctrl.start()
ScrollArea:
style_class << 'valid' if experiment.valid else 'invalid'
Container:
style_class << 'valid' if experiment.valid else 'invalid'

padding = 0
hug_height='strong'
hug_width='strong'
GroupBox:
title = 'Image Settings'
EvalProp:
prop << ctrl.images.cutoff
EvalProp:
prop << ctrl.images.path
GroupBox:
title = 'Control Loop Settings'
GroupBox:
title = 'set point'
HGroup:
align_widths = True
EvalProp:
prop << ctrl.control.set_point_x
EvalProp:
prop << ctrl.control.set_point_y
EvalProp:
prop << ctrl.control.stability
GroupBox:
title = 'transformation matrix elements'
VGroup:
HGroup:
align_widths = False
GroupBox:
title = 'positive x motion'
VGroup:
EvalProp:
prop << ctrl.control.transform.mxx_p
EvalProp:
prop << ctrl.control.transform.myx_p
GroupBox:
title = 'positive y motion'
VGroup:
EvalProp:
prop << ctrl.control.transform.mxy_p
EvalProp:
prop << ctrl.control.transform.myy_p
HGroup:
align_widths = False
GroupBox:
title = 'negative x motion'
VGroup:
EvalProp:
prop << ctrl.control.transform.mxx_n
EvalProp:
prop << ctrl.control.transform.myx_n

GroupBox:
title = 'negative y motion'
VGroup:
EvalProp:
prop << ctrl.control.transform.mxy_n
EvalProp:
prop << ctrl.control.transform.myy_n

GroupBox:
title = 'Motor Settings'
EvalProp:
prop << ctrl.motors.serial_number
EvalProp:
prop << ctrl.motors.x_axis
EvalProp:
prop << ctrl.motors.y_axis
GroupBox:
title= 'Camera Settings'
EvalProp:
prop << ctrl.camera.serial_number
EvalProp:
prop << ctrl.camera.trigger_delay
EvalProp:
prop << ctrl.camera.exposure_time
EvalProp:
prop << ctrl.camera.gain
GroupBox:
title = 'ROI'
VGroup:
HGroup:
align_widths = False
hug_width = 'strong'
EvalProp:
prop << ctrl.camera.roi.offset_x
EvalProp:
prop << ctrl.camera.roi.offset_y
HGroup:
align_widths = False
hug_width = 'strong'
EvalProp:
prop << ctrl.camera.roi.width
EvalProp:
prop << ctrl.camera.roi.height

enamldef HPGenerators(Window):
attr hps
attr creator
Expand Down Expand Up @@ -3542,6 +3697,36 @@ enamldef FirstMeasurementsFilter(GroupBox):
'hard: do not continue with other analyses, do not increment measurement total, delete measurement data']
index := filters.filter_level

enamldef BeamAlignmentFilter(GroupBox):
attr filters
title = 'Drop Measurements with a misaligned beam'

Form:
Label:
text='enable'
CheckBox:
checked := filters.enable

Label:
text='Averaging Time'
SpinBox:
minimum=0
value := filters.avg_time

Label:
text='Max beam positioning error before data is dropped (pixels)'
FloatField:
value := filters.max_error

Label:
text='filter level'
ComboBox:
items = ['None: increment measurement total',
'soft: continue with other analyses, but do not increment measurement total',
'med: continue with other analyses, do not increment measurement total, and delete measurement data after all analyses',
'hard: do not continue with other analyses, do not increment measurement total, delete measurement data']
index := filters.filter_level

enamldef Histogram(Window):
attr experiment
attr analysis
Expand Down Expand Up @@ -4959,6 +5144,8 @@ enamldef Filters(Window):
filters = experiment.loading_filters
FirstMeasurementsFilter:
filters = experiment.first_measurements_filter
BeamAlignmentFilter:
filters = experiment.beam_alignment_filter

enamldef BoxTemperature(Window):
attr box_temperature
Expand Down Expand Up @@ -5197,7 +5384,8 @@ window_dictionary = {
'Origin Interface': 'Origin(origin = main.experiment.origin, creator=main, name="Origin Interface")',
'National Instruments Scopes': 'NIScopes(niscopes = main.experiment.NIScopes, creator=main, name="National Instruments Scopes")',
'HP Signal Generators': 'HPGenerators(hps = main.experiment.HPGenerators, creator=main, name="HP Signal Generators")',
'High Voltage Controller': 'HVcontrol(ctrl = main.experiment.HVcontrol, creator=main, name="High Voltage Controller")'
'High Voltage Controller': 'HVcontrol(ctrl = main.experiment.HVcontrol, creator=main, name="High Voltage Controller")',
'Hybrid Auto Aligner': 'AutoAligner(ctrl = main.experiment.AutoAligner, creator=main, name="Hybrid Auto Aligner")'
}

window_keys = window_dictionary.keys()
Expand Down
23 changes: 18 additions & 5 deletions python/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import DDS
import andor, AnalogInput

import Counter, unlock_pause, newportstage, nidaq_ai, HPSignalGenerator, HVcontroller
import Counter, unlock_pause, newportstage, nidaq_ai, HPSignalGenerator, HVcontroller, hybrid_auto_aligner, AWG
logger = logging.getLogger(__name__)
import origin_interface
import FakeInstrument # for testing
Expand Down Expand Up @@ -45,6 +45,8 @@ class Hybrid(Experiment):
Embezzletron = Member()
HPGenerators = Member()
HVcontrol = Member()
AutoAligner = Member()
AWG = Member()


thresholdROIAnalysis = Member()
Expand Down Expand Up @@ -75,6 +77,7 @@ class Hybrid(Experiment):
Ramsey = Member()
squareROIAnalysis = Member()
window_dict = Member()
beam_alignment_filter = Member()

def __init__(self,
config_instrument=None,
Expand Down Expand Up @@ -123,11 +126,13 @@ def __init__(self,
self.Embezzletron = FakeInstrument.Embezzletron('Embezzletron', self, 'Fake instrument that generates random data for testing')
self.HPGenerators = HPSignalGenerator.HPGenerators('HPGenerators', self, 'controls HP8648B signal generator')
self.HVcontrol = HVcontroller.HighVoltageController('HVcontrol', self, 'Controls Hybrid HV DACs')
self.AutoAligner = hybrid_auto_aligner.AutoAligner('AutoAligner', self, 'Maintains the 595nm alignment')
self.AWG = AWG.AWG(name='AWG', experiment=self, description="testing 1 2")
# do not include functional_waveforms in self.instruments because it
# need not start/stop
self.instruments += [
self.Andors, self.DDS, self.unlock_pause,
self.Embezzletron, self.NewportStage, self.HPGenerators, self.HVcontrol
self.Embezzletron, self.NewportStage, self.HPGenerators, self.HVcontrol, self.AutoAligner, self.AWG
]
# Labview must be last at least until someone fixes the start command
self.instruments += [self.LabView]
Expand Down Expand Up @@ -157,6 +162,8 @@ def __init__(self,
self.counter_hist = Counter.CounterHistogramAnalysis('counter_hist', self, 'Fits histograms of counter data and plots hist and fits.')
self.save_notes = save2013style.SaveNotes('save_notes', self, 'save a separate notes.txt')
self.origin = origin_interface.Origin('origin', self, 'saves selected data to the origin data server')
self.beam_alignment_filter = hybrid_auto_aligner.BeamAlignmentFilter('beam_alignment_filter', self, 'drop measurements where beam isn\'t aligned')


# do not include functional_waveforms_graph in self.analyses because it
# need not update on iterations, etc.
Expand All @@ -174,7 +181,8 @@ def __init__(self,
self.iterations_graph, self.Andors,
self.Ramsey, self.DAQmxAI, self.unlock_pause,
self.retention_analysis, self.retention_graph,
self.save_notes, self.counter_hist, self.origin
self.save_notes, self.counter_hist, self.origin,
self.beam_alignment_filter
]

self.properties += [
Expand All @@ -188,7 +196,8 @@ def __init__(self,
'retention_graph', 'Ramsey', 'counter_graph', 'counter_hist',
'unlock_pause', 'ROI_rows', 'ROI_columns',
'ROI_bg_rows', 'ROI_bg_columns',
'origin', 'HPGenerators', 'thresholdROIAnalysis', 'squareROIAnalysis', 'HVcontrol'
'origin', 'HPGenerators', 'thresholdROIAnalysis', 'squareROIAnalysis', 'HVcontrol', 'AutoAligner',
'AWG', 'beam_alignment_filter'
]

self.window_dict = {
Expand Down Expand Up @@ -220,7 +229,11 @@ def __init__(self,
'Functional Waveforms Graph': 'FunctionalWaveformsGraph(graph = main.experiment.functional_waveforms_graph, creator=main, name="Functional Waveforms Graph")',
'Origin Interface': 'Origin(origin = main.experiment.origin, creator=main, name="Origin Interface")',
'HP Signal Generators': 'HPGenerators(hps = main.experiment.HPGenerators, creator=main, name="HP Signal Generators")',
'High Voltage Controller': 'HVcontrol(ctrl = main.experiment.HVcontrol, creator=main, name="High Voltage Controller")'
'High Voltage Controller': 'HVcontrol(ctrl = main.experiment.HVcontrol, creator=main, name="High Voltage Controller")',
'CounterGraph': 'CounterGraph(analysis = main.experiment.counter_graph, creator=main, name="CounterGraph")',
'CounterHistAnalysis': 'CounterHistAnalysis(analysis = main.experiment.counter_hist, creator=main, name="CounterHistAnalysis")',
'Hybrid Auto Aligner': 'AutoAligner(ctrl = main.experiment.AutoAligner, creator=main, name="Hybrid Auto Aligner")',
'AWG': 'AWG_Page(AWG = main.experiment.AWG, creator=main, name="AWG")'
}

try:
Expand Down
Loading