Welcome to genie_python’s documentation!

Commands

genie.abort(verbose=False, prepost=True)

Abort the current run.

Parameters:
  • verbose (bool, optional) – show the messages from the DAE

  • prepost (bool, optional) – run pre and post commands (default: True)

genie.begin(period=1, meas_id=None, meas_type='', meas_subid='', sample_id='', delayed=False, quiet=False, paused=False, verbose=False, prepost=True)

Starts a data collection run.

Parameters:
  • period (int, optional) – the period to begin data collection in

  • meas_id (string, optional) – the measurement id

  • meas_type (string, optional) – the type of measurement

  • meas_subid (string, optional) – the measurement sub-id

  • sample_id (string, optional) – the sample id

  • delayed (bool, optional) – puts the period card to into delayed start mode

  • quiet (bool, optional) – suppress the output to the screen

  • paused (bool, optional) – begin in the paused state

  • verbose (bool, optional) – show the messages from the DAE

  • prepost (bool, optional) – run pre and post commands (default: True)

Returns:

return what the begin_postcmd method returns

Return type:

Any

genie.cget(block)

Gets the useful values associated with a block.

The value will be None if the block is not “connected”.

Parameters:

block (string) – the name of the block

Returns
dict: details about about the block. Contains:

name - name of the block value - value of the block unit - physical units of the block connected - True if connected; False otherwise runcontrol - NO not in runcontrol, YES otherwise lowlimit - run control low limit set highlimit - run control high limit set alarm - the alarm status of the block

genie.change(**params)

Change experiment parameters.

Note: it is possible to change more than one item at a time.

Parameters:
  • title (string, optional) – the new title

  • period (int, optional) – the new period (must be in a non-running state)

  • nperiods (int, optional) – the new number of software periods (must be in a non-running state)

  • user (string, optional) – the new user(s) as a comma-separated list

  • rb (int, optional) – the new RB number

Examples

Change the title:

>>> change(title="The new title")

Change the user:

>>> change(user="Instrument Team")

Set multiple users:

>>> change(user="Thouless, Haldane, Kosterlitz")

Change the RB number and the users:

>>> change(rb=123456, user="Smith, Jones")
genie.change_beamline_par(name, value)

Set a new value for a beamline parameter

Parameters:
  • name (string) – the name of the parameter to change

  • value – the new value

genie.change_fermi_veto(enable=None, delay=1.0, width=1.0)

Configure the fermi chopper veto.

Parameters:
  • enable (bool, optional) – enable the fermi veto

  • delay (float, optional) – the veto delay

  • width (float, optional) – the veto width

genie.change_finish()

End a change operation.

The operation is begun when change_start is called.

Between these two calls a sequence of other change commands can be called. For example: change_tables, change_tcb etc.

genie.change_monitor(spec, low, high)

Change the monitor to a specified spectrum and range.

Parameters:
  • spec (int) – the spectrum number

  • low (float) – the low end of the integral

  • high (float) – the high end of the integral

genie.change_number_soft_periods(number, enable=False)

Sets the number of software periods for the DAE.

Parameters:
  • number (int) – the number of periods to create

  • enable (bool, optional) – switch to soft period mode

genie.change_period(period)

Changes the current period number.

Parameters:

period (int) – the period to switch to

genie.change_rb(rb)

Changes the RB number.

Parameters:

rb (int or string) – the new RB number

genie.change_sample_par(name, value)

Set a new value for a sample parameter.

Parameters:
  • name (string) – the name of the parameter to change

  • value – the new value

genie.change_script_dir(*directory)

Set the directory for loading user scripts from.

Parameters:

directory (string|List(string)) – the directory to load user scripts from, either as a single entry or as multiple arguments

Example

g.change_script_dir(r”c/scrips/mydir”) g.change_script_dir(r”c/scrips”, “mydir”)

genie.change_start()

Start a change operation.

The operation is finished when change_finish is called.

Between these two calls a sequence of other change commands can be called. For example: change_tables, change_tcb etc.

genie.change_sync(source)

Change the source the DAE using for synchronisation.

Parameters:

