Automated Run

class pychron.experiment.automated_run.automated_run.AutomatedRun(*args: Any, **kwargs: Any)[source]

The AutomatedRun object is used to execute automated analyses.

It mostly delegates responisbility to other objects. It provides an interface for MeasurementPyscripts. All measurement script commands have a corresponding function defined here. A commands corresponding function is defined as py_{function_name}

for example position_magnet calls AutomatedRun.py_position_magnet

data collection is handled by either MultiCollector or PeakHopCollector

persistence (saving to file and database) is handled by AutomatedRunPersister

An automated run is executed in four steps by the ExperimentExecutor.

  1. start

  2. extraction

  3. measurement

    1. equilibration

    2. post_equilibration

  4. post_measurement

equilibration and post_equilibration are executed concurrently with the measurement script this way equilibration gas can be measured.

four pyscripts (all optional) are used to program analysis execution

  1. extraction

  2. measurement

  3. post_equilibration

  4. post_measurement

four types of conditionals are available

  1. termination_conditionals

  2. truncation_conditionals

  3. action_conditionals

  4. cancelation_conditionals

cancel_run(state='canceled', do_post_equilibration=True)[source]

terminate the measurement script immediately

do post termination

post_eq and post_meas

don’t save run


value is a string in the format of $VALUE. Search for VALUE first in the options file then in the extraction scripts metadata





alias of pychron.experiment.automated_run.persistence_spec.PersistenceSpec


attr must be an attribute of arar_age

perform a specified action if teststr evaluates to true


cancel experiment if teststr evaluates to true


attr must be an attribute of arar_age

terminate run and continue experiment if teststr evaluates to true


attr must be an attribute of arar_age

truncate measurement and continue run if teststr evaluates to true default kw: attr=’’, comp=’’,start_count=50, frequency=5, abbreviated_count_ratio=1.0


set the detector each isotope add additional isotopes and associated plots if necessary


alias of pychron.experiment.automated_run.automated_run.ScriptInfo


truncate the measurement script


normal- truncate current measure iteration and continue quick- truncate current measure iteration use truncated_counts for following

measure iterations


by default overlap_evt is set after equilibration finished


class pychron.experiment.automated_run.data_collector.DataCollector(*args: Any, **kwargs: Any)[source]

Base class for Collector objects. Provides logic for iterative measurement.

class pychron.experiment.automated_run.multi_collector.MultiCollector(*args: Any, **kwargs: Any)[source]

Collector class for doing multi-collection, i.e. measuring multiple intensities simultaneously.

MulticCollector and PeakHopCollector conceptually very similar and potentially could be merged and simplified. MultiCollection is a simple case of PeakHopCollection in which only one peak hop is made at the beginning.

class pychron.experiment.automated_run.peak_hop_collector.PeakHopCollector(*args: Any, **kwargs: Any)[source]

Collector class for doing a peak hop measurement. Measure one or more intensities at given mass for ncounts then jump magnet to next new mass.



class pychron.experiment.conditional.conditional.BaseConditional(*args: Any, **kwargs: Any)[source]
check(run, data, cnt)[source]

check conditional if cnt is greater than start count cnt-start count is greater than 0 and cnt-start count is divisable by frequency

returns True if check passes. e.i. Write checks to trip on success. To terminate if Ar36 intensity is less than x use Ar36<x

  • runAutomatedRun

  • data – 2-tuple. (keys, signals) where keys==detector names, signals== measured intensities

  • cnt – int


True if check passes. e.i. Write checks to trip on success.

class pychron.experiment.conditional.conditional.AutomatedRunConditional(*args: Any, **kwargs: Any)[source]
class pychron.experiment.conditional.conditional.TruncationConditional(*args: Any, **kwargs: Any)[source]

stops the current measurement and continues to next step in pyscript. If more measure calls are main use abbreviated_count_ratio to reduce the number of counts. for example of abbreviated_count_ratio = 0.5 and the original baseline counts = 100, only 50 counts will be made for a truncated run.

class pychron.experiment.conditional.conditional.TerminationConditional(*args: Any, **kwargs: Any)[source]

Stop the current analysis immediately. Don’t save to database. Continue to next run in experiment queue

class pychron.experiment.conditional.conditional.CancelationConditional(*args: Any, **kwargs: Any)[source]

Stop the current analysis immediately then stop the experiment.

class pychron.experiment.conditional.conditional.ActionConditional(*args: Any, **kwargs: Any)[source]

Executes a specified action. The action string is executed as pyscript snippet. actions therefore may be any valid measuremnt pyscript code. for example:

# call a gosub

# open a valve

perform the specified action.

use MeasurementPyScript.execute_snippet to perform desired action


script – MeasurementPyScript