sardana-nxsrecorder 3.30.0__py3-none-any.whl → 3.31.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sardana_nxsrecorder-3.30.0.dist-info → sardana_nxsrecorder-3.31.0.dist-info}/METADATA +5 -4
- sardana_nxsrecorder-3.31.0.dist-info/RECORD +6 -0
- sardananxsrecorder/__init__.py +1 -1
- sardananxsrecorder/nxsrecorder.py +152 -33
- sardana_nxsrecorder-3.30.0.dist-info/RECORD +0 -6
- {sardana_nxsrecorder-3.30.0.dist-info → sardana_nxsrecorder-3.31.0.dist-info}/WHEEL +0 -0
- {sardana_nxsrecorder-3.30.0.dist-info → sardana_nxsrecorder-3.31.0.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sardana-nxsrecorder
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.31.0
|
|
4
4
|
Summary: NeXus Sardana Scan Recorder
|
|
5
5
|
Home-page: https://github.com/nexdatas/sardana-nxs-filerecorder/
|
|
6
6
|
Author: Jan Kotanski
|
|
@@ -87,21 +87,22 @@ defining the package location, e.g.
|
|
|
87
87
|
Debian packages
|
|
88
88
|
"""""""""""""""
|
|
89
89
|
|
|
90
|
-
Debian Bookworm, Bullseye
|
|
90
|
+
Debian Trixie, Bookworm, Bullseye and Ubuntu Questing, Noble Jammy packages can be found in the HDRI repository.
|
|
91
91
|
|
|
92
92
|
To install the debian packages, add the PGP repository key
|
|
93
93
|
|
|
94
94
|
.. code-block:: console
|
|
95
95
|
|
|
96
96
|
$ sudo su
|
|
97
|
-
$
|
|
97
|
+
$ curl -s http://repos.pni-hdri.de/debian_repo.pub.gpg | gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/debian-hdri-repo.gpg --import
|
|
98
|
+
$ chmod 644 /etc/apt/trusted.gpg.d/debian-hdri-repo.gpg
|
|
98
99
|
|
|
99
100
|
and then download the corresponding source list
|
|
100
101
|
|
|
101
102
|
.. code-block:: console
|
|
102
103
|
|
|
103
104
|
$ cd /etc/apt/sources.list.d
|
|
104
|
-
$ wget http://repos.pni-hdri.de/
|
|
105
|
+
$ wget http://repos.pni-hdri.de/trixie-pni-hdri.sources
|
|
105
106
|
|
|
106
107
|
|
|
107
108
|
Finally, for python2.7
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
sardananxsrecorder/__init__.py,sha256=GgJQbb7Mf0ShhuhsJbq443ks6XofF4HKFmzYHxikBAg,896
|
|
2
|
+
sardananxsrecorder/nxsrecorder.py,sha256=BRwQmLSkS6mpj19u5uog6V1e3uUc3IWKeddtysuZo40,67472
|
|
3
|
+
sardana_nxsrecorder-3.31.0.dist-info/METADATA,sha256=_4xnp4oP9-ji-6ucQwrvUj_vrUEwWQEGl_Py1oekaXY,8256
|
|
4
|
+
sardana_nxsrecorder-3.31.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
5
|
+
sardana_nxsrecorder-3.31.0.dist-info/top_level.txt,sha256=YdD3m417i-jlYyQWgiizgZ8lQQcOjM8y-bmUHrGkfY4,19
|
|
6
|
+
sardana_nxsrecorder-3.31.0.dist-info/RECORD,,
|
sardananxsrecorder/__init__.py
CHANGED
|
@@ -99,6 +99,7 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
99
99
|
:type macro: :class:`sardana.macroserver.macro.Macro`
|
|
100
100
|
"""
|
|
101
101
|
BaseFileRecorder.__init__(self)
|
|
102
|
+
self.debug('__init__: Init NXS_FileRecorder: %s' % str(filename))
|
|
102
103
|
#: (:obj:`str`) base filename
|
|
103
104
|
self.__base_filename = filename
|
|
104
105
|
#: (:obj:`str`) raw filename
|
|
@@ -116,7 +117,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
116
117
|
self.__nexussettings_device = None
|
|
117
118
|
|
|
118
119
|
#: (:obj:`int`) device proxy timeout
|
|
119
|
-
self.__timeout = 100000
|
|
120
|
+
# self.__timeout = 100000
|
|
121
|
+
self.__timeout = 10000000
|
|
120
122
|
#: (:obj:`dict` <:obj:`str`, :obj:`list` <:obj:`str`>
|
|
121
123
|
#: or :obj:`dict` <:obj:`str` , `any`> > ) Custom variables
|
|
122
124
|
self.__vars = {"data": {},
|
|
@@ -167,13 +169,17 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
167
169
|
#: (:obj:`bool`) external measurement group
|
|
168
170
|
self.__oddmntgrp = False
|
|
169
171
|
|
|
172
|
+
self.debug('__init__: Set NeXus: %s' % str(filename))
|
|
170
173
|
self.__setNexusDevices(onlyconfig=True)
|
|
171
174
|
|
|
175
|
+
self.debug('__init__: Set Append Entry: %s' % str(filename))
|
|
172
176
|
appendentry = self.__getConfVar("AppendEntry", True)
|
|
173
177
|
scanID = self.__env["ScanID"] \
|
|
174
178
|
if "ScanID" in self.__env.keys() else -1
|
|
179
|
+
self.debug('__init__: Set FileName: %s' % str(filename))
|
|
175
180
|
self.__setFileName(
|
|
176
181
|
self.__base_filename, not appendentry, scanID)
|
|
182
|
+
self.debug('__init__: Done: %s' % str(filename))
|
|
177
183
|
|
|
178
184
|
def _serial(self, scanID):
|
|
179
185
|
serial = None
|
|
@@ -411,7 +417,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
411
417
|
subs = False
|
|
412
418
|
if not self.__raw_filename:
|
|
413
419
|
self.__raw_filename = self.__rawfilename(self.__serial)
|
|
414
|
-
self.debug('
|
|
420
|
+
self.debug('__setFileName: '
|
|
421
|
+
'Raw Filename: %s' % str(self.__raw_filename))
|
|
415
422
|
if not subs and self.__raw_filename and \
|
|
416
423
|
"{ScanID" in self.__raw_filename:
|
|
417
424
|
try:
|
|
@@ -453,6 +460,9 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
453
460
|
profile configuration of NXSRecSelector
|
|
454
461
|
:type onlyconfig: :obj:`bool`
|
|
455
462
|
"""
|
|
463
|
+
self.debug(
|
|
464
|
+
'__setNexusDevices: NXSRecSelector: %s'
|
|
465
|
+
% str(self.__raw_filename))
|
|
456
466
|
vl = self.__getEnvVar("NeXusSelectorDevice", None)
|
|
457
467
|
if vl is None:
|
|
458
468
|
servers = self.__db.get_device_exported_for_class(
|
|
@@ -474,6 +484,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
474
484
|
"Cannot connect to '%s'" % servers[0])
|
|
475
485
|
else:
|
|
476
486
|
self.__nexussettings_device = None
|
|
487
|
+
self.debug('__setNexusDevices: import profile: %s'
|
|
488
|
+
% str(self.__raw_filename))
|
|
477
489
|
if self.__nexussettings_device is None:
|
|
478
490
|
from nxsrecconfig import Settings
|
|
479
491
|
self.__nexussettings_device = Settings.Settings()
|
|
@@ -483,10 +495,13 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
483
495
|
raise Exception("NXSRecSelector (%s) version below 2.0.0" %
|
|
484
496
|
(servers[0] if servers else "module"))
|
|
485
497
|
|
|
498
|
+
self.debug('__setNexusDevices: set MG: %s' % str(self.__raw_filename))
|
|
486
499
|
mntgrp = self.__getServerVar("mntGrp", None)
|
|
487
500
|
amntgrp = self.__getEnvVar("ActiveMntGrp", None)
|
|
488
501
|
if mntgrp and amntgrp != mntgrp:
|
|
489
502
|
self.__nexussettings_device.mntgrp = amntgrp
|
|
503
|
+
self.debug('__setNexusDevices: list profile: %s'
|
|
504
|
+
% str(self.__raw_filename))
|
|
490
505
|
if amntgrp not in self.__command(
|
|
491
506
|
self.__nexussettings_device, "availableProfiles"):
|
|
492
507
|
if onlyconfig:
|
|
@@ -507,15 +522,29 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
507
522
|
self.info(
|
|
508
523
|
"NXS_FileRecorer: descriptive components will be reset")
|
|
509
524
|
else:
|
|
525
|
+
self.debug('__setNexusDevices: fetch profile: %s'
|
|
526
|
+
% str(self.__raw_filename))
|
|
510
527
|
self.__command(self.__nexussettings_device, "fetchProfile")
|
|
528
|
+
self.debug('__setNexusDevices: reset profile: %s'
|
|
529
|
+
% str(self.__raw_filename))
|
|
511
530
|
self.__asynchcommand(self.__nexussettings_device,
|
|
512
531
|
"resetPreselectedComponents")
|
|
532
|
+
self.debug('__setNexusDevices: reset profile Done: %s'
|
|
533
|
+
% str(self.__raw_filename))
|
|
513
534
|
self.__oddmntgrp = True
|
|
514
535
|
else:
|
|
536
|
+
self.debug('__setNexusDevices: '
|
|
537
|
+
'fetch profile 2: %s' % str(self.__raw_filename))
|
|
515
538
|
self.__command(self.__nexussettings_device, "fetchProfile")
|
|
539
|
+
self.debug('__setNexusDevices: fetch profile 2 Done: %s' %
|
|
540
|
+
str(self.__raw_filename))
|
|
516
541
|
self.__vars["vars"]["measurement_group"] = amntgrp
|
|
517
542
|
|
|
543
|
+
self.debug('__setNexusDevices: '
|
|
544
|
+
'profile config: %s' % str(self.__raw_filename))
|
|
518
545
|
self.__conf = self.__getServerVar("profileConfiguration", {}, True)
|
|
546
|
+
self.debug('__setNexusDevices: '
|
|
547
|
+
'MG config: %s' % str(self.__raw_filename))
|
|
519
548
|
if not self.__oddmntgrp and not onlyconfig:
|
|
520
549
|
if "MntGrpConfiguration" in self.__conf.keys():
|
|
521
550
|
poolmg = self.__command(
|
|
@@ -525,9 +554,9 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
525
554
|
poolmg = None
|
|
526
555
|
profmg = None
|
|
527
556
|
if not poolmg or not profmg or poolmg != profmg:
|
|
528
|
-
self.debug(
|
|
529
|
-
|
|
530
|
-
|
|
557
|
+
self.debug("__setNexusDevices: "
|
|
558
|
+
"ActiveMntGrp created outside NXSRecSelector v3. "
|
|
559
|
+
"Updating ActiveMntGrp")
|
|
531
560
|
if self.__macro:
|
|
532
561
|
self.__macro().debug(
|
|
533
562
|
"ActiveMntGrp created outside NXSRecSelector v3. "
|
|
@@ -535,6 +564,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
535
564
|
self.__command(self.__nexussettings_device, "importMntGrp")
|
|
536
565
|
self.__command(self.__nexussettings_device, "updateMntGrp")
|
|
537
566
|
|
|
567
|
+
self.debug('__setNexusDevices: '
|
|
568
|
+
'Writer Device: %s' % str(self.__raw_filename))
|
|
538
569
|
if not onlyconfig:
|
|
539
570
|
vl = self.__getConfVar("WriterDevice", None)
|
|
540
571
|
if not vl:
|
|
@@ -560,6 +591,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
560
591
|
else:
|
|
561
592
|
self.__nexuswriter_device = None
|
|
562
593
|
|
|
594
|
+
self.debug('__setNexusDevices: Writer Device Properties: %s'
|
|
595
|
+
% str(self.__raw_filename))
|
|
563
596
|
if self.__nexuswriter_device is None:
|
|
564
597
|
from nxswriter import TangoDataWriter
|
|
565
598
|
self.__nexuswriter_device = TangoDataWriter.TangoDataWriter()
|
|
@@ -575,6 +608,7 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
575
608
|
for ky, vl in properties.items():
|
|
576
609
|
if hasattr(self.__nexuswriter_device, ky):
|
|
577
610
|
setattr(self.__nexuswriter_device, ky, vl)
|
|
611
|
+
self.debug('__setNexusDevices: End: %s' % str(self.__raw_filename))
|
|
578
612
|
|
|
579
613
|
def __get_alias(self, name):
|
|
580
614
|
""" provides a device alias
|
|
@@ -669,9 +703,9 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
669
703
|
:param nexuscomponents: nexus component list
|
|
670
704
|
:type nexuscomponents: :obj:`list` <:obj:`str`>
|
|
671
705
|
"""
|
|
672
|
-
self.debug("Step DSs: %s" % dss)
|
|
673
|
-
self.debug("Init DSs: %s" % keys)
|
|
674
|
-
self.debug("Init User Data: %s" % udata)
|
|
706
|
+
self.debug("__createDynamicComponent: Step DSs: %s" % dss)
|
|
707
|
+
self.debug("__createDynamicComponent: Init DSs: %s" % keys)
|
|
708
|
+
self.debug("__createDynamicComponent: Init User Data: %s" % udata)
|
|
675
709
|
envRec = self.recordlist.getEnviron()
|
|
676
710
|
lddict = []
|
|
677
711
|
tdss = [ds for ds in dss if not ds.startswith("tango://")
|
|
@@ -718,12 +752,13 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
718
752
|
if fld and att:
|
|
719
753
|
if fld in fields.keys():
|
|
720
754
|
fields[fld][att] = vl
|
|
721
|
-
else:
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
755
|
+
# else:
|
|
756
|
+
# fields[fld] = {
|
|
757
|
+
# "name": fld,
|
|
758
|
+
# "strategy": "INIT",
|
|
759
|
+
# "dtype": "string",
|
|
760
|
+
# "shape": tuple(),
|
|
761
|
+
# att: vl}
|
|
727
762
|
|
|
728
763
|
for mdd in fields.values():
|
|
729
764
|
lddict.append(mdd)
|
|
@@ -732,9 +767,12 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
732
767
|
jddict = json.dumps(lddict, cls=NXS_FileRecorder.numpyEncoder)
|
|
733
768
|
jdss = json.dumps(tdss, cls=NXS_FileRecorder.numpyEncoder)
|
|
734
769
|
jkeys = json.dumps(keys, cls=NXS_FileRecorder.numpyEncoder)
|
|
735
|
-
self.debug("
|
|
736
|
-
|
|
737
|
-
self.debug("
|
|
770
|
+
self.debug("__createDynamicComponent: "
|
|
771
|
+
"tango STEP datasources: %s" % tdss)
|
|
772
|
+
self.debug("__createDynamicComponent: "
|
|
773
|
+
"sardana STEP datasources: %s" % jddict)
|
|
774
|
+
self.debug("__createDynamicComponent: "
|
|
775
|
+
"INIT datasources: %s" % jkeys)
|
|
738
776
|
self.__dynamicCP = \
|
|
739
777
|
self.__command(self.__nexussettings_device,
|
|
740
778
|
"createDynamicComponent",
|
|
@@ -778,6 +816,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
778
816
|
:rtype: (`list` <:obj:`str`>, `list` <:obj:`str`>,
|
|
779
817
|
`list` <:obj:`str`>, `list` <:obj:`str`>)
|
|
780
818
|
"""
|
|
819
|
+
self.debug("__searchDataSources: Init: %s"
|
|
820
|
+
% str([nexuscomponents, cfm, dyncp, userkeys]))
|
|
781
821
|
dsFound = {}
|
|
782
822
|
dsNotFound = []
|
|
783
823
|
|
|
@@ -793,6 +833,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
793
833
|
else:
|
|
794
834
|
cmps = list(set(nexuscomponents) &
|
|
795
835
|
set(self.__availableComponents()))
|
|
836
|
+
self.debug("__searchDataSources: Get selected DSs: %s"
|
|
837
|
+
% str([cfm, dyncp]))
|
|
796
838
|
if self.__oddmntgrp:
|
|
797
839
|
nds = []
|
|
798
840
|
else:
|
|
@@ -800,8 +842,17 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
800
842
|
"selectedDataSources")
|
|
801
843
|
nds = nds if nds else []
|
|
802
844
|
datasources = list(set(nds) | set(self.__deviceAliases.keys()))
|
|
845
|
+
self.debug("__searchDataSources: Get components DSs: %s"
|
|
846
|
+
% str([cfm, dyncp]))
|
|
803
847
|
hascpsrcs = hasattr(self.__nexussettings_device, 'componentSources')
|
|
848
|
+
# aacpdss = json.loads(
|
|
849
|
+
# self.__command(self.__nexussettings_device,
|
|
850
|
+
# "componentSources",
|
|
851
|
+
# cmps))
|
|
852
|
+
self.debug("__searchDataSources: component loop: %s"
|
|
853
|
+
% str([cfm, dyncp]))
|
|
804
854
|
for cp in cmps:
|
|
855
|
+
self.debug("__searchDataSources: component item: %s" % cp)
|
|
805
856
|
try:
|
|
806
857
|
if hascpsrcs:
|
|
807
858
|
cpdss = json.loads(
|
|
@@ -833,28 +884,38 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
833
884
|
"Component '%s' wrongly defined in DB!" % cp)
|
|
834
885
|
# self.__macro().warning("Error: '%s'" % str(e))
|
|
835
886
|
else:
|
|
836
|
-
self.debug(
|
|
887
|
+
self.debug(
|
|
888
|
+
"__searchDataSources: "
|
|
889
|
+
"Component '%s' wrongly defined in DB!" % cp)
|
|
837
890
|
self.warning("Error: '%s'" % str(e))
|
|
838
891
|
if self.__macro:
|
|
839
892
|
self.__macro().debug(
|
|
893
|
+
"__searchDataSources: "
|
|
840
894
|
"Component '%s' wrongly defined in DB!" % cp)
|
|
841
895
|
self.__macro.debug("Error: '%s'" % str(e))
|
|
842
896
|
dss = []
|
|
843
897
|
if dss:
|
|
844
898
|
cdss = list(set(dss) & set(datasources))
|
|
845
899
|
for ds in cdss:
|
|
846
|
-
self.debug("'%s' found in '%s'"
|
|
900
|
+
self.debug("__searchDataSources: '%s' found in '%s'"
|
|
901
|
+
% (ds, cp))
|
|
847
902
|
if ds not in dsFound.keys():
|
|
848
903
|
dsFound[ds] = []
|
|
849
904
|
dsFound[ds].append(cp)
|
|
850
905
|
if cp not in cpReq.keys():
|
|
851
906
|
cpReq[cp] = []
|
|
852
907
|
cpReq[cp].append(ds)
|
|
908
|
+
self.debug("__searchDataSources: "
|
|
909
|
+
"component loop end: %s" % str([cfm, dyncp]))
|
|
853
910
|
missingKeys = set(userkeys) - keyFound
|
|
854
911
|
|
|
912
|
+
self.debug("__searchDataSources: "
|
|
913
|
+
"dynamic component loop: %s" % str([cfm, dyncp]))
|
|
855
914
|
datasources.extend(self.__dynamicDataSources.keys())
|
|
856
915
|
#: get not found datasources
|
|
857
916
|
for ds in datasources:
|
|
917
|
+
self.debug("__searchDataSources: "
|
|
918
|
+
" dynamic component item: %s" % ds)
|
|
858
919
|
if ds not in dsFound.keys() and ds not in allcpdss:
|
|
859
920
|
dsNotFound.append(ds)
|
|
860
921
|
if not dyncp:
|
|
@@ -883,6 +944,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
883
944
|
"It was not found in User Components!"
|
|
884
945
|
" Consider setting: "
|
|
885
946
|
"NeXusDynamicComponents=True" % ds)
|
|
947
|
+
self.debug("__searchDataSources: "
|
|
948
|
+
"dynamic component loop end: %s" % str([cfm, dyncp]))
|
|
886
949
|
return (nds, dsNotFound, cpReq, list(missingKeys))
|
|
887
950
|
|
|
888
951
|
def __createConfiguration(self, userdata):
|
|
@@ -893,14 +956,19 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
893
956
|
:returns: configuration xml string
|
|
894
957
|
:rtype: :obj:`str`
|
|
895
958
|
"""
|
|
959
|
+
self.debug("__createConfiguration: Init: %s" % self.__oddmntgrp)
|
|
896
960
|
cfm = self.__getConfVar("ComponentsFromMntGrp",
|
|
897
961
|
False, pass_default=self.__oddmntgrp)
|
|
898
962
|
dyncp = self.__getConfVar("DynamicComponents",
|
|
899
963
|
True, pass_default=self.__oddmntgrp)
|
|
900
964
|
|
|
901
965
|
envRec = self.recordlist.getEnviron()
|
|
966
|
+
self.debug("__createConfiguration: CollectAllises: %s"
|
|
967
|
+
% self.__oddmntgrp)
|
|
902
968
|
self.__collectAliases(envRec)
|
|
903
969
|
|
|
970
|
+
self.debug("__createConfiguration: Get Components: %s"
|
|
971
|
+
% self.__oddmntgrp)
|
|
904
972
|
mandatory = self.__command(self.__nexussettings_device,
|
|
905
973
|
"mandatoryComponents")
|
|
906
974
|
self.info("Default Components %s" % str(mandatory))
|
|
@@ -912,6 +980,15 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
912
980
|
nexuscomponents.extend(lst)
|
|
913
981
|
self.info("User Components %s" % str(nexuscomponents))
|
|
914
982
|
|
|
983
|
+
ccomp = None
|
|
984
|
+
if hasattr(self.__nexussettings_device, "cachecomponent"):
|
|
985
|
+
ccomp = self.__nexussettings_device.cachecomponent
|
|
986
|
+
allnexuscomponents = list(set(nexuscomponents) | set(mandatory))
|
|
987
|
+
if ccomp:
|
|
988
|
+
self.info("Cache Component %s" % str(ccomp))
|
|
989
|
+
nexuscomponents = [ccomp]
|
|
990
|
+
allnexuscomponents = [ccomp]
|
|
991
|
+
|
|
915
992
|
self.__availableComps = []
|
|
916
993
|
lst = self.__getConfVar("OptionalComponents",
|
|
917
994
|
None, True, pass_default=self.__oddmntgrp)
|
|
@@ -922,13 +999,19 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
922
999
|
self.info("Available Components %s" % str(
|
|
923
1000
|
self.__availableComponents()))
|
|
924
1001
|
|
|
1002
|
+
self.debug("__createConfiguration: Search DataSources: %s"
|
|
1003
|
+
% self.__oddmntgrp)
|
|
925
1004
|
nds, dsNotFound, cpReq, missingKeys = self.__searchDataSources(
|
|
926
|
-
|
|
1005
|
+
allnexuscomponents,
|
|
927
1006
|
cfm, dyncp, userdata.keys())
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
self.debug("
|
|
1007
|
+
self.debug("__createConfiguration: Get User data: %s"
|
|
1008
|
+
% self.__oddmntgrp)
|
|
1009
|
+
|
|
1010
|
+
self.debug("__createConfiguration: DataSources Not Found : %s"
|
|
1011
|
+
% dsNotFound)
|
|
1012
|
+
self.debug("__createConfiguration: Components required : %s" % cpReq)
|
|
1013
|
+
self.debug("__createConfiguration: Missing User Data : %s"
|
|
1014
|
+
% missingKeys)
|
|
932
1015
|
if "InitDataSources" in self.__conf.keys():
|
|
933
1016
|
# compatibility with version 2
|
|
934
1017
|
ids = self.__getConfVar(
|
|
@@ -946,9 +1029,13 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
946
1029
|
# udata = {ky: userdata[ky] for ky in missingKeys}
|
|
947
1030
|
if userdata:
|
|
948
1031
|
userdata.update(udata)
|
|
1032
|
+
self.debug("__createConfiguration: Create dynamic components: %s"
|
|
1033
|
+
% self.__oddmntgrp)
|
|
949
1034
|
self.__createDynamicComponent(
|
|
950
1035
|
dsNotFound if dyncp else [], ids or [], udata, nexuscomponents)
|
|
951
1036
|
nexuscomponents.append(str(self.__dynamicCP))
|
|
1037
|
+
self.debug("__createConfiguration: Add Components: %s"
|
|
1038
|
+
% self.__oddmntgrp)
|
|
952
1039
|
|
|
953
1040
|
if cfm:
|
|
954
1041
|
self.info("Sardana Components %s" % cpReq.keys())
|
|
@@ -996,25 +1083,38 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
996
1083
|
if self.__macro:
|
|
997
1084
|
self.__macro().debug(
|
|
998
1085
|
"VAR %s" % self.__nexussettings_device.configVariables)
|
|
1086
|
+
self.debug("__createConfiguration: Update Config Varialels: %s"
|
|
1087
|
+
% self.__oddmntgrp)
|
|
999
1088
|
self.__command(self.__nexussettings_device,
|
|
1000
1089
|
"updateConfigVariables")
|
|
1001
1090
|
|
|
1002
|
-
self.debug("Aliases: %s"
|
|
1003
|
-
|
|
1091
|
+
self.debug("__createConfiguration: Aliases: %s"
|
|
1092
|
+
% str(self.__aliases))
|
|
1093
|
+
self.debug("__createConfiguration: Switching to STEP mode: %s"
|
|
1094
|
+
% stepdss)
|
|
1004
1095
|
oldtoswitch = self.__getServerVar("stepdatasources", "[]", False)
|
|
1005
1096
|
stepdss = str(json.dumps(list(toswitch)))
|
|
1097
|
+
self.debug("__createConfiguration: Set STEP datasources: %s"
|
|
1098
|
+
% self.__oddmntgrp)
|
|
1006
1099
|
self.__nexussettings_device.stepdatasources = stepdss
|
|
1100
|
+
self.debug("__createConfiguration: Set LINK datasources: %s"
|
|
1101
|
+
% self.__oddmntgrp)
|
|
1007
1102
|
if hasattr(self.__nexussettings_device, "linkdatasources"):
|
|
1008
1103
|
self.__nexussettings_device.linkdatasources = stepdss
|
|
1104
|
+
self.debug("__createConfiguration: "
|
|
1105
|
+
"Create Writer configuration: %s" % self.__oddmntgrp)
|
|
1009
1106
|
cnfxml = self.__command(
|
|
1010
1107
|
self.__nexussettings_device, "createWriterConfiguration",
|
|
1011
1108
|
nexuscomponents)
|
|
1012
1109
|
finally:
|
|
1110
|
+
self.debug("__createConfiguration: Reset variables: %s"
|
|
1111
|
+
% self.__oddmntgrp)
|
|
1013
1112
|
self.__nexussettings_device.configVariables = json.dumps(
|
|
1014
1113
|
nexusvariables)
|
|
1015
1114
|
if oldtoswitch is not None:
|
|
1016
1115
|
self.__nexussettings_device.stepdatasources = oldtoswitch
|
|
1017
1116
|
|
|
1117
|
+
self.debug("__createConfiguration: End: %s" % self.__oddmntgrp)
|
|
1018
1118
|
return cnfxml
|
|
1019
1119
|
|
|
1020
1120
|
def _startRecordList(self, recordlist):
|
|
@@ -1025,12 +1125,17 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
1025
1125
|
:type recordlist: :class:`sardana.macroserver.scan.scandata.RecordList`
|
|
1026
1126
|
"""
|
|
1027
1127
|
try:
|
|
1128
|
+
self.debug('_startRecordList: Start %s' % self.__base_filename)
|
|
1028
1129
|
self.__env = self.__macro().getAllEnv() if self.__macro else {}
|
|
1029
1130
|
if self.__base_filename is None:
|
|
1030
1131
|
return
|
|
1031
1132
|
self.__udata = None
|
|
1032
1133
|
|
|
1134
|
+
self.debug('_startRecordList: Set NeXus %s'
|
|
1135
|
+
% self.__base_filename)
|
|
1033
1136
|
self.__setNexusDevices()
|
|
1137
|
+
self.debug('_startRecordList: Set Variables %s'
|
|
1138
|
+
% self.__base_filename)
|
|
1034
1139
|
|
|
1035
1140
|
appendentry = self.__getConfVar("AppendEntry", True)
|
|
1036
1141
|
appendscanid = not self.__setFileName(
|
|
@@ -1056,7 +1161,11 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
1056
1161
|
self.__vars["vars"]["filename"] = str(self.filename)
|
|
1057
1162
|
|
|
1058
1163
|
envrecord = self.__appendRecord(self.__vars, 'INIT')
|
|
1164
|
+
self.debug('_startRecordList: Create Configuration %s'
|
|
1165
|
+
% self.__base_filename)
|
|
1059
1166
|
cnfxml = self.__createConfiguration(envrecord["data"])
|
|
1167
|
+
self.debug('_startRecordList: Set Remove dynamic components %s'
|
|
1168
|
+
% self.__base_filename)
|
|
1060
1169
|
rec = json.dumps(
|
|
1061
1170
|
envrecord, cls=NXS_FileRecorder.numpyEncoder)
|
|
1062
1171
|
# self.debug('XML: %s' % str(cnfxml))
|
|
@@ -1074,24 +1183,31 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
1074
1183
|
self.__vars["data"]["beamtime_id"] = \
|
|
1075
1184
|
self.__vars["vars"]["beamtime_id"]
|
|
1076
1185
|
|
|
1186
|
+
self.debug('_startRecordList: Init writer %s'
|
|
1187
|
+
% self.__base_filename)
|
|
1077
1188
|
if hasattr(self.__nexuswriter_device, 'Init'):
|
|
1078
1189
|
self.__command(self.__nexuswriter_device, "Init")
|
|
1079
1190
|
self.__nexuswriter_device.fileName = str(self.filename)
|
|
1080
1191
|
self.__command(self.__nexuswriter_device, "openFile")
|
|
1081
1192
|
self.__nexuswriter_device.xmlsettings = cnfxml
|
|
1082
1193
|
|
|
1083
|
-
|
|
1194
|
+
if "DEBUG_INIT_DATA" in self.writerModes:
|
|
1195
|
+
self.debug('_startRecordList: INIT_DATA: %s' % str(envRec))
|
|
1084
1196
|
|
|
1197
|
+
self.debug('_startRecordList: Set JSON %s' % self.__base_filename)
|
|
1085
1198
|
self.__nexuswriter_device.jsonrecord = rec
|
|
1086
1199
|
self.writerModes = self.__variableList(
|
|
1087
1200
|
"NeXusWriterModes")
|
|
1088
1201
|
if "NOINIT" in self.writerModes:
|
|
1089
1202
|
self.__nexuswriter_device.skipAcquisition = True
|
|
1090
1203
|
|
|
1204
|
+
self.debug('_startRecordList SE: Open Entry %s' %
|
|
1205
|
+
self.__base_filename)
|
|
1091
1206
|
self.__command(self.__nexuswriter_device, "openEntry")
|
|
1092
1207
|
except Exception:
|
|
1093
1208
|
self.__removeDynamicComponent()
|
|
1094
1209
|
raise
|
|
1210
|
+
self.debug('_startRecordList SE: END %s' % self.__base_filename)
|
|
1095
1211
|
|
|
1096
1212
|
def __appendRecord(self, var, mode=None):
|
|
1097
1213
|
""" merges userdata with variable dictionary
|
|
@@ -1177,9 +1293,10 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
1177
1293
|
if "NOSTEP" in self.writerModes:
|
|
1178
1294
|
self.__nexuswriter_device.skipAcquisition = True
|
|
1179
1295
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1296
|
+
if "DEBUG_STEP_DATA" in self.writerModes:
|
|
1297
|
+
self.debug('_writeRecord DATA: {"data":%s}' % json.dumps(
|
|
1298
|
+
record.data,
|
|
1299
|
+
cls=NXS_FileRecorder.numpyEncoder))
|
|
1183
1300
|
|
|
1184
1301
|
jsonString = '{"data":%s}' % json.dumps(
|
|
1185
1302
|
record.data,
|
|
@@ -1243,7 +1360,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
1243
1360
|
self.__env = self.__macro().getAllEnv() if self.__macro else {}
|
|
1244
1361
|
envRec = recordlist.getEnviron()
|
|
1245
1362
|
|
|
1246
|
-
|
|
1363
|
+
if "DEBUG_FINAL_DATA" in self.writerModes:
|
|
1364
|
+
self.debug('_endRecordList: FINAL_DATA: %s ' % str(envRec))
|
|
1247
1365
|
|
|
1248
1366
|
tzone = self.__getConfVar("TimeZone", self.__timezone)
|
|
1249
1367
|
self.__vars["data"]["end_time"] = \
|
|
@@ -1312,7 +1430,7 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
1312
1430
|
if isinstance(msvar, str):
|
|
1313
1431
|
msvar = re.split(r"[-;,.\s]\s*", msvar)
|
|
1314
1432
|
if msvar:
|
|
1315
|
-
self.debug('%s: %s' % (variable, str(msvar)))
|
|
1433
|
+
self.debug('__variableList: %s: %s' % (variable, str(msvar)))
|
|
1316
1434
|
return msvar
|
|
1317
1435
|
|
|
1318
1436
|
def __rawfilename(self, serial):
|
|
@@ -1517,7 +1635,8 @@ class NXS_FileRecorder(BaseFileRecorder):
|
|
|
1517
1635
|
(pdir, fname, entryname), rt, sname)
|
|
1518
1636
|
else:
|
|
1519
1637
|
h5writer.link("%s:/%s" % (fname, entryname), rt, sname)
|
|
1520
|
-
self.debug("
|
|
1638
|
+
self.debug("__createMeasurementFile: "
|
|
1639
|
+
"Link '%s' in '%s' created " % (sname, mntname))
|
|
1521
1640
|
rt.close()
|
|
1522
1641
|
fl.close()
|
|
1523
1642
|
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
sardananxsrecorder/__init__.py,sha256=Gi6Nc8XqKBPmq8YhG7H2-9QGIR9lmirdvd-UUbWFOZU,896
|
|
2
|
-
sardananxsrecorder/nxsrecorder.py,sha256=D2upQ6dLwZZQKPgIzUJPROAfDFYJfWBk-T-8cmNpdOU,60716
|
|
3
|
-
sardana_nxsrecorder-3.30.0.dist-info/METADATA,sha256=OyCMdsfpzFGG8CyS2iPvvE6m5vo-HMqvLFfrmnvMQBg,8116
|
|
4
|
-
sardana_nxsrecorder-3.30.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
5
|
-
sardana_nxsrecorder-3.30.0.dist-info/top_level.txt,sha256=YdD3m417i-jlYyQWgiizgZ8lQQcOjM8y-bmUHrGkfY4,19
|
|
6
|
-
sardana_nxsrecorder-3.30.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|