source (string) – the source to use (‘isis’, ‘internal’, ‘smp’, ‘muon cerenkov’, ‘muon ms’, ‘isis (first ts1)’)

genie.change_tables(wiring=None, detector=None, spectra=None)

Load the wiring, detector and/or spectra tables. Checks that the file paths are valid, throws exception if not. :param wiring: the filename of the wiring table file :type wiring: string, optional :param detector: the filename of the detector table file :type detector: string, optional :param spectra: the filename of the spectra table file :type spectra: string, optional

genie.change_tcb(low=None, high=None, step=None, trange=1, log=False, regime=1)

Change the time channel boundaries. If None is specified for low, high or step then the values are left unchanged.

Args

low (float, optional): the lower limit. Default is no change from the current value. high (float, optional): the upper limit. Default is no change from the current value. step (float,optional): the step size. Default is no change from the current value. trange (int, optional): the time range (1 to 5). Default is 1. log (bool, optional): whether to use LOG binning. Default is no. regime (int, optional): the time regime to set (1 to 6). Default is 1.

Examples

Changes the from, to and step of the 1st range to 0, 10 and 5 respectively.

>>> change_tcb(0, 10, 5)

Changes the step size of the 2nd range to 2, leaving other parameters unchanged.

>>> change_tcb(step=2, trange=2)
genie.change_tcb_file(tcbfile=None, default=False)

Change the time channel boundaries.

Parameters:
  • tcbfile (string, optional) – the file to load

  • default (bool, optional) – load the default file

genie.change_title(title)

Sets the current title.

Parameters:

title – the new title

genie.change_users(users)

Changes the users.

Parameters:

users – a string containing the user name(s)

Example

>>> change_users("Emerson, Lake, Palmer")
genie.change_vetos(**params)

Change the DAE veto settings.

Parameters:
  • clearall (bool, optional) – remove all vetos

  • smp (bool, optional) – set SMP veto

  • ts2 (bool, optional) – set TS2 veto

  • hz50 (bool, optional) – set 50 hz veto

  • ext0 (bool, optional) – set external veto 0

  • ext1 (bool, optional) – set external veto 1

  • ext2 (bool, optional) – set external veto 2

  • ext3 (bool, optional) – set external veto 3

  • fifo (bool, optional) – set FIFO veto

Note: If clearall is specified then all vetos (excluding the FIFO veto) are turned off, but it is possible to turn other vetoes back on at the same time.

Note: FIFO veto is automatically enabled on run begin, but can be changed whilst running.

Examples

Turns all vetoes off then turns the SMP veto back on:

>>> change_vetos(clearall=True, smp=True)

Turn off FIFO:

>>> change_vetos(fifo=False)
genie.check_alarms(*blocks)

Checks whether the specified blocks are in alarm.

Parameters:

blocks (string, multiple) – the block(s) to check

Returns:

the blocks in minor alarm and major alarm respectively

Return type:

list, list

Example

Check alarm state for block1 and block2:

>>> check_alarms("block1", "block2")
genie.check_limit_violations(*blocks)

Checks whether the specified blocks have soft limit violations.

Parameters:

blocks (string, multiple) – the block(s) to check

Returns:

the blocks that have soft limit violations

Return type:

list

Example

Check soft limit violations for block1 and block2:

>>> check_limit_violations("block1", "block2")
genie.configure_internal_periods(sequences=None, output_delay=None, period=None, daq=False, dwell=False, unused=False, frames=None, output=None, label=None)

Configure the internal periods without switching to internal period mode.

Parameters:
  • sequences (int, optional) – the number of times to repeat the period loop (0 = infinite loop)

  • output_delay (int, optional) – the output delay in microseconds

  • period (int, optional) – the number of the period to set the following parameters for

  • daq (bool, optional) – the specified period is a acquisition period

  • dwell (bool, optional) – the specified period is a dwell period

  • unused (bool, optional) – the specified period is a unused period

  • frames (int, optional) – the number of frames to count for the specified period

  • output (int, optional) – the binary output the specified period

  • label (string, optional) – the label for the period the specified period

