.. _sardana-howto-troubleshooting: ============================== Troubleshooting and quick tips ============================== This page collects short answers to recurring questions, with pointers to the canonical documentation pages. How to call procedures (macros)? -------------------------------- The central idea of the Sardana system is to execute procedures (macros) centrally. The execution can be started from either: * :ref:`sardana-spock` - a command line interface with commands very similar to SPEC_. * A :term:`GUI` - Taurus provides :ref:`generic widgets for macro execution `. * Your own applications - the :term:`API` to execute macros from Python code is documented in :mod:`sardana.taurus.core.tango.sardana` and from PyQt code in :mod:`sardana.taurus.qt.qtcore.tango.sardana`. How to write procedures (macros)? --------------------------------- User written procedures (macros) are central to the Sardana system. See the :ref:`Writing macros ` guide, which also explains how to document your macros. The complete macro :term:`API` can be found in the :ref:`macro API reference `. How to write scan procedures? ----------------------------- A very common type of procedure is the *scan* where some quantity is varied while recording some other quantities. See the documentation on the :ref:`scan framework `. How to adapt Sardana to your own hardware? ------------------------------------------ Sardana is meant to be interfaced to all types of different hardware with all types of control systems. For every new hardware item the specific behavior has to be programmed by writing a controller. First check the `Sardana plugins catalogue `_ - there is a high chance somebody already wrote it. If not, see the :ref:`Writing controllers ` guides. .. _faq_how_to_access_tango_from_macros_and_controllers: How to access Tango from within macros or controllers? ------------------------------------------------------- In your macros and controllers almost certainly you will need to access Tango devices (including Sardana elements) to read or write their attributes, execute commands, etc. There exist different ways of accessing them: Sardana, Taurus or PyTango :term:`API`. See more on which to choose in these chapters: * :ref:`sardana-macro-accessing-tango` * :ref:`sardana-controller-accessing-tango` How to add your own file format? -------------------------------- Scan data storage is delegated to *recorders*. To support a new file format (or any other data destination) write a custom recorder - see :ref:`sardana-writing-recorders`. How to access EPICS from Sardana? --------------------------------- Hardware integrated in EPICS_ can be directly accessed from Sardana via a controller. The controller can talk to the EPICS_ server using the Python EPICS_ interface or the Taurus_ interface to EPICS_. The ``TaurusCounterTimerController`` class is distributed with Sardana and allows the connection to any EPICS_ attribute giving the EPICS_ address as TaurusAttribute. Which controller type should I choose for hardware that does not fit any specific type? ---------------------------------------------------------------------------------------- Sardana controllers can be used for implementing some features that in principle do not fit with any kind of controller. In order to choose a controller class for the implementation, it is important to take into account some differences in the behaviour of the different type of controllers during a scan. The main differences between CT, ZeroD and OneD/TwoD are: 1. The ZeroDController class is neither Startable nor Loadable, so the exposure time can not be given to the controller and no action can be performed at the start of the scan. CounterTimerController/OneDController/TwoDController classes are Startable and Loadable. 2. The output value of ZeroD and CT is continuously read during the scan (functions PreReadAll/PreReadOne/ReadAll/ReadOne of the controllers classes of these types are continuously called). OneD/TwoD read the value only at the end of the acquisition time. Slow actions (like readout of images or spectra for further calculations) in the readout functions of ZeroD and CT can affect considerably the scan performance. .. _SPEC: http://www.certif.com/ .. _Taurus: http://taurus-scada.org/ .. _EPICS: http://www.aps.anl.gov/epics/