spec
The object which connects to a SPEC session and runs macros in there. (Spec script source code)
In Pylatus Script editor the spec
object is already imported into Python interpreter, but if you
have external .py
files, then you can import it as:
from auxygen_spec import PySpec
spec = PySpec()
Important: unlike other objects, spec
does not create a sequence action but runs directly and immediately, i.e.
it changes the Pylatus script editor to a prompt, then the Python interpreter blocks until the spec command is
finished. If you need to run a spec
macro as a sequence action, consider using to_sequence
decorator.
Macros example https://git.3lp.cx/dyadkin/bm31macros/src/branch/master/spec.py
Instance methods
__init__
You can create a spec connection as:
s = spec('host:session')
Since creation of the connection is expensive and time-consuming operation, Pylatus puts them in a cache for future reuse.
run
spec('bm31spec2:experiment').run('ct 1')
Runs a spec
command immediately and blocks until it is finished. You can abort the command at any moment.