Note: if the period number is unspecified then the settings will be applied to all periods

genie.connected_pvs_in_list(pv_list, is_local=False)

Check if the specified PVs are connected.

Parameters:
  • pv_list (list) – the PV names

  • is_local (bool, optional) – whether to automatically prepend the local inst prefix to the PV names

Returns:

the PV names that are connected

Return type:

list

genie.cset(*args, **kwargs)

Sets the setpoint and runcontrol settings for blocks.

Parameters:
  • runcontrol (bool, optional) – whether to set runcontrol for this block

  • wait (bool, optional) – pause execution until setpoint is reached (one block only)

  • lowlimit (float, optional) – the lower limit for runcontrol or waiting

  • highlimit (float, optional) – the upper limit for runcontrol or waiting

  • verbose (bool, optional) – report what the new block state is as a result of the command

Note: cannot use wait and runcontrol in the same command

Examples

Setting a value for a block:

>>> cset(block1=100)

Or:

>>> cset("block1", 100)

Setting values for more than one block:

>>> cset(block1=100, block2=200, block3=300)

NOTE: the order in which the values are set is random, e.g. block1 may or may not be set before block2 and block3

Setting runcontrol values for a block:

>>> cset(block1=100, runcontrol=True, lowlimit=99, highlimit=101)

Changing runcontrol settings for a block without changing the setpoint:

>>> cset("block1", runcontrol=False)
>>> cset(block1=None, runcontrol=False)

Wait for setpoint to be reached (one block only):

>>> cset(block1=100, wait=True)

Wait for limits to be reached - this does NOT change the runcontrol limits:

>>> cset(block1=100, wait=True, lowlimit=99, highlimit=101)
genie.cshow(block=None)

Show the current settings for one block or for all blocks.

Parameters:

block (string, optional) – the name of the block

Examples

Showing all block values:

>>> cshow()

Showing values for one block only (name must be quoted):

>>> cshow("block1")
genie.define_hard_period(period=None, daq=False, dwell=False, unused=False, frames=None, output=None, label=None)

Define the internal hardware periods.

Parameters:
  • period (int, optional) – the number of the period to set the following parameters for

  • daq (bool, optional) – the specified period is a acquisition period

  • dwell (bool, optional) – the specified period is a dwell period

  • unused (bool, optional) – the specified period is a unused period

  • frames (int, optional) – the number of frames to count for the specified period

  • output (int, optional) – the binary output the specified period

  • label (string, optional) – the label for the period the specified period

Note: if the period number is unspecified then the settings will be applied to all periods

genie.enable_hard_periods(mode, period_file=None, sequences=None, output_delay=None, period=None, daq=False, dwell=False, unused=False, frames=None, output=None, label=None)

Sets the DAE to use hardware periods.

Parameters:
  • mode (string) – set the mode to internal (‘int’) or external (‘ext’)

  • period_file (string, optional) – the file containing the internal period settings (ignores any other settings)

  • sequences (int, optional) – the number of times to repeat the period loop (0 = infinite loop)

  • output_delay (int, optional) – the output delay in microseconds

  • period (int, optional) – the number of the period to set the following parameters for

  • daq (bool, optional) – the specified period is a acquisition period

  • dwell (bool, optional) – the specified period is a dwell period

  • unused (bool, optional) – the specified period is a unused period

  • frames (int, optional) – the number of frames to count for the specified period

  • output (int, optional) – the binary output the specified period

  • label (string, optional) – the label for the period the specified period

Note: if the period number is unspecified then the settings will be applied to all periods

Examples

Setting external periods:

>>> enable_hard_periods('ext')

Setting internal periods from a file:

>>> enable_hard_periods('int', 'c:\myperiods.txt')
genie.enable_soft_periods(nperiods=None)

Switch the DAE to software periods mode.

Parameters:

nperiods (int, optional) – the number of software periods

genie.end(verbose=False, quiet=False, immediate=False, prepost=True)

End the current run.

Parameters:
  • verbose (bool, optional) – show the messages from the DAE

  • quiet (bool, optional) – suppress the end_precmd output to the screen

  • immediate (bool, optional) – end immediately, without waiting for a period sequence to complete

  • prepost (bool, optional) – run pre and post commands (default: True)

