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:

How to write procedures (macros)?

User written procedures (macros) are central to the Sardana system. See the Writing macros guide, which also explains how to document your macros. The complete macro API can be found in the 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 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 Writing controllers guides.

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 API. See more on which to choose in these chapters:

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 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.