Skip to content

Instantly share code, notes, and snippets.

@reszelaz
reszelaz / cycle_reference_enumeration.py
Created July 15, 2021 21:18
Demonstrate cycle reference creation when final enumeration over a generator yields a bound method.
"""
When line
yield {"hook": normal_hook}
is commented:
> In hook()
> After run_macro
> In Macro.__del__()
> In CTScan.__del__()
When line
@reszelaz
reszelaz / no_plot_until_end_of_cell.ipynb
Last active October 28, 2020 22:53
Notebook demonstrating data streaming with bokeh plots. Unfortunally I have not managed to make it show the plot before the cell finishes execution.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reszelaz
reszelaz / sardana_change_tangodb.py
Last active October 4, 2021 14:04
Script for changing Tango database in Sardana persistent information.
"""Changes the following persistent information:
Pool:
- MeasurementGroup's Configuration attribute
- MeasurementGroup's Moveable attribute
- MeasurementGroup's elements property
- IcePAP Motor's EncoderSource attribute
- TangoAttribute of TangoAttribute controllers
- TaurusAttribute of TaurusAttirubteCounterTimer controller
MacroServer:
- PreScanSnapshot
@reszelaz
reszelaz / pymca5.1.3-py3
Created July 29, 2019 09:47
Exception raised when opening showscan in Sardana spock with Python 3 and PyMCA 5.1.3 (default version on Debian 9). Fixed in PyMca 5.5.
```
Door_demo2_1 [25]: showscan
Trying to open local scan file /tmp/demo1.h5...
AttributeError: 'str' object has no attribute 'decode'
(For more detailed information type: python_error)
Door_demo2_1 [26]: python_error
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-25-47bb900506ec> in <module>()
@reszelaz
reszelaz / sardanatestsiote_win10_jul19.txt
Created June 25, 2019 16:20
Output of sardanatestsuite executed on Windows 10 for Jul19 release
TESTSUITE OUTPUT:
Microsoft Windows [Version 10.0.16299.19]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\IEUser>sardanatestsuite
MainThread WARNING 2019-06-25 08:22:03,137 TaurusRootLogger: C:\Python27\lib\site-packages\sardana\test\testsuite.py:39: DeprecationWarning: taurus.external.unittest is deprecated since 4.3.2. Use unittest instead
from taurus.external import unittest
MainThread WARNING 2019-06-25 08:22:03,170 TaurusRootLogger: C:\Python27\lib\site-packages\sardana\test\testsuite.py:93: DeprecationWarning: taurus.external.argparse is deprecated since 4.3.2. Use argparse instead
@reszelaz
reszelaz / sardana_plugin_inventory.py
Last active August 1, 2022 10:15
Simple script to interrogate sardana servers to extract info about 3rd party plugins (macros or controllers)
import json
import os.path
import collections
try:
import argparse
except ImportError:
from taurus.external import argparse
import taurus
from sardana.macroserver.macroserver import MacroServer, MacroManager
from sardana.spock.ipython_01_00.genutils import expose_magic
from sardana.spock.spockms import split_macro_parameters
def on_ElementsChanged(value):
print("from on_ElementsChanged: value =", value)
elements = value["new"]
for elem_name, elem_info in elements.items():
if "MacroCode" in elem_info["interfaces"]:
@reszelaz
reszelaz / sardana-jan19-suse121-testsuite
Last active March 1, 2019 16:44
sardana-jan19-suse121-testsuite
sicilia@ct64suse121:~> PYTHONPATH=.local/lib/python2.7/site-packages/:$PYTHONPATH PATH=.local/bin:$PATH .local/bin/sardanatestsuite
MainThread INFO 2019-03-01 17:23:36,326 ModuleManager: (re)loading module basetypes...
MainThread INFO 2019-03-01 17:23:36,328 ModuleManager: (re)loading module basetypes...
MainThread INFO 2019-03-01 17:23:36,349 ModuleManager: (re)loading module basetypes...
MainThread INFO 2019-03-01 17:23:36,351 ModuleManager: (re)loading module basetypes...
test_acquisition (sardana.pool.test.test_poolcountertimer.PoolCounterTimerTestCase) ... MainThread INFO 2019-03-01 17:23:37,268 ModuleManager: (re)loading module DummyTriggerGateController...
MainThread INFO 2019-03-01 17:23:37,268 ModuleManager: (re)loading module DummyTriggerGateController...
MainThread INFO 2019-03-01 17:23:37,272 ModuleManager: (re)loading module DummyZeroDController...
MainThread INFO 2019-03-01 17:23:37,273 ModuleManager: (re)loading module DummyZeroDCo
Door_demo2_1 [3]: ascan mot01 0 10 10 0.1
Operation will be saved in /tmp/demo1.h5 (HDF5::NXscan)
Operation will be saved in /tmp/demo1.dat (Spec)
Scan #17 started at Thu Aug 9 17:09:18 2018. It will take at least 0:00:04.822854
sys
tg_test
1
#Pt No mot01 ct01 ct02 ct03 ct04 double_scalar dt
mot01
0.0000
@reszelaz
reszelaz / sardana-jul18-win10-testsuite
Created August 8, 2018 17:09
Sardana testsuite run on Windows 10 output from Jul18 release
Microsoft Windows [Version 10.0.16299.19]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\IEUser>sardanatestsuite
MainThread WARNING 2018-08-08 09:44:33,503 TaurusRootLogger: C:\Python27\lib\site-packages\sardana\test\testsuite.py:39: DeprecationWarning: taurus.external.unittest is deprecated since 4.3.2. Use unittest instead
from taurus.external import unittest
MainThread WARNING 2018-08-08 09:44:33,506 TaurusRootLogger: C:\Python27\lib\site-packages\sardana\test\testsuite.py:93: DeprecationWarning: taurus.external.argparse is deprecated since 4.3.2. Use argparse instead
from taurus.external import argparse