genie.get_beamline_pars()

Get the current beamline parameter values.

Returns:

the beamline parameters

Return type:

dict

genie.get_block_units(block_name)

Get the physical measurement units associated with a block name.

Parameters:

block_name – name of the block

Returns

string: units of the block

genie.get_blocks()

Get the names of the blocks.

Returns:

the blocknames

Return type:

list

genie.get_dae_simulation_mode()

Gets the DAE simulation mode. :returns: True if the DAE is in simulation mode, False otherwise.

genie.get_dashboard()

Get the current experiment values.

Returns:

the experiment values

Return type:

dict

genie.get_detector_table()

Gets the current detector table path”

Returns:

The file path of the current detector table.

genie.get_detector_tables()

Gets a list of possible detector table choices.

Returns:

the files

Return type:

list

genie.get_display_title()

Returns the current display title status.

Returns:

the display title status

Return type:

boolean

genie.get_events()

Gets the total events for all the detectors.

Returns:

the number of events

Return type:

int

genie.get_frames(period=False)

Gets the current number of good frames.

Parameters:

period (bool, optional) – whether to return the value for the current period only

Returns:

the number of frames

Return type:

int

genie.get_mevents()

Gets the total millions of events for all the detectors.

Returns:

the number of millions of events

Return type:

float

genie.get_number_periods()

Get the number of software periods.

Returns:

the number of periods

Return type:

int

genie.get_period()

Gets the current period number.

Returns:

the current period

Return type:

int

genie.get_period_files()

Gets a list of possible period file choices.

Returns:

the files

Return type:

list

genie.get_pv(name, to_string=False, is_local=False)

Get the value for the specified PV.

Parameters:
  • name (string) – the name of the PV to get the value for

  • to_string (bool, optional) – whether to get the value as a string

  • is_local (bool, optional) – whether to automatically prepend the local inst prefix to the PV name

Returns:

the current PV value

genie.get_raw_frames(period=False)

Gets the current number of raw frames.

Parameters:

period (bool, optional) – whether to return the value for the current period only

Returns:

the number of raw frames

Return type:

int

genie.get_rb()

Returns the current RB number.

Returns:

the RB number

Return type:

string

genie.get_runnumber()

Get the current run-number.

Returns:

the run-number

Return type:

string

genie.get_runstate()

Get the current status of the instrument as a string.

Note: this value can take a few seconds to update after a change of state.

Returns:

the current run state

Return type:

string

genie.get_sample_pars()

Get the current sample parameter values.

Returns:

the sample parameters

Return type:

dict

genie.get_script_dir()

Get the current script directory.

Returns:

the directory

Return type:

string

genie.get_spectra_table()

Gets the current spectra table path”

Returns:

The file path of the current spectra table.

genie.get_spectra_tables()

Gets a list of possible spectra table choices.

Returns:

the files

Return type:

list

genie.get_spectrum(spectrum, period=1, dist=True)

Get the specified spectrum from the DAE.

Parameters:
  • spectrum (int) – the spectrum number

  • period (int, optional) – the period

  • dist (bool, optional) – whether to get the spectrum as a distribution. Default is True.

Returns:

dictionary of values

Return type:

dict

genie.get_tcb_settings(trange, regime=1)

Gets a dictionary of the time channel settings.

Parameters:
  • trange (int) – the time range to read (1 to 5)

  • regime (int, optional) – the regime to read (1 to 6). Default is 1.

Returns:

the low, high and step for the supplied range and regime

Return type:

dict

Examples

Get the step size for the 2nd range in the 3rd regime:

>>> get_tcb_settings(2, 3)["Steps"]

Get the step size for the 2nd range in the 3rd regime:

>>> get_tcb_settings(2, 3)["Steps"]
genie.get_time_since_begin(get_timedelta=False)

Gets the time since start of the current run in seconds or in datetime

Parameters:

get_timedelta (bool) – If true return the value as a datetime object, otherwise return seconds (defaults to false)

Returns

