nxswriter 3.15.0__py3-none-any.whl → 3.17.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.
- nxswriter/DecoderPool.py +20 -5
- nxswriter/EVirtualField.py +31 -122
- nxswriter/Release.py +1 -1
- {nxswriter-3.15.0.dist-info → nxswriter-3.17.0.dist-info}/METADATA +4 -4
- {nxswriter-3.15.0.dist-info → nxswriter-3.17.0.dist-info}/RECORD +9 -9
- {nxswriter-3.15.0.data → nxswriter-3.17.0.data}/scripts/NXSDataWriter +0 -0
- {nxswriter-3.15.0.data → nxswriter-3.17.0.data}/scripts/nxsfromxml +0 -0
- {nxswriter-3.15.0.dist-info → nxswriter-3.17.0.dist-info}/WHEEL +0 -0
- {nxswriter-3.15.0.dist-info → nxswriter-3.17.0.dist-info}/top_level.txt +0 -0
nxswriter/DecoderPool.py
CHANGED
|
@@ -175,8 +175,10 @@ class DATAARRAYdecoder(object):
|
|
|
175
175
|
self.__value = None
|
|
176
176
|
#: ([:obj:`str`, :obj:`str`]) header and image data
|
|
177
177
|
self.__data = None
|
|
178
|
-
#: (:obj:`str`) struct header format
|
|
179
|
-
self.
|
|
178
|
+
#: (:obj:`str`) struct header format ver < 4
|
|
179
|
+
self.__headerFormat123 = '<IHHIIHHHHHHHHIIIIIIII'
|
|
180
|
+
#: (:obj:`str`) struct header format ver >=4
|
|
181
|
+
self.__headerFormat = '<IHHIIHHHHHHHHIIIIIIQQII'
|
|
180
182
|
#: (:obj:`dict` <:obj:`str`, :obj:`any` > ) header data
|
|
181
183
|
self.__header = {}
|
|
182
184
|
#: (:obj:`dict` <:obj:`int`, :obj:`str` > ) format modes
|
|
@@ -200,7 +202,7 @@ class DATAARRAYdecoder(object):
|
|
|
200
202
|
"""
|
|
201
203
|
self.__data = data
|
|
202
204
|
self.format = data[0]
|
|
203
|
-
self._loadHeader(data[1]
|
|
205
|
+
self._loadHeader(data[1])
|
|
204
206
|
self.__value = None
|
|
205
207
|
|
|
206
208
|
def _loadHeader(self, headerData):
|
|
@@ -209,7 +211,15 @@ class DATAARRAYdecoder(object):
|
|
|
209
211
|
:param headerData: buffer with header data
|
|
210
212
|
:type headerData: :obj:`str`
|
|
211
213
|
"""
|
|
212
|
-
|
|
214
|
+
try:
|
|
215
|
+
hData = headerData[:struct.calcsize(self.__headerFormat)]
|
|
216
|
+
hdr = struct.unpack(self.__headerFormat, hData)
|
|
217
|
+
if hdr[1] < 4:
|
|
218
|
+
hData = headerData[:struct.calcsize(self.__headerFormat123)]
|
|
219
|
+
hdr = struct.unpack(self.__headerFormat123, hData)
|
|
220
|
+
except Exception:
|
|
221
|
+
hData = headerData[:struct.calcsize(self.__headerFormat123)]
|
|
222
|
+
hdr = struct.unpack(self.__headerFormat123, hData)
|
|
213
223
|
self.__header = {}
|
|
214
224
|
self.__header['magic'] = hdr[0]
|
|
215
225
|
self.__header['headerVersion'] = hdr[1]
|
|
@@ -261,7 +271,12 @@ class DATAARRAYdecoder(object):
|
|
|
261
271
|
if not self.__header or not self.__data:
|
|
262
272
|
return
|
|
263
273
|
if self.__value is None:
|
|
264
|
-
|
|
274
|
+
if 'headerVersion' in self.__header and \
|
|
275
|
+
self.__header['headerVersion'] >= 4:
|
|
276
|
+
image = self.__data[1][struct.calcsize(self.__headerFormat):]
|
|
277
|
+
else:
|
|
278
|
+
image = self.__data[1][
|
|
279
|
+
struct.calcsize(self.__headerFormat123):]
|
|
265
280
|
dformat = self.__formatID[self.__header['imageMode']]
|
|
266
281
|
fSize = struct.calcsize(dformat)
|
|
267
282
|
self.__value = numpy.array(
|
nxswriter/EVirtualField.py
CHANGED
|
@@ -343,14 +343,15 @@ class EVirtualDataMap(Element):
|
|
|
343
343
|
if dt and isinstance(dt, dict):
|
|
344
344
|
dh = DataHolder(streams=self._streams, **dt)
|
|
345
345
|
val = dh.cast("string")
|
|
346
|
-
self.last.appendVmap(val, self.__vmap
|
|
346
|
+
self.last.appendVmap(val, self.__vmap,
|
|
347
|
+
self.strategy)
|
|
347
348
|
|
|
348
349
|
except Exception:
|
|
349
350
|
info = sys.exc_info()
|
|
350
351
|
import traceback
|
|
351
|
-
message =
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
message = ("Datasource not found: " +
|
|
353
|
+
str(info[1].__str__()) + "\n " + (" ").join(
|
|
354
|
+
traceback.format_tb(sys.exc_info()[2])))
|
|
354
355
|
# message = self.setMessage( sys.exc_info()[1].__str__() )
|
|
355
356
|
del info
|
|
356
357
|
#: notification of error in the run method (defined in base class)
|
|
@@ -404,6 +405,9 @@ class EVirtualField(FElementWithAttr):
|
|
|
404
405
|
self.__shape = []
|
|
405
406
|
#: (:obj:`list` <:obj:`dict` >) vmap list
|
|
406
407
|
self.__vmaps = []
|
|
408
|
+
#: (:class:`H5CppVirtualFieldLayout`) or
|
|
409
|
+
#: (:class:`H5PYVirtualFieldLayout`) virtual field layout
|
|
410
|
+
self.__vfl = None
|
|
407
411
|
|
|
408
412
|
def setRank(self, rank):
|
|
409
413
|
""" sets dimension rank
|
|
@@ -498,7 +502,10 @@ class EVirtualField(FElementWithAttr):
|
|
|
498
502
|
lval = val.split("\n")
|
|
499
503
|
for el in lval:
|
|
500
504
|
if el.strip():
|
|
501
|
-
self.
|
|
505
|
+
if self.__vfl is not None:
|
|
506
|
+
self.__vfl.append_vmap({"target": el.strip()})
|
|
507
|
+
else:
|
|
508
|
+
self.__vmaps.append({"target": el.strip()})
|
|
502
509
|
return self.strategy, self.trigger
|
|
503
510
|
|
|
504
511
|
def store(self, xml=None, globalJSON=None):
|
|
@@ -517,39 +524,14 @@ class EVirtualField(FElementWithAttr):
|
|
|
517
524
|
self.__dtype, self.__name = self.__typeAndName()
|
|
518
525
|
# shape
|
|
519
526
|
self.__shape = self.__getShape()
|
|
527
|
+
self.__vfl = FileWriter.virtual_field_layout(
|
|
528
|
+
self.__shape, self.__dtype)
|
|
529
|
+
for vmap in self.__vmaps:
|
|
530
|
+
self.__vfl.append_vmap(vmap)
|
|
531
|
+
self.__vmaps = []
|
|
520
532
|
return self.__setStrategy(self.__name)
|
|
521
533
|
|
|
522
|
-
def
|
|
523
|
-
tkey = []
|
|
524
|
-
if isinstance(key, list):
|
|
525
|
-
try:
|
|
526
|
-
sk = list(set([len(ky) for ky in key]))
|
|
527
|
-
except Exception:
|
|
528
|
-
sk = []
|
|
529
|
-
if len(sk) == 1 and sk[0] == 4:
|
|
530
|
-
offset = []
|
|
531
|
-
block = []
|
|
532
|
-
count = []
|
|
533
|
-
stride = []
|
|
534
|
-
for ky in key:
|
|
535
|
-
off, bl, cnt, std = ky
|
|
536
|
-
offset.append(off)
|
|
537
|
-
block.append(bl)
|
|
538
|
-
count.append(cnt)
|
|
539
|
-
stride.append(std)
|
|
540
|
-
return FileWriter.FTHyperslab(offset, block, count, stride)
|
|
541
|
-
for ky in key:
|
|
542
|
-
if isinstance(ky, list) and len(ky) > 0 and len(ky) < 4:
|
|
543
|
-
tkey.append(slice(*ky))
|
|
544
|
-
else:
|
|
545
|
-
if ky is None:
|
|
546
|
-
ky = slice(None)
|
|
547
|
-
tkey.append(ky)
|
|
548
|
-
|
|
549
|
-
return tuple(tkey)
|
|
550
|
-
return key
|
|
551
|
-
|
|
552
|
-
def appendVmap(self, values, base=None):
|
|
534
|
+
def appendVmap(self, values, base=None, strategy=None):
|
|
553
535
|
""" append virtual map items
|
|
554
536
|
|
|
555
537
|
:param values: a list of map items to append
|
|
@@ -588,94 +570,20 @@ class EVirtualField(FElementWithAttr):
|
|
|
588
570
|
fval.update(vl)
|
|
589
571
|
else:
|
|
590
572
|
fval.update({"target": vl.strip()})
|
|
591
|
-
self.
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
def __findShape(self, key, eshape=None, unlimited=True):
|
|
595
|
-
if isinstance(key, FileWriter.FTHyperslab):
|
|
596
|
-
if not unlimited:
|
|
597
|
-
count = [(ct if ct != FileWriter.writer.unlimited() else 1)
|
|
598
|
-
for ct in key.count]
|
|
599
|
-
|
|
600
|
-
block = [(ct if ct != FileWriter.writer.unlimited() else 1)
|
|
601
|
-
for ct in key.block]
|
|
573
|
+
if self.__vfl is not None:
|
|
574
|
+
self.__vfl.append_vmap(fval, strategy)
|
|
602
575
|
else:
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
eshape = []
|
|
608
|
-
for ky in key:
|
|
609
|
-
if not unlimited and ky.stop == FileWriter.writer.unlimited():
|
|
610
|
-
eshape.append(1)
|
|
611
|
-
elif isinstance(ky, slice) and ky.stop > 0:
|
|
612
|
-
start = ky.start if ky.start is not None else 0
|
|
613
|
-
step = ky.step if ky.step is not None else 1
|
|
614
|
-
eshape.append((ky.stop - start) // step)
|
|
615
|
-
else:
|
|
616
|
-
eshape.append(1)
|
|
617
|
-
return eshape
|
|
576
|
+
self.__vmaps.append(fval)
|
|
577
|
+
if self.__vfl is not None:
|
|
578
|
+
return len(self.__vfl)
|
|
579
|
+
return len(self.__vmaps)
|
|
618
580
|
|
|
619
581
|
def __createVDS(self):
|
|
620
582
|
""" create the virtual field object
|
|
621
583
|
"""
|
|
622
|
-
|
|
623
|
-
self.__shape, self.__dtype)
|
|
624
|
-
counter = 0
|
|
625
|
-
for vmap in self.__vmaps:
|
|
626
|
-
fieldpath = ""
|
|
627
|
-
filename = ""
|
|
628
|
-
edtype = vmap["dtype"] \
|
|
629
|
-
if "dtype" in vmap else self.__dtype
|
|
630
|
-
key = vmap["key"] if "key" in vmap else counter
|
|
631
|
-
key = self.__cureKeys(key)
|
|
632
|
-
if "shape" in vmap:
|
|
633
|
-
eshape = vmap["shape"]
|
|
634
|
-
elif isinstance(key, int):
|
|
635
|
-
eshape = list(self.__shape)
|
|
636
|
-
eshape[0] = 1
|
|
637
|
-
else:
|
|
638
|
-
eshape = [0] * len(self.__shape)
|
|
639
|
-
fieldpath = vmap["fieldpath"] \
|
|
640
|
-
if "fieldpath" in vmap else "/data"
|
|
641
|
-
filename = vmap["filename"] if "filename" in vmap else None
|
|
642
|
-
if "target" in vmap:
|
|
643
|
-
target = vmap["target"]
|
|
644
|
-
if target.startswith("h5file:/"):
|
|
645
|
-
target = target[8:]
|
|
646
|
-
if "::" in target:
|
|
647
|
-
filename, fieldpath = target.split("::")
|
|
648
|
-
elif ":/" in target:
|
|
649
|
-
filename, fieldpath = target.split(":/")
|
|
650
|
-
else:
|
|
651
|
-
fieldpath = target
|
|
652
|
-
obj = self._lastObject()
|
|
653
|
-
while filename is None:
|
|
654
|
-
par = obj.parent
|
|
655
|
-
if par is None:
|
|
656
|
-
break
|
|
657
|
-
if hasattr(par, "root") and hasattr(par, "name"):
|
|
658
|
-
filename = par.name
|
|
659
|
-
break
|
|
660
|
-
else:
|
|
661
|
-
obj = par
|
|
662
|
-
sourceshape = vmap["sourceshape"] \
|
|
663
|
-
if "sourceshape" in vmap else None
|
|
664
|
-
sourcekey = vmap["sourcekey"] \
|
|
665
|
-
if "sourcekey" in vmap else None
|
|
666
|
-
sourcekey = self.__cureKeys(sourcekey)
|
|
667
|
-
if not any(eshape):
|
|
668
|
-
eshape = self.__findShape(key, eshape, unlimited=False)
|
|
669
|
-
ef = FileWriter.target_field_view(
|
|
670
|
-
filename, fieldpath, eshape, edtype)
|
|
671
|
-
if eshape:
|
|
672
|
-
counter += eshape[0]
|
|
673
|
-
else:
|
|
674
|
-
counter += 1
|
|
675
|
-
# print("KEY", key, sourcekey, sourceshape, eshape)
|
|
676
|
-
vlf.add(key, ef, sourcekey, sourceshape)
|
|
584
|
+
self.__vfl.process_target_field_views(self._lastObject())
|
|
677
585
|
self.h5Object = self._lastObject().create_virtual_field(
|
|
678
|
-
self.__name,
|
|
586
|
+
self.__name, self.__vfl)
|
|
679
587
|
|
|
680
588
|
def run(self):
|
|
681
589
|
""" runner
|
|
@@ -693,15 +601,16 @@ class EVirtualField(FElementWithAttr):
|
|
|
693
601
|
# print("SHaPE", self.__shape)
|
|
694
602
|
# print("TYPE", self.__dtype)
|
|
695
603
|
# print("NAME", self.__name)
|
|
696
|
-
if self.
|
|
604
|
+
if self.__vfl is not None and len(self.__vfl) and self.__shape \
|
|
605
|
+
and self.__dtype and self.__name:
|
|
697
606
|
self.__createVDS()
|
|
698
607
|
self.__setAttributes()
|
|
699
608
|
except Exception:
|
|
700
609
|
info = sys.exc_info()
|
|
701
610
|
import traceback
|
|
702
|
-
message =
|
|
703
|
-
|
|
704
|
-
|
|
611
|
+
message = ("Datasource not found: " +
|
|
612
|
+
str(info[1].__str__()) + "\n " + (" ").join(
|
|
613
|
+
traceback.format_tb(sys.exc_info()[2])))
|
|
705
614
|
# message = self.setMessage( sys.exc_info()[1].__str__() )
|
|
706
615
|
del info
|
|
707
616
|
#: notification of error in the run method (defined in base class)
|
nxswriter/Release.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: nxswriter
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.17.0
|
|
4
4
|
Summary: Nexus Data writer implemented as a Tango Server
|
|
5
5
|
Home-page: https://github.com/nexdatas/nxsdatawriter
|
|
6
6
|
Author: Jan Kotanski, Eugen Wintersberger , Halil Pasic
|
|
@@ -26,7 +26,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
26
26
|
Classifier: Programming Language :: Python :: 3.13
|
|
27
27
|
Requires-Dist: lxml
|
|
28
28
|
Requires-Dist: numpy (>1.6.0)
|
|
29
|
-
Requires-Dist: nxstools (>=
|
|
29
|
+
Requires-Dist: nxstools (>=4.28.1)
|
|
30
30
|
Requires-Dist: pytz
|
|
31
31
|
|
|
32
32
|
Welcome to NXSDataWriter's documentation!
|
|
@@ -95,7 +95,7 @@ Extract sources and run
|
|
|
95
95
|
Debian packages
|
|
96
96
|
"""""""""""""""
|
|
97
97
|
|
|
98
|
-
Debian `
|
|
98
|
+
Debian `trixie`, `bookworm`, `bullseye` or Ubuntu `plucky`, `noble`, `jammy` packages can be found in the HDRI repository.
|
|
99
99
|
|
|
100
100
|
To install the debian packages, add the PGP repository key
|
|
101
101
|
|
|
@@ -110,7 +110,7 @@ and then download the corresponding source list
|
|
|
110
110
|
.. code-block:: console
|
|
111
111
|
|
|
112
112
|
$ cd /etc/apt/sources.list.d
|
|
113
|
-
$ wget http://repos.pni-hdri.de/
|
|
113
|
+
$ wget http://repos.pni-hdri.de/trixie-pni-hdri.list
|
|
114
114
|
|
|
115
115
|
To install tango server
|
|
116
116
|
|
|
@@ -4,13 +4,13 @@ nxswriter/DataHolder.py,sha256=DL08NyY0FG6snsmW0-nQ7JmWJwDc5-Hy2bC4E3Uz1fk,6164
|
|
|
4
4
|
nxswriter/DataSourceFactory.py,sha256=W0IirDjsu38KKvBxFbkvv-ghvqil2JJStQ3WMxo8Kh4,4687
|
|
5
5
|
nxswriter/DataSourcePool.py,sha256=1bDOrHhYpG_ZFz8ut2IzkNSMeGxrCBcSCneM4h1AgDc,4574
|
|
6
6
|
nxswriter/DataSources.py,sha256=l40n4WTfgRjLpFsJs7JoWjsER_dCVviRI_iolQ2fENM,5303
|
|
7
|
-
nxswriter/DecoderPool.py,sha256
|
|
7
|
+
nxswriter/DecoderPool.py,sha256=-eBLujQhuAV81yaFoWirHNULuGSDp4L0ElyFfK-Yj2c,15779
|
|
8
8
|
nxswriter/EAttribute.py,sha256=hADI-LeuQMZwVoTFM4qevoz173Ma_atrk0edqvsFXS0,8878
|
|
9
9
|
nxswriter/EField.py,sha256=YLbdaykGccZ4cjqheS9te50FG6HQq5kfp7gg_OBkJ9k,28034
|
|
10
10
|
nxswriter/EGroup.py,sha256=Y_PuTERckQXfUXGISbnpzHj7I4y2iFxM5CGByjVD6KA,4900
|
|
11
11
|
nxswriter/ELink.py,sha256=FO7SRF1bpJhqRzK2FBSkRHhFwH1Mw5BRCgt8X8qJbr0,8820
|
|
12
12
|
nxswriter/EStrategy.py,sha256=3RX8E6Ee-Klv9DGlMPvXJacdNDmuKWLQrcnuerR0IQI,3992
|
|
13
|
-
nxswriter/EVirtualField.py,sha256=
|
|
13
|
+
nxswriter/EVirtualField.py,sha256=XE9Hup5oX_OLskRv5G6JG0np65M23q0rHEa2vdYY1x0,21572
|
|
14
14
|
nxswriter/Element.py,sha256=dnIUS_U0fqJK3FxV_raQBx6qTGPT7sUFkWVzxI5YuEY,3019
|
|
15
15
|
nxswriter/ElementThread.py,sha256=gCZRpzjji8TRfWLkwFRXG_K55d0yUkv9Gzi2DZ22EyQ,2099
|
|
16
16
|
nxswriter/Errors.py,sha256=dYXtJ7rVWv59kAalNMMZO4X3SxSplhoWICeCb3_rFGc,1660
|
|
@@ -23,16 +23,16 @@ nxswriter/NXSFromXML.py,sha256=932BivWZnf-3tnIkbpSRFwfGV0PTwcT9pYb2FMmVd_4,9077
|
|
|
23
23
|
nxswriter/NXSWriter.py,sha256=raHykC9mpUXU8pPtsqePuz3CI-24qYjIUSoyux2zCgo,31345
|
|
24
24
|
nxswriter/NexusXMLHandler.py,sha256=IrZ2mWLuovdBIHcWTqKmr4HZxpMEWLun8A94O6pavr8,14131
|
|
25
25
|
nxswriter/PyEvalSource.py,sha256=7-7Gc2_3CGd3XMHD3LBPCBOZx4Q6b1guzt1xgrSLxMs,11234
|
|
26
|
-
nxswriter/Release.py,sha256=
|
|
26
|
+
nxswriter/Release.py,sha256=gKfSjs4hgXUKTnclGeQ9cQo3G_uoCeLcLJVEbf6wFSU,900
|
|
27
27
|
nxswriter/StreamSet.py,sha256=sSvXJxoDufmt9_Xu5rFaQsp_4x9gww_zMv0NTiiyLlg,5799
|
|
28
28
|
nxswriter/TangoDataWriter.py,sha256=yP6B3TVUhpHp8OBHKYQRNNtFer9xARoakNXuro4eVv8,28725
|
|
29
29
|
nxswriter/TangoSource.py,sha256=jiFGUsoX2N5-i2gpBqkHi2KjmTBd46TI22Cjkt_2btw,29410
|
|
30
30
|
nxswriter/ThreadPool.py,sha256=TKvOStVUUyuyHowk0MRaBM4GmRKtl0VPVVPdFHu332M,6039
|
|
31
31
|
nxswriter/Types.py,sha256=haH578_GqBwWWUhPC6x9KQOubhhEOsxHdI63j0_AkdE,7906
|
|
32
32
|
nxswriter/__init__.py,sha256=M0w3HGjZgfdqjMdQNaLcq5jazqQeRekx84YSbQCA8-0,1760
|
|
33
|
-
nxswriter-3.
|
|
34
|
-
nxswriter-3.
|
|
35
|
-
nxswriter-3.
|
|
36
|
-
nxswriter-3.
|
|
37
|
-
nxswriter-3.
|
|
38
|
-
nxswriter-3.
|
|
33
|
+
nxswriter-3.17.0.data/scripts/NXSDataWriter,sha256=wO3opCCjYttfrY7CITNXHvirXv5W6rIQTY7vX5PmioI,905
|
|
34
|
+
nxswriter-3.17.0.data/scripts/nxsfromxml,sha256=qxnJUtV_ueA3lGnne8ltaOF6yF5YtmzeFLIl3NWkAq8,61
|
|
35
|
+
nxswriter-3.17.0.dist-info/METADATA,sha256=qI2THU4twGd7hFY5IEWQfvZAnpN6mjXHbfvs_6h8CQ8,9011
|
|
36
|
+
nxswriter-3.17.0.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
37
|
+
nxswriter-3.17.0.dist-info/top_level.txt,sha256=29dYcOYN2MVz1NKpwobc4Zl4yjhd4VB62LDSuSy7x0Y,10
|
|
38
|
+
nxswriter-3.17.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|