-
Notifications
You must be signed in to change notification settings - Fork 27
PyScript
Any pyscript placed in your scripts\procedures
directory will be executable from the Procedures
menu. Procedures are usefully for learning pyscripts, debugging your valve sequences, and for running convenient valve sequences such as loading an "air" into the mass spectrometer.
Automated runs are a collections of 4 pyscripts. Automated Runs
are constructed and grouped into Experiments
using the Experiment Editor
. Making experiments is covered in a later section, for now we will focus making the 4 individual pyscripts and understanding each ones role.
extraction
measurement
post_equilibration
post_measurement
Note Each pyscript is optional, but at least one pyscript is required. For example, if you want to do a lower temperature degas of your samples in an automated way but without analyzing the gas, set measurement
to ---
.
The following is a more detailed discussion on how to construct extraction and measurement pyscripts.
extraction
, post_equilibration
and post_measurement
are Extraction PyScripts. These scripts have access to valves, extraction devices (furnaces, laser systems, cryogenic traps), and any other device activated in pychron.
You can accomplish almost everything you need for extraction with open
, close
, sleep
and info
.
def main():
info('this is an example extraction script')
n = 5
vname = 'V1'
for i in range(n):
open(vname)
sleep(3)
close(vname)
sleep(3)
info(f'cycling valve {vname} {n} times complete')
Keep in mind that pyscripts are python scripts so you can use functions to make your scripts more readable, reusable.
def main():
# load a triple air shot
for i in range(3):
load_air_shot()
def load_air_shot():
# load air into pipette
close('outer')
open('inner')
sleep(10)
close('inner')
# expand
open('outer')
sleep(10)
❗A very useful attribute accessible in an extraction pyscript is
analysis_type
. This can be used to make one extraction script for bothblank
andsample
analyses.
def main():
if analysis_type=='blank':
sleep(duration)
else:
info('begin interval')
extract(extract_value, extract_units)
sleep(duration)
end_extract()
disable()
# do cleanup
sleep(cleanup)
❗Very useful attributes accessible in an extraction pyscript are
position
,extract_value
,duration
andcleanup
. All of these values are set for each run in the Experiment Editor
def main():
for pi in positions:
move_to_position(pi)
extract(extract_value, duration)
sleep(cleanup)
⚠️ position
is always a list even if only one value is specified in the experiment.