integer: the time since start in seconds if get_datetime is False timedelta: the time since begin as a datetime.timedelta object (Year-Month-Day Hour:Minute:Second) if get_datetime is True

genie.get_title()

Returns the current title.

Returns:

the title

Return type:

string

genie.get_totalcounts()

Get the total counts for the current run.

Returns:

the total counts

Return type:

int

genie.get_uamps(period=False)

Get the current number of micro-amp hours.

Parameters:

period (bool, optional) – whether to return the value for the current period only

Returns:

the number of uamps

Return type:

float

genie.get_users()

Get the users.

Returns:

the users.

Return type:

str

genie.get_version()

Tells you the version of genie_python that is used.

Returns:

The current version number of genie python

Return type:

string

genie.get_wiring_table()

Gets the current wiring table path”

Returns:

The file path of the current wiring table.

genie.get_wiring_tables()

Gets a list of possible wiring table choices.

Returns:

the files

Return type:

list

genie.integrate_spectrum(spectrum, period=1, t_min=None, t_max=None)

Integrates the spectrum within the time period and returns neutron counts.

The underlying algorithm sums the counts from each bin, if a bin is split by the time region then a proportional

fraction of the count for that bin is used.

Parameters:
  • spectrum (int) – the spectrum number

  • period (int, optional) – the period

  • t_min (float, optional) – time of flight to start from

  • t_max (float, optional) – time of flight to finish at

Returns:

integral of the spectrum (neutron counts); None spectrum can not be read

Return type:

float

genie.load(name)

Informs the user that load may not be the function they want. Prints a message telling the user about g.loadscript and numpy.load.

Parameters:

name (string) – The script the user is trying to load.

genie.load_script(name, check_script=True, warnings_as_error=False)

Loads a user script.

Parameters:
  • name (string) – the name of the file to load. If this is not a full path the file is assumed to be in C:scripts

  • check_script – When True run the script checker on the script; False otherwise (default True)

  • warnings_as_error – When true throw an exception on a warning; False otherwise (default False)

genie.pause(verbose=False, immediate=False, prepost=True)

Pause the current run.

Parameters:
  • verbose (bool, optional) – show the messages from the DAE

  • immediate (bool, optional) – pause immediately, without waiting for a period sequence to complete

  • prepost (bool, optional) – run pre and post commands (default: True)

genie.plot_spectrum(spectrum, period=1, dist=True)

Get the specified spectrum from the DAE and plot it. Returns the plot that was created.

Note: this will replace any other plots which are open.

Parameters:
  • spectrum (int) – the spectrum number

  • period (int, optional) – the period. Default is 1

  • dist (bool, optional) – whether to get the spectrum as a distribution. Default is True

Returns:

The created plot

genie.prefix_pv_name(name)

Prepends the instrument PV prefix on to the supplied PV name

Parameters:

name (string) – The PV without the prefix.

Returns:

The PV with the instrument prefix prepended

Return type:

string

genie.recover(verbose=False)

Recovers the run if it has been aborted. The command should be run before the next run is started.

Note: the run will be recovered in the paused state.

Parameters:

verbose (bool, optional) – show the messages from the DAE

genie.reload_current_config()

Reload the current configuration.

genie.resume(verbose=False, prepost=True)

Resume the current run after it has been paused.

Parameters:
  • verbose (bool, optional) – show the messages from the DAE

  • prepost (bool, optional) – run pre and post commands (default: True)

genie.send_alert(message, inst=None)

Sends an alert message for the specified instrument.

Parameters:
  • message (string) – the message to send

  • inst (string, optional) – the instrument to generate the alert for. Defaults to current instrument.

genie.send_email(address, message)

Sends a message to an email address.

Parameters:
  • address (string) – the email address to use

  • message (string) – the message to send

genie.send_sms(phone_num, message)

Sends an SMS message to a phone number. If you are sending to messages to the same number often consider using g.alerts.send()

Parameters:
  • phone_num (string) – the phone number to send the SMS to

  • message (string) – the message to send

genie.set_dae_simulation_mode(mode, skip_required_runstates=False)

