*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit bec23d52 authored by Schabbauer, Johannes's avatar Schabbauer, Johannes
Browse files

Documentation and BLACS improvments for TimeBase

In BLACS Tab, do not query Worker for all cases, e.g.
transition to manual is not required.
Added updateing smart_cache in get_remote_values, such that the Worker
is aware of changes since the last shot.
parent 46cb73ea
No related branches found
No related tags found
Loading
...@@ -46,3 +46,42 @@ class TimeBaseTab(DeviceTab): ...@@ -46,3 +46,42 @@ class TimeBaseTab(DeviceTab):
{"hostname":self.hostname, "port":self.port, "num_AOM":self.num_AOM}) {"hostname":self.hostname, "port":self.port, "num_AOM":self.num_AOM})
self.primary_worker = "main_worker" self.primary_worker = "main_worker"
# Redefine function, where we don't need to call the Worker,
# because the TimeBase AOM driver has only static values progammed.
@define_state(MODE_TRANSITION_TO_BUFFERED,False)
def abort_transition_to_buffered(self,workers=None):
self.mode = MODE_MANUAL
self.program_device()
@define_state(MODE_BUFFERED,False)
def abort_buffered(self,notify_queue):
notify_queue.put([self.device_name,'success'])
self.mode = MODE_MANUAL
self.program_device()
@define_state(MODE_BUFFERED,False)
def transition_to_manual(self,notify_queue,program=False):
self.mode = MODE_TRANSITION_TO_MANUAL
# Update the GUI with the final values of the run:
for channel, value in self._final_values.items():
if channel in self._AO:
self._AO[channel].set_value(value,program=False)
elif channel in self._DO:
self._DO[channel].set_value(value,program=False)
elif channel in self._image:
self._image[channel].set_value(value,program=False)
elif channel in self._DDS:
self._DDS[channel].set_value(value,program=False)
notify_queue.put([self.device_name,'success'])
self.mode = MODE_MANUAL
if program:
self.program_device()
else:
self._last_programmed_values = self.get_front_panel_values()
...@@ -67,6 +67,9 @@ class TimeBaseWorker(Worker): ...@@ -67,6 +67,9 @@ class TimeBaseWorker(Worker):
self.remote_values[ch]["freq"] = int(par["Rfreq"]) self.remote_values[ch]["freq"] = int(par["Rfreq"])
self.remote_values[ch]["amp"] = 0.1 * int(par["Rampl"]) self.remote_values[ch]["amp"] = 0.1 * int(par["Rampl"])
self.remote_values[ch]["gate"] = int(par["Rout"]) self.remote_values[ch]["gate"] = int(par["Rout"])
# Update values in smart cache
for name,value in par.items():
self.smart_cache[ch][f"S{name[1:]}"] = int(value)
except: except:
# Sometimes the TCP servers seems to respond with a wrong answer to Gpar (e.g. b'Rpcbtemp:xxxx\r\n'), # Sometimes the TCP servers seems to respond with a wrong answer to Gpar (e.g. b'Rpcbtemp:xxxx\r\n'),
# maybe because of communication with the http interface or transmission errors. # maybe because of communication with the http interface or transmission errors.
......
...@@ -35,20 +35,43 @@ class TimeBaseAOM(Device): ...@@ -35,20 +35,43 @@ class TimeBaseAOM(Device):
# Enable and disable AOM via gate directly # Enable and disable AOM via gate directly
def enable(self,t): def enable(self,t):
self.gate.enable(t) """Enable the AOM's TTL connection."""
if hasattr(self,"gate"):
self.gate.enable(t)
else:
raise LabscriptError(f"No gate was defined for {self.name}, use the DigitalOut instance if defined.")
def disable(self,t): def disable(self,t):
self.gate.disable(t) """Disable the AOM's TTL connection."""
if hasattr(self,"gate"):
self.gate.disable(t)
else:
raise LabscriptError(f"No gate was defined for {self.name}, use the DigitalOut instance if defined.")
# AOM settings
def setamp(self,value,units=None): def setamp(self,value,units=None):
"""Set AOM amplitude in 'dBm' (default) or 'W'."""
self.amp.constant(value,units) self.amp.constant(value,units)
def setfreq(self,value,units=None): def setfreq(self,value,units=None):
"""Set AOM frequency in 'Hz' (default) or 'MHz'."""
self.freq.constant(value,units) self.freq.constant(value,units)
def setAMoffset(self,value,units=None):
self.AM_offset.constant(value,units) def setAMoffset(self,value):
def setFMdeviation(self,value,units=None): """Set the offset for amplitude modulation in 'dBm'."""
self.AM_offset.constant(value)
def setFMdeviation(self,value):
"""Set the deviation for frequency modulation in 'Hz'.
Parameters
----------
value : int (Hz)
The range for tuning the frequency from the set frequency with a voltage between [-10,10]V.
"""
if value not in self.parent_device.FM_deviations: if value not in self.parent_device.FM_deviations:
raise LabscriptError(f"FM devivation of {self.name} is none of the allowed values.") raise LabscriptError(f"FM devivation of {self.name} is none of the allowed values.")
self.FM_deviation.constant(value,units) self.FM_deviation.constant(value)
...@@ -59,8 +82,10 @@ class TimeBaseFreqSweepTrigger(DigitalOut): ...@@ -59,8 +82,10 @@ class TimeBaseFreqSweepTrigger(DigitalOut):
DigitalOut.__init__(self,name, parent_device, connection, inverted=False, **kwargs) DigitalOut.__init__(self,name, parent_device, connection, inverted=False, **kwargs)
self.AOM = AOM_device self.AOM = AOM_device
self.TimeBase = AOM_device.parent_device self.TimeBase = AOM_device.parent_device
# if self.AOM.FM_deviation._static_value: if self.AOM.FM_deviation._static_value:
# raise LabscriptError(f"Device {self.AOM.name} cannot have both FM and Frequency sweeps enabled.") raise LabscriptError(f"Device {self.AOM.name} cannot have both FM and Frequency sweeps enabled.")
# The settings are defined as children of the AOM_device, such that the
# instructions are found in the AOM driver's generate_code().
self.start_freq= StaticAnalogQuantity(f"{AOM_device.name}_swps", AOM_device, "-", limits=(self.TimeBase.min_freq,self.TimeBase.max_freq)) self.start_freq= StaticAnalogQuantity(f"{AOM_device.name}_swps", AOM_device, "-", limits=(self.TimeBase.min_freq,self.TimeBase.max_freq))
self.stop_freq = StaticAnalogQuantity(f"{AOM_device.name}_swpp", AOM_device, "-", limits=(self.TimeBase.min_freq,self.TimeBase.max_freq)) self.stop_freq = StaticAnalogQuantity(f"{AOM_device.name}_swpp", AOM_device, "-", limits=(self.TimeBase.min_freq,self.TimeBase.max_freq))
self.step_freq = StaticAnalogQuantity(f"{AOM_device.name}_swpf", AOM_device, "-", limits=(self.TimeBase.min_step,self.TimeBase.max_step)) self.step_freq = StaticAnalogQuantity(f"{AOM_device.name}_swpf", AOM_device, "-", limits=(self.TimeBase.min_step,self.TimeBase.max_step))
...@@ -91,9 +116,7 @@ class TimeBaseFreqSweepTrigger(DigitalOut): ...@@ -91,9 +116,7 @@ class TimeBaseFreqSweepTrigger(DigitalOut):
self.enable(t) self.enable(t)
return duration return duration
class TimeBaseAOMDriver(Device): class TimeBaseAOMDriver(Device):
...@@ -116,7 +139,7 @@ class TimeBaseAOMDriver(Device): ...@@ -116,7 +139,7 @@ class TimeBaseAOMDriver(Device):
["hostname","port","num_AOM","min_freq","max_freq","min_amp","max_amp","FM_deviations","max_step","min_step","max_sweep_time","min_sweep_time"] ["hostname","port","num_AOM","min_freq","max_freq","min_amp","max_amp","FM_deviations","max_step","min_step","max_sweep_time","min_sweep_time"]
}) })
def __init__(self, name, hostname, port=8081, num_AOM=5, **kwargs): def __init__(self, name, hostname, port=8081, num_AOM=5, **kwargs):
super().__init__(name, parent_device=None, **kwargs) super().__init__(name, parent_device=None, connection="None", **kwargs)
self.BLACS_connection = hostname self.BLACS_connection = hostname
self.num_AOM = num_AOM self.num_AOM = num_AOM
...@@ -146,6 +169,6 @@ class TimeBaseAOMDriver(Device): ...@@ -146,6 +169,6 @@ class TimeBaseAOMDriver(Device):
else: else:
AOM_group.attrs["Sfmon"] = 0 AOM_group.attrs["Sfmon"] = 0
super().generate_code(hdf5_file) # There is no need to call Device.generate_code(), because nothing is done in the TimeBaseAOM class.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment