Bank

class player.Bank(bank_name=None, simulate=False)[source]

A roach bank manager class.

add_switching_state(duration, blank=False, cal=False, sig_ref_1=False)[source]

add_switching_state(duration, blank, cal, sig):

Add a description of one switching phase (backend dependent).

duration
the length of this phase in seconds,
blank
the state of the blanking signal (True = blank, False = no blank)
cal
the state of the cal signal (True = cal, False = no cal)
sig
the state of the sig_ref signal (True = ref, false = sig)

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:

be = Backend(None) # no real backend needed for example
be.clear_switching_states()
be.add_switching_state(0.01, blank = True, cal = True, sig = True)
be.add_switching_state(0.09, cal = True, sig = True)
be.add_switching_state(0.01, blank = True, cal = True)
be.add_switching_state(0.09, cal = True)
be.add_switching_state(0.01, blank = True, sig = True)
be.add_switching_state(0.09, sig = True)
be.add_switching_state(0.01, blank = True)
be.add_switching_state(0.09)
arm_roach()[source]

arm_roach(self):

Sends a sequence of commands to arm the ROACH. This is mode dependent and mode should have been specified in advance, as the sequence of commands is obtained from the ‘MODEX’ section of the configuration file.

check_shared_memory()[source]

This method creates the status shared memory segment if necessary. If the segment exists, the state of the status memory is not modified.

clear_shared_memory()[source]

This method clears the status shared memory segment if necessary.

clear_switching_states()[source]

resets/deletes the switching_states (backend dependent)

disarm_roach()[source]

disarm_roach(self):

Sends a sequence of commands to disarm the ROACH. This is mode dependent and mode should have been specified in advance, as the sequence of commands is obtained from the ‘MODEX’ section of the configuration file.

get_bank_name(config)

Dive into the config file and fetch the bank name based on the current host running this bank.

get_mode()[source]

Returns the current operating mode for the bank.

get_param(name=None)

A pass-thru method which gets the values of a backend specific parameter.

Example usage:

get_param(exposure)
get_status(keys=None)[source]

Returns the specified key’s value, or the values of several keys, or the entire contents of the shared memory status buffer.

‘keys’ == None: The entire buffer is returned, as a dictionary containing the key/value pairs.

‘keys’ is a list of keys, which are strings: returns a dictionary containing the requested subset of key/value pairs.

‘keys’ is a single string: a single value will be looked up and returned using ‘keys’ as the single key.

help_param(name=None)[source]

A pass-thru method which conveys a backend specific parameter to the modes parameter engine.

Example usage:

help_param(exposure)
increment_scan_number()[source]

Increments the current scan number

monitor(self)

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.

prepare()[source]

Perform calculations for the current set of parameter settings

read_config_file(filename)[source]

Reads the config file ‘filename’ and loads the values into data structures in memory. ‘filename’ should be a fully qualified filename. The config file contains a ‘bank’ section of interest to this bank; in addition, it contains any number of ‘MODEX’ sections, where ‘X’ is a mode name/number.

reformat_data_buffers(mode)[source]

Since the vegas and guppi HPC programs require different data buffer layouts, remove and re-create the databuffers as appropriate for the HPC program in use.

reset_roach()[source]

reset_roach(self):

Sends a sequence of commands to reset the ROACH. This is mode dependent and mode should have been specified in advance, as the sequence of commands is obtained from the ‘MODEX’ section of the configuration file.

scan_status()[source]

scan_status(self):

Returns the state of currently running scan. The return type is a tuple, backend dependent.

set_gbt_ss(period, ss_list)[source]

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:

b.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))
            )
set_mode(mode, bandwidth = None, force=False)[source]

Sets the operating mode for the roach. Does this by programming the roach.

mode:
A string; A keyword which is one of the ‘[MODEX]’ sections of the configuration file, which must have been loaded earlier.
bandwidth:
The valon bandwidth for this new mode. If not specified the last value used will be reused. If no value was ever provided the config file value will be used.
force:
A boolean flag; if ‘True’ and the new mode is the same as the current mode, the mode will be reloaded. It is set to ‘False’ by default, in which case the new mode will not be reloaded if it is already the current mode.

Returns a tuple consisting of (status, ‘msg’) where ‘status’ is a boolean, ‘True’ if the mode was loaded, ‘False’ otherwise; and ‘msg’ explains the error if any.

Example:

s, msg = f.set_mode('MODE1') s, msg =
f.set_mode(mode='MODE1', force=True)
set_param(**kvpairs)[source]

A pass-thru method which conveys a backend specific parameter to the modes parameter engine.

Example usage: set_param(exposure=x,switch_period=1.0, ...)

set_scan_number(scan_number)[source]

Sets the scan number to the value specified

set_status(self, **kwargs)[source]

Updates the values for the keys specified in the parameter list as keyword value pairs. So:

set_status(PROJID=’JUNK’, OBS_MODE=’HBW’)

would set those two parameters.

start(self, starttime = None)[source]

starttime: a datetime object representing a start time, in UTC

–OR–

starttime: a tuple or list(for ease of JSON serialization) of datetime compatible values: (year, month, day, hour, minute, second, microsecond), UTC.

Sets up the system for a measurement and kicks it off at the appropriate time, based on ‘starttime’. If ‘starttime’ is not on a PPS boundary it is bumped up to the next PPS boundary. If ‘starttime’ is not given, the earliest possible start time is used.

start() may require a needed arm delay time, which is specified in every mode section of the configuration file as ‘needed_arm_delay’. During this delay it tells the HPC program to start its net, accum and disk threads, and waits for the HPC program to report that it is receiving data. It then calculates the time it needs to sleep until just after the penultimate PPS signal. At that time it wakes up and arms the ROACH. The ROACH should then send the initial packet at that time.

If a start time is specified that cannot be met an Exception is thrown with a message stating the problem.

stop()[source]

Stops a running scan, by telling the current backend to stop.

Previous topic

Player Class Documentation

Next topic

Backend

This Page