Sets the DAE into simulation mode. :param mode: True to set the DAE into simulated mode, False to set the DAE into non-simulated (hardware) mode :param skip_required_runstates: Ignore all checks, use with caution

genie.set_display_title(display_title)

Sets the current display title status.

Parameters:

display_title – the new display title status

genie.set_instrument(pv_prefix, import_instrument_init=True)

Sets the instrument this session is communicating with. Used for remote access - do not delete.

Parameters:
  • pv_prefix (string) – the PV prefix

  • import_instrument_init (bool) – if True import the instrument init from the config area; otherwise don’t

genie.set_pv(name, value, wait=False, is_local=False)

Set the value for the specified PV.

Parameters:
  • name (string) – the PV name

  • value – the new value to set

  • wait (bool, optional) – whether to wait until the value has been received by the hardware

  • is_local (bool, optional) – whether to automatically prepend the local inst prefix to the PV name

genie.snapshot_crpt(filename='c:\\Data\\snapshot_crpt.tmp', verbose=False)

Create a snapshot of the current data.

Parameters:
  • filename (string, optional) – where to write the data file(s)

  • verbose (bool, optional) – show the messages from the DAE

Examples

Snapshot to a file called my_snapshot:

>>> snapshot_crpt("c:\Data\my_snapshot")
genie.store(verbose=False)

Data loaded into memory by a previous update command is now written to disk.

Parameters:

verbose (bool, optional) – show the messages from the DAE

genie.update(pause_run=True, verbose=False)

Data is loaded from the DAE into the computer memory, but is not written to disk.

Parameters:
  • pause_run (bool, optional) – whether to pause data collection first [optional]

  • verbose (bool, optional) – show the messages from the DAE

genie.updatestore(verbose=False)

Performs an update and a store operation in a combined operation. This is more efficient than doing the commands separately.

Parameters:

verbose (bool, optional) – show the messages from the DAE

genie.waitfor(block=None, value=None, lowlimit=None, highlimit=None, maxwait=None, wait_all=False, seconds=None, minutes=None, hours=None, time=None, frames=None, raw_frames=None, uamps=None, mevents=None, early_exit=<function <lambda>>, quiet=False, **pars)

Interrupts execution until certain conditions are met.

Parameters:
  • block (string, optional) – the name of the block to wait for

  • value (float, optional) – the block value to wait for

  • lowlimit (float, optional) – wait for the block to be >= this value (numeric only)

  • highlimit (float, optional) – wait for the block to be <= this value (numeric only)

  • maxwait (float, optional) – wait no longer that the specified number of seconds

  • wait_all (bool, optional) – wait for all conditions to be met (e.g. a number of frames and an amount of uamps)

  • seconds (float, optional) – wait for a specified number of seconds

  • minutes (float, optional) – wait for a specified number of minutes

  • hours (float, optional) – wait for a specified number of hours

  • time (string, optional) – a quicker way of setting hours, minutes and seconds (must be of format “HH:MM:SS”)

  • frames (int, optional) – wait for a total number of good frames to be collected

  • raw_frames (int, optional) – wait for a total number of raw frames to be collected

  • uamps (float, optional) – wait for a total number of uamps to be received

  • mevents (float, optional) – wait for a total number of millions of events to be collected

  • early_exit (lambda, optional) – stop waiting if the function evaluates to True

  • quiet (bool, optional) – suppress normal output messages to the console

Examples

Wait for a block to reach a specific value:

>>> waitfor(myblock=123)
>>> waitfor("myblock", 123)
>>> waitfor("myblock", True)
>>> waitfor("myblock", "OPEN")

Wait for a block to be between limits:

>>> waitfor("myblock", lowlimit=100, highlimit=110)

Wait for a block to reach a specific value, but no longer than 60 seconds:

>>> waitfor(myblock=123, maxwait=60)

Wait for a specified time interval:

>>> waitfor(seconds=10)
>>> waitfor(hours=1, minutes=30, seconds=15)
>>> waitfor(time="1:30:15")

Wait for a data collection condition:

>>> waitfor(frames=5000)
>>> waitfor(uamps=200)

