The Dealer is a lightweight client to all the Players. It allows one script to control all the Players from one machine. The only requirement for the Dealer is the Dealer code itself, a current ZeroMQ python installation, and access to the dibas.conf configuration file.
When first run, the Dealer connects to each Player specified in dibas.conf, and dynamically obtains all the control functions exported by the Player, including KATCP and Valon functions, needed to run each Player (thus updates to the Player code will show up in the Dealer automatically). The user can then script all the Players at once, or address each one individually.
Dealer brings together all Player Bank objects in one script, allowing them to be coordinated and to operate as one instrument.
Adds the player(s) specified in in the argument list to the active list. The arguments must be strings, the names of the players:
d.add_active_player('BANKA', 'BANKB')
add_switching_state(duration, blank, cal, sig_ref_1):
Add a description of one switching phase (backend dependent).
Example to set up a 8 phase signal (4-phase if blanking is not considered) with blanking, cal, and sig/ref, total of 400 mS:
d.clear_switching_states() # Bl Cal SR1
d.add_switching_state(0.01, blank = True, cal = True, sig_ref_1 = True) # -- | |
d.add_switching_state(0.09, blank = False, cal = True, sig_ref_1 = True) # | | |
d.add_switching_state(0.01, blank = True, cal = True, sig_ref_1 = False) # -- | |
d.add_switching_state(0.09, blank = False, cal = True, sig_ref_1 = False) # | | |
d.add_switching_state(0.01, blank = True, cal = False, sig_ref_1 = True) # -- | |
d.add_switching_state(0.09, blank = False, cal = False, sig_ref_1 = True) # | | |
d.add_switching_state(0.01, blank = True, cal = False, sig_ref_1 = False) # -- | |
d.add_switching_state(0.09, blank = False, cal = False, sig_ref_1 = False) # | | |
earliest_start(self):
Returns the earliest time that all backends can be safely started. This is done by querying all the backends and selecting the furthest starttime in the future.
get_mode(self):
Returns the current mode, if all players agree. If not, returns a tuple consisting of (False, {bank:mode, bank:mode...})
Returns the value a specified parameters, or a dictionary of parameters with their values if param is None.
Returns the specified key’s value, or the values of several keys, or the entire contents of the shared memory status buffer. Which operation is performed depends on the type of keys:
Returns the help doc string for a specified parameters, or a dictionary of parameters with their doc strings if param is None.
Lists the players selected for use from the available player pool.
Lists the available players.
list_modes():
Returns a list of modes available.
monitor() requests that the DAQ program go into monitor mode. This is handy for troubleshooting issues like no data. In monitor mode the DAQ’s net thread starts receiving data but does not do anything with that data. However the thread’s status may be read in the status memory: NETSTAT will say ‘receiving’ if packets are arriving, ‘waiting’ if not.
Removes the named player(s) from the active player list. The player arguments must be strings:
d.remove_active_player('BANKA', 'BANKB')
scan_status(self):
Returns the state of currently running scan. The return type is a dictionary of tuples, backend dependent. Each dictionary key is the Player’s name.
set_gbt_ss(period, ss_list):
adds a complete GBT style switching signal description.
period: The complete period length of the switching signal. ss_list: A list of GBT phase components. Each component is a tuple: (phase_start, sig_ref, cal, blanking_time) There is one of these tuples per GBT style phase.
Example:
d.set_gbt_ss(period = 0.1,
ss_list = ((0.0, SWbits.SIG, SWbits.CALON, 0.025),
(0.25, SWbits.SIG, SWbits.CALOFF, 0.025),
(0.5, SWbits.REF, SWbits.CALON, 0.025),
(0.75, SWbits.REF, SWbits.CALOFF, 0.025))
)
Sets the operating mode for the roach. Does this by programming the roach.
Returns a dictionary of tuples, where the keys are the Player names, and the values consists of (status, ‘msg’) where ‘status’ is a boolean, ‘True’ if the mode was loaded, ‘False’ otherwise; and ‘msg’ explains the error if any.
Example:
rval = d.set_mode('MODE1')
rval = d.set_mode(mode='MODE1', force=True)
A pass-thru method which conveys a backend specific parameter to the modes parameter engine.
Example usage:
d.set_param(exposure=x,switch_period=1.0, ...)
NOTE: set_param() will set all players the same way. To set each player differently, use d (where ‘d’ is the dealer) d.players[player].set_param() for each player.
Updates the values for the keys specified in the parameter list as keyword value pairs. So:
d.set_status(PROJID='JUNK', OBS_MODE='HBW')
would set those two parameters.
is, it must have time-zone information set. As it must also be UTC. For example:
import pytz
from datetime import datetime
s = datetime.utcnow()
s = s.replace(tzinfo=pytz.utc)
NOTE: start() will abort any currently running scan and restart!