This is only required on your first use.

  • Ensure you have Pip, then install Pytac and Cothread:

    $ pip install pytac
    $ pip install cothread
    $ # Cothread is required for EPICS functionality, but Pytac can run without it.


This is required each time you want to start up Pytac.

  • Navigate to your Pytac directory and start Python:

    $ cd <directory-path>
    $ python
    Python 2.7.3 (default, Nov  9 2013, 21:59:00)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
  • Import Pytac and initialise the lattice from the VMX directory:

    >>> import pytac.load_csv
    >>> lattice = pytac.load_csv.load('VMX')

The lattice object is used for interacting with elements of the accelerator.

Get the value of the ‘b1’ field of the quad elements

  • Get all Quadrupole elements and print their ‘b1’ field read back values:

    >>> quads = lattice.get_elements('QUAD')
    >>> for quad in quads:
    >>>    print(quad.get_value('b1', pytac.RB))
  • Print the QUAD read back values of the ‘b1’ field using the lattice. This is more efficient since it uses only one request to the control system:

    >>> lattice.get_values('QUAD', 'b1', pytac.RB)


For an introduction to pytac concepts and finding your way around, an interactive tutorial is available using Jupyter Notebook. Take a look in the jupyter directory - the README.rst there describes how to access the tutorial.