Wait for either a number of frames OR a time interval to occur:

>>> waitfor(frames=5000, hours=2)

Wait for a number of frames AND a time interval to occur:

>>> waitfor(frames=5000, hours=2, wait_all=True)

Wait for either the block to reach a value or a condition to be met:

>>> waitfor(myblock=123, early_exit=lambda: some_function(cget("another_block")["value"]) > 123)
genie.waitfor_block(block, value=None, lowlimit=None, highlimit=None, maxwait=None, early_exit=<function <lambda>>, quiet=False)

Interrupts execution until block reaches specific value

Parameters:
  • block – the name of the block to wait for

  • value – the target block value

  • lowlimit – waits for the block to be >= this value (numeric only)

  • highlimit – waits for the block to be <= this value (numeric only)

  • maxwait – wait no longer that the specified number of seconds

  • early_exit – stop waiting if the exception evaluates to True

  • quiet (bool, optional) – suppress normal output messages to the console

Examples

>>> waitfor_block("myblock", value=123)
>>> waitfor_block("myblock", value=True, maxwait=15)
>>> waitfor_block("myblock", lowlimit=100, highlimit=110)
>>> waitfor_block("myblock", highlimit=1.0, maxwait=60)
>>> waitfor_block("myblock", value=123, early_exit=lambda: cget("myblock_limit_reached")["value"] != 0)
genie.waitfor_frames(frames, quiet=False)

Interrupts execution to wait for number of total good frames to reach parameter value

Parameters:
  • frames (int) – the number of frames to wait for

  • quiet (bool, optional) – suppress normal output messages to the console

Example

>>> waitfor_frames(4000)
genie.waitfor_mevents(mevents, quiet=False)

Interrupts execution to wait for number of millions of events to reach parameter value

Parameters:
  • mevents (float) – the number of millions of events to wait for

  • quiet (bool, optional) – suppress normal output messages to the console

Example

>>> waitfor_mevents(0.0004)
genie.waitfor_move(*blocks, **kwargs)

Wait for all motion or specific motion to complete.

If block names are supplied then it will only wait for those to stop moving. Otherwise, it will wait for all motion to stop.

Parameters:
  • blocks (string, multiple, optional) – the names of specific blocks to wait for

  • start_timeout (int, optional) – the number of seconds to wait for the movement to begin (default = 2 seconds)

  • move_timeout (int, optional) – the maximum number of seconds to wait for motion to stop

Examples

Wait for all motors to stop moving:

>>> waitfor_move()

Wait for all motors to stop moving with a timeout of 30 seconds:

>>> waitfor_move(move_timeout=30)

Wait for only slit1 and slit2 motors to stop moving:

>>> waitfor_move("slit1", "slit2")
genie.waitfor_raw_frames(raw_frames, quiet=False)

Interrupts execution to wait for number of total raw frames to reach parameter value

Parameters:
  • frames (raw) – the number of raw frames to wait for

  • quiet (bool, optional) – suppress normal output messages to the console

Example

>>> waitfor_raw_frames(4000)
genie.waitfor_runstate(state, maxwaitsecs=3600, onexit=False)

Wait for a particular instrument run state.

Parameters:
  • state (string) – the state to wait for (e.g. “paused”)

  • maxwaitsecs (int, optional) – the maximum time to wait for the state before carrying on

  • onexit (bool, optional) – wait for runstate to change from the specified state

  • quiet (bool, optional) – suppress normal output messages to the console

Examples

Wait for a run to enter the paused state:

>>> waitfor_runstate("paused")

Wait for a run to exit the paused state:

>>> waitfor_runstate("paused", onexit=True)
genie.waitfor_time(seconds=None, minutes=None, hours=None, time=None, quiet=False)

Interrupts execution for a specified amount of time

Parameters:
  • seconds (float, optional) – wait for a specified number of seconds

  • minutes (float, optional) – wait for a specified number of minutes

  • hours (float, optional) – wait for a specified number of hours

  • time (string, optional) – a quicker way of setting hours, minutes and seconds (must be of format “HH:MM:SS”)

  • quiet (bool, optional) – suppress normal output messages to the console

