Skip to content

Fix PreScanSnapshot of strings

Zbigniew Reszela requested to merge github/fork/reszelaz/str_snapshot into develop

In https://github.com/sardana-org/sardana/issues/771#issuecomment-736360038 and continuation with @dschick we were talking about storing RoI configuration in PreScanSnapshot. This was already possible using spectrum attributes (I wrongly assumed that it was not working) and this PR fixes it for strings.

Door_zreszela_1 [26]: lssnap
       Snap item                                        Snap item full name
 --------------- ----------------------------------------------------------
   long_spectrum   tango://pt222.cells.es:10000/sys/tg_test/1/long_spectrum
   string_scalar   tango://pt222.cells.es:10000/sys/tg_test/1/string_scalar

Door_zreszela_1 [27]: ascan mot01 0 1 1 0.1
Operation will be saved in /tmp/scan.h5 (HDF5::NXscan from NXscanH5_FileRecorder)
Scan #16 started at Tue Jan 26 16:38:43 2021. It will take at least 0:00:00.765685
 #Pt No    mot01      ct01      ct02      ct03      ct04       dt   
   0         0        0.1       0.2       0.3       0.4     0.314397
   1         1        0.1       0.2       0.3       0.4     0.773712
Operation saved in /tmp/scan.h5 (HDF5::NXscan)
Scan #16 ended at Tue Jan 26 16:38:44 2021, taking 0:00:00.925815. Dead time 78.4% (motion dead time 65.8%)
In [27]: import h5py
In [28]: fd = h5py.File("/tmp/scan.h5")
In [29]: for k, v in fd["entry16"]["measurement"]["pre_scan_snapshot"].items():
    ...:     print(k, v.value)
long_spectrum [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
string_scalar Default string

@sardana-org/integrators could you please review it?

Merge request reports