Sardana : plot in scans and how to integrate Tango DS ?

Hi,
I am very interested by using sardana.
I have some basic questions :
- How to integrate Tango DS (motors, detectors,…) ? Do we need to develop macros for that ? Do you have some samples, or tutorials ?
- Is it possible to plot scans during the scans ? And plotting fits at the end ?
Thanks
Olivier
Hi,

> I am very interested by using sardana.

you should probably join the sardana-users mailing list. Your questions will be more likely to be noticed there:
https://lists.sourceforge.net/lists/listinfo/sardana-users


> I have some basic questions :
> - How to integrate Tango DS (motors, detectors,…) ?

They are integrated via "Sardana Controllers". Controllers already exist for many types of hardware.
Tango DS motors should be easily integrated.

> Do we need to develop macros for that ?

Not for that. Macros are "sequences of actions". Sardana has many macros already defined (more or less what you would expect if comming from a SPEC system).

> Do you have some samples, or tutorials ?

Have a look at
- http://sardana-controls.org/en/latest/docs.html
- http://sf.net/p/sardana/wiki/SardanaTraining-WorkshopBCN20130522/

> - Is it possible to plot scans during the scans ?

Yes. Using a TaurusGui connected to your Sardana system, you get that out-of-the-box.
Also, when using spock, it can be done with the expconf widget
(where you configure the scan). It has a view button that shows the plot(s) for the scan when you launch it.

> And plotting fits at the end ?

It is possible, but you to write a specific macro (basically extending a standard scan macro with the calculations that you need for the fit). I am pretty sure that others have already done something like what you need (maybe ask in the mailing list)

I hope this helps. Do not hesitate to ask in the sardana-users list if you need more help regarding sardana.

Cheers,

Carlos
Edited 7 years ago
Hi Olivier,

Just to complement what Carlos already said, there is one more way to start with Sardana if you already have a Tango control system setup.
This approach is quite limited and you won't use all the Sardana features but maybe it is more straight forward than developing a new controllers, macros.

In order to "move/scan" a Tango attribute you would just need to define elements (controller and motor(s)) of the TangoAttrMotorController [1].
See "advanced element manipulation macros" that will help you to define the elements [2].

In order to "read/acquire" a Tango attribute e.g. in a scan, you could add any Tango attribute to the measurement group. You have two ways to do it. Either use the expconf widget (in spock execute: expconf) and when adding a channel (green "+" button) select the "(Other…)" option that will open a Tango database browser, where you select the attribute that you want. Or use the "measurement configuration macros" [3] to define a new measurement group from scratch. Just remember that the measurement group will require at least one CounterTimer channel, but you could easliy use the "dummy" one created by the sar_demo macro. This example shows how to do it in spock:

Door_zreszela-sep6_1 [4]: defmeas mg07 ct13 sys/tg_test/1/float_scalar
Created mg07

Door_zreszela-sep6_1 [5]: senv ActiveMntGrp mg07
ActiveMntGrp = mg07

Door_zreszela-sep6_1 [6]: ct
Tue Jan 24 10:20:09 2017

          ct13  =         1.0
  float_scalar  =         0.0

The Tango attrubutes are read once at the end of the integration time (ct by default uses 1 second). If you are interested to sample by software the Tango attribute during the integration time and peform a software operation on the acquired buffer e.g. sum or average, you could use the TangoAttrZeroDController [4] and again just create its elements. Afterwards add the 0D channels to the measurement group. In spock this could be:

Door_zreszela-sep6_1 [14]: defctrl TangoAttrZeroDController tattr0dctrl03
Created tattr0dctrl03

Door_zreszela-sep6_1 [15]: %defelem tattr0d02 tattr0dctrl03 1
Created tattr0d02

Door_zreszela-sep6_1 [16]: defmeas mg08 ct13 tattr0d02
Created mg08

Door_zreszela-sep6_1 [17]: senv ActiveMntGrp mg08
ActiveMntGrp = mg08

Door_zreszela-sep6_1 [18]: tattr0d02.TangoAttribute = "sys/tg_test/1/double_scalar"

Door_zreszela-sep6_1 [19]: ct
Tue Jan 24 10:31:30 2017

       ct13  =         1.0
  tattr0d02  =  -255.961027807

Hope that this helps you to make the first steps with Sardana. If you have other questions or need more information, don't hesitate to contact us (I also encourage to use sardana-users mailing list).

Cheers,
Zibi

PS. In order to use the third party controllers (the ones that I just recommended you) in Sardana you will need to add a property in the Pool device called "PoolPath" that will point to the directory where the python modules with the controllers are located.

[1] https://sourceforge.net/p/sardana/controllers.git/ci/master/tree/python/motor/TangoAttrMotorCtrl.py
[2] http://www.sardana-controls.org/en/latest/users/standard_macro_catalog.html#advanced-element-manipulation-macros
[3] http://www.sardana-controls.org/en/latest/users/standard_macro_catalog.html#measurement-configuration-macros
[4] https://sourceforge.net/p/sardana/controllers.git/ci/master/tree/python/zerod/TangoAttrZeroDCtrl.py
 
Register or login to create to post a reply.