Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation amendments #70

Merged
merged 8 commits into from
Aug 2, 2018
2 changes: 1 addition & 1 deletion docs/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This is required each time you want to start up pytac.
>>>


- Import pytac and initialise the ``VMX`` ring mode::
- Import pytac and initialise the lattice from the ``VMX`` directory::

>>> import pytac.load_csv
>>> lattice = pytac.load_csv.load('VMX')
Expand Down
8 changes: 4 additions & 4 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ This is required each time you want to start up pytac.
>>>


- Import pytac and initialise the ``VMX`` ring mode::
- 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.

Print BPM pv names along with s position
Print BPM PV names along with s position
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Get all elements that represent BPMs::
- Get all elements that represent ``BPM`` s::

>>> bpms = lattice.get_elements('BPM')

Expand Down Expand Up @@ -85,7 +85,7 @@ Get the value of the 'b1' field of the quad elements
...


- Print the quad read back values of the b1 field using the lattice. This is more efficient
- 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)
Expand Down
14 changes: 7 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
Python Toolkit for Accelerator Controls
=======================================

Python Toolkit for Accelerator Controls (Pytac) is a Python library for working with elements of particle accelerators.
Python Toolkit for Accelerator Controls (Pytac) is a Python library for working with elements of particle accelerators, developed at Diamond Light Source.

It is hosted on Github at https://github.com/willrogers/pytac.

Two pieces of software influenced its design:

* Matlab Middlelayer, used widely by accelerator physicists
* APHLA, high-level applications written in Python by the NSLS-II accelerator physics group
* Matlab Middlelayer, used widely by accelerator physicists.
* APHLA, high-level applications written in Python by the NSLS-II accelerator physics group.


Overview
========

Pytac provides a Python library ``pytac`` that makes it easier to communicate with machine hardware for online applications. Although it currently works with EPICS, it should be possible to adapt to support other control systems.
Pytac provides a Python library, ``pytac``, that makes it easier to communicate with machine hardware for online applications. Although it currently works with EPICS, it should be possible to adapt to support other control systems.

The design is based around a ``Lattice`` object that contains a sequence of ``Element`` s. Each element represents a physical component in the accelerator, such as an electromagnet, drift, or BPM. Each element may have zero or more 'fields', each representing a parameter of the component that may change e.g. a BPM element has fields 'x' and 'y' that represent the beam position, and a quadrupole magnet has 'b1' that represents the quadrupolar magnetic field. Each field has one ``Device`` object for monitoring and control purposes, these devices contain the necessary information to get and set parameter data using the control system.

Elements may be grouped into families (an element may be in more than one family), and requested from the lattice object in those families. Some methods take 'handle' inputs, handles specify whether the request made to the IOC pv is a get (read back-'pytac.RB') or set (set point-'pytac.SP') request.
Elements may be grouped into families (an element may be in more than one family), and requested from the lattice object in those families. The current control system integrates with EPICS and uses EPICS PV (process variable) objects to tell EPICS which IOC (input/output controller) to communicate with. The type of the PV specifies which operations can be performed, there are two types of PV: readback, which can only be used to retrieve data; and setpoint, which can be used to set a value as well as for retrieving data. A single component may have both types; and so some methods take 'handle' as an argument, this is to tell the control system which PV to use when interfacing with EPICS, readback ('pytac.RB') or setpoint ('pytac.SP').

Data may be requested in ``ENG`` or ``PHYS`` units and will be converted as appropriate. Two types of unit conversion are available: Polynomial (often used for linear conversion) and Piecewise Cubic Hermite Interpolating Polynomial (Pchip; often used for magnet data where field may not be linear with current). In the case that measurement data (used to set up the conversion objects) is not in the same units as the physical models, further functions may be given to these objects to complete the conversion correctly.
Data may be requested or sent in engineering (``ENG``) or physics (``PHYS``) units and will be converted as appropriate. This conversion is a fundamental part of how pytac integrates with the physical accelerator, as physics units are what our description of the accelerator works with (e.g. the magnetic field inside a magnet) and engineering units are what the IOCs on the physical components use (e.g. the current in a magnet). Two types of unit conversion are available: Polynomial (``PolyUnitConv``; often used for linear conversion) and Piecewise Cubic Hermite Interpolating Polynomial (``PchipUnitConv``; often used for magnet data where field may not be linear with current). In the case that measurement data (used to set up the conversion objects) is not in the same units as the physical models, further functions may be given to these objects to complete the conversion correctly.

Machines are defined using a set of ``.csv`` files, located by default in the ``pytac/data`` directory.
Models of accelerators, physical or simulated, are defined using a set of ``.csv`` files, located by default in the ``pytac/data`` directory. Each model should be saved in its own directory i.e. different models of the same accelerator should be seperate, just as models of different accelerators would be.


Contents:
Expand Down