Examples

>>> waitfor_time(seconds=10)
>>> waitfor_time(hours=1, minutes=30, seconds=15)
>>> waitfor_time(time="1:30:15")
genie.waitfor_uamps(uamps, quiet=False)

Interrupts execution to wait for a specific total charge

Parameters:
  • uamps – the charge to wait for

  • quiet (bool, optional) – suppress normal output messages to the console

Example

>>> waitfor_uamps(115.5)

Genie Advanced module:

This module is used for advanced commands that are for expert users.

genie_advanced.get_exp_data(rb='%', user='%', role='%', verbose=False)

Returns the data of experiments that match the given criteria, or all if none is given, from the exp_data database. If verbose is enabled, only pretty-print the data.

Parameters:
  • rb (int, optional) – The RB number of the experiment to look for, Defaults to Any.

  • user (str, optional) – The name of the user who is running/has run the experiment, Defaults to Any.

  • role (str, optional) – The user role, Defaults to Any.

  • verbose (bool, optional) – Pretty-print the data, Defaults to False.

Returns:

The experiment(s) data as a list of dicts.

Return type:

exp_data (list)

Raises:

NotFoundError – Thrown if a parameter’s value was not found in the database.

genie_advanced.get_instrument()

Gets the name of the local instrument (e.g. NDW1234, DEMO, EMMA-A)

Returns:

the name of the local instrument

genie_advanced.get_pv_from_block(block)

Get the full PV name for a given block. This is an advanced function because of the need to use the pv name correctly.

Parameters:

block (str) – A block object

Returns:

The pv name as a string

Return type:

pv_name (Str)

genie_advanced.open_plot_window(is_primary=True, host=None, figures=None)

Open the plot window in a locally running client (even if this is called in a standalone genie_python) :param is_primary: True to open primary plotting window; False open secondaty window :param host: host to open plot from; Default None is localhost :param figures: List of figures to open; Default opens all figures

genie_advanced.pv_exists(pv, is_local=False)

Check if PV exists.

Params:

pv (str): The address of the PV is_local (bool, optional): is it a local PV i.e. needs prefix adding

genie_advanced.set_abort_postcmd(abort_postcmd)

Set the function to call after the abort command.

Parameters:

abort_postcmd (function) – The function to call.

genie_advanced.set_abort_precmd(abort_precmd)

Set the function to call before the abort command.

Parameters:

abort_precmd (function) – The function to call.

genie_advanced.set_begin_postcmd(begin_postcmd)

Set the function to call after the begin command.

Parameters:

begin_postcmd (function) – The function to call.

genie_advanced.set_begin_precmd(begin_precmd)

Set the function to call before the begin command.

Parameters:

begin_precmd (function) – The function to call (which should return None if it wants the run to start, or a string with the reason why not to start run).

genie_advanced.set_dae_message_verbosity(verbose)

Set the verbosity of messages coming from the DAE.

Parameters:

verbose (bool) – set the verbosity, True to be more verbose

genie_advanced.set_end_postcmd(end_postcmd)

Set the function to call after the end command.

Parameters:

end_postcmd (function) – The function to call.

genie_advanced.set_end_precmd(end_precmd)

Set the function to call before the end command.

Parameters:

end_precmd (function) – The function to call.

genie_advanced.set_pause_postcmd(pause_postcmd)

Set the function to call after the pause command.

Parameters:

pause_postcmd (function) – The function to call.

genie_advanced.set_pause_precmd(pause_precmd)

Set the function to call before the pause command.

Parameters:

pause_precmd (function) – The function to call.

genie_advanced.set_resume_postcmd(resume_postcmd)

Set the function to call after the resume command.

Parameters:

resume_postcmd (function) – The function to call.

genie_advanced.set_resume_precmd(resume_precmd)

Set the function to call before the resume command.

Parameters:

resume_precmd (function) – The function to call.

genie_advanced.wait_for_pv(pv, value, maxwait=None)

Wait until a PV has reached a given value.

Params:

pv (str): The address of the PV value: The value to wait for maxwait (int, optional): The maximum time to wait for in seconds