Pyscript API - NMGRL/pychron GitHub Wiki
Below are all the available functions that may be used within a PyScript. Python builtins are also available and additional modules may be imported similar to any normal python script.
abort()Abort the current script. :return:
acquire(name=None, clear=False)acquire_grain_polygon_blob()autofocus(set_zoom=True)begin_heating_interval(
duration,
min_rise_rate=None,
check_time=60,
check_delay=60,
check_period=1,
temperature=None,
timeout=300,
tol=10,
name=None,
calc_time=False
)begin_interval(duration, name=None, calc_time=False)Args:
-
duration(float,int): Duration of interval in seconds -
name(str, optional): Optional name of this interval. Useful for logging
Returns: None
cancel(**kw)Cancel the current script
:return:
check_reached_setpoint()close(name=None, description='', cancel_on_failed_actuation=True, ntries=100)complete_interval()delay(duration=0, message=None, calc_time=False)disable()drop_sample(position='')dump_sample()enable()end_extract()execute_pattern(pattern='', block=True, duration=None)exit()extract(power='', units='', block=None)extract_pipette(identifier='', timeout=300)this is an atomic command. use the apis_controller config file to define the isolation procedures.
fire_laser()get_cryo_temp(value=1)get_device(name)get_manometer_pressure(idx=0)get_pressure(controller, gauge)get_resource_value(name=None)get_value(name)grain_polygon()_m_info(message=None)interval(dur):type dur: float, int
is_closed(name=None, description='')is_open(name=None, description='')lighting(value=75)load_and_execute_lascon_script(scriptnumber, block=True)load_pipette(identifier, timeout=300)this is a non blocking command. it simply sends a command to apis to start one of its runscripts.
it is the ExtractionPyScripts responsiblity to handle the waiting. use the waitfor command to wait for signals from apis.
lock(name=None, description='')move_to_position(position='', autocenter=True, block=True)_m_open(name=None, description='', cancel_on_failed_actuation=True, ntries=100)pause(delay=2)power_map(cx, cy, padding, bd, power)prepare()ramp(start=0, setpoint=0, duration=0, rate=0, period=1)release(name=None)safe_while(func, timeout=60, period=1, calc_time=False)set_cryo(value, device_name=None, block=False, delay=1)Set the cryotrap to setpoint value in degrees K.
Args:
-
value(float,int): Setpoint in degrees K -
block(bool,float,int, optional): IfTruecommand is blocking, i.e. the command will not return until setpoint reached. Ifblockis a number than block untilblock>abs(current_temp-setpoint) -
delay(float,int): Delay in seconds between each check to determine if blocking is complete.
set_intensity_scalar(v)set_light(value='')set_motor(name='', value='')set_motor_lock(name='', value='')set_pid_parameters(v)set_resource(name=None, value=1)set_response_recorder_period(p)set_tray(tray='')set_x(value, velocity='')set_xy(value, velocity='')set_y(value, velocity='')set_z(value, velocity='')sleep(duration=0, message=None, calc_time=False)snapshot(name='', prefix='', view_snapshot=False, pic_format='.jpg')if name not specified use RID_Position e.g 12345-01A_3
start_cryo_recorder()start_grain_polygon()start_response_recorder()start_video_recording(name='video')stop_cryo_recorder()stop_grain_polygon()stop_response_recorder()stop_video_recording(save_db=True)store_manometer_pressure(idx=0)unlock(name=None, description='')video_recording(name='video')wait(name=None, criterion=0)waitfor(
func_or_tuple,
start_message='',
end_message='',
check_period=1,
timeout=0,
func_kw=None
)tuple format: (device_name, function_name, comparison, ...) addition tuple elements are passed to function_name
comparison :
x<10 10<x<20
callable can of form func() or func(ti) or func(ti, i) where ti is the current relative time (relative to start of waitfor) and i is a counter
:param func_or_tuple: wait for function to return True :type func_or_tuple: callable, tuple :param start_message: Message to display at start :type start_message: str :param end_message: Message to display at end :type end_message: str :param check_period: Delay between checks in seconds :type check_period: int, float :param timeout: Cancel waiting after timeout seconds :type timeout: int, float
wake()warmup(block=False)Below are all the "contextual" values availiable to a PyScript. These contextual values are typically set by the Experiment Editor and used when running an Automated Analysis
Type: str
Type: NoneType
Type: int
Type: int
Type: int
Type: int
Type: str
Type: str
Type: int
Type: int
Type: str
Type: str
Type: str
Type: str
Type: int
Type: int
Type: int
Type: int
Type: str
Type: str