PyScripts¶
PyScripts are used to automate various processes, such as extraction of gas and measurement of isotopes.
PyScript¶
ValvePyScript¶
Ramper¶
ExtractionPyScript¶
- class pychron.pyscripts.extraction_line_pyscript.ExtractionPyScript(*args: Any, **kwargs: Any)[source]¶
The ExtractionPyScript is used to program the extraction and gettering of sample gas.
- extract_pipette(identifier='', timeout=300)[source]¶
this is an atomic command. use the apis_controller config file to define the isolation procedures.
- get_extraction_positions(clear=True)[source]¶
Returns a list of x,y,z tuples each tuple represents where the extraction occurred
if clear is True (default)
self._extraction_positions
set to an empty list- Returns
list of x,y,z tuples
- Return type
list of tuples
- get_output_blob()[source]¶
Get the extraction device’s output blob
- Returns
output blob: binary string representing time v percent output
- Return type
str
- get_response_blob()[source]¶
Get the extraction device’s response blob
- Returns
response blob. binary string representing time v measured output
- Return type
str
- get_setpoint_blob()[source]¶
Get the extraction device’s setpoint blob
- Returns
setpoint blob: binary string representing time v requested setpoint
- Return type
str
- load_pipette(identifier, timeout=300)[source]¶
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.
- output_achieved()[source]¶
Return a formated string with the extraction “heating” results:
Requested Output= 100.000 Achieved Output= 99.012
- Returns
Formatted string with results
- Return type
str
- property position¶
if position is 0 return None
- set_default_context(**kw)[source]¶
provide default values for all the properties exposed in the script
- snapshot(name='', prefix='', view_snapshot=False, pic_format='.jpg')[source]¶
if name not specified use RID_Position e.g 12345-01A_3
- waitfor(func_or_tuple, start_message='', end_message='', check_period=1, timeout=0, func_kw=None)[source]¶
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)
whereti
is the current relative time (relative to start of waitfor) andi
is a counter- Parameters
func_or_tuple (callable, tuple) – wait for function to return True
start_message (str) – Message to display at start
end_message (str) – Message to display at end
check_period (int, float) – Delay between checks in seconds
timeout (int, float) – Cancel waiting after
timeout
seconds
MeasurementPyScript¶
- class pychron.pyscripts.measurement_pyscript.MeasurementPyScript(*args: Any, **kwargs: Any)[source]¶
MeasurementPyScripts are used to collect isotopic data
- coincidence()[source]¶
Do a coincidence scan. Peak center all active detectors simulatenously. calculate required deflection corrections to bring all detectors into coincidence
- property eqtime¶
Property. Equilibration time. Get value from
AutomatedRun
.- Returns
float, int
- equilibrate(eqtime=20, inlet=None, outlet=None, do_post_equilibration=True, close_inlet=True, delay=3)[source]¶
equilibrate the extraction line with the mass spectrometer
inlet or outlet can be a single valve name or a list of valve names.
'A', ('A','B'), ['A','B'], 'A,B'
- Parameters
eqtime – int, equilibration duration in seconds
inlet – str, tuple or list, inlet valve
outlet – str, tuple or list, ion pump valve
do_post_equilibration – bool
close_inlet – bool
delay – int, delay in seconds between close of outlet and open of inlet
- generate_ic_mftable(detectors, refiso='Ar40', peak_center_config='', n=1, calc_time=False)[source]¶
Generate an IC MFTable. Use this when doing a Detector Intercalibration. peak centers the
refiso
on a list ofdetectors
. MFTable saved as ic_mftablecancel script if generating mftable fails
- Parameters
detectors (list) – list of detectors to peak center
refiso (str) – isotope to peak center
- peak_center(detector='', isotope='', integration_time=1.04, save=True, calc_time=False, directions='Increase', config_name='default')[source]¶
Calculate the peak center for
isotope
ondetector
.- Parameters
detector – str
isotope – str
integration_time – float
save – bool
- position_magnet(pos, detector='AX', use_dac=False, for_collection=True)[source]¶
- Parameters
pos (str) – location to set magnetic field
detector – detector to position
pos
use_dac (bool) – is the
pos
a DAC voltage
examples:
position_magnet(4.54312, use_dac=True) # detector is not relevant position_magnet(39.962, detector='AX') position_magnet('Ar40', detector='AX') #Ar40 will be converted to 39.962 use mole weight dict
- reset(arun)[source]¶
Reset the script with a new automated run
- Parameters
arun (
AutomatedRun
) – A newAutomatedRun
- set_fits(*fits)[source]¶
set time vs intensity regression fits for isotopes
- Parameters
fits – str, list, or tuple
- set_integration_time(v)[source]¶
Set the integration time
- Parameters
v (float) – integration time in seconds
- set_time_zero(offset=0)[source]¶
set the time_zero value. add offset to time_zero
T_o= ion pump closes offset seconds after T_o. define time_zero T_eq= inlet closes
- property time_zero_offset¶
Property. Substract
time_zero_offset
from time value for all data points- Returns
float, int
- property truncated¶
Property. True if run was truncated otherwise False
- Returns
bool
- property use_cdd_warming¶
Property. Use CDD Warming. Get value from
AutomatedRunSpec
- Returns
bool