pvplot 0.6.9__tar.gz → 0.7.0__tar.gz

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.
Files changed (51) hide show
  1. {pvplot-0.6.9 → pvplot-0.7.0}/PKG-INFO +1 -1
  2. {pvplot-0.6.9 → pvplot-0.7.0}/pvplot/__main__.py +2 -0
  3. pvplot-0.7.0/pvplot/helptxt.py +5 -0
  4. {pvplot-0.6.9 → pvplot-0.7.0}/pvplot/pvplot.py +54 -13
  5. pvplot-0.6.9/pvplot/pvpopld.py → pvplot-0.7.0/pvplot/pvplot_tmp.py +11 -6
  6. {pvplot-0.6.9 → pvplot-0.7.0}/pyproject.toml +1 -1
  7. pvplot-0.6.9/apwork/__main__.py +0 -51
  8. pvplot-0.6.9/apwork/apstrim/__init__.py +0 -47
  9. pvplot-0.6.9/apwork/apstrim/__main__.py +0 -69
  10. pvplot-0.6.9/apwork/apstrim/apstrim.py +0 -425
  11. pvplot-0.6.9/apwork/apstrim/liteCNS.py +0 -32
  12. pvplot-0.6.9/apwork/apstrim/pubEPICS.py +0 -214
  13. pvplot-0.6.9/apwork/apstrim/scan.py +0 -336
  14. pvplot-0.6.9/apwork/apstrim/view.py +0 -237
  15. pvplot-0.6.9/apwork/pvplot.py +0 -875
  16. pvplot-0.6.9/fallback/__main__.py +0 -854
  17. pvplot-0.6.9/liteaccess/.__init__.py.swp +0 -0
  18. pvplot-0.6.9/liteaccess/__init__.py +0 -3
  19. pvplot-0.6.9/liteaccess/liteCNS.py +0 -32
  20. pvplot-0.6.9/liteaccess/liteaccess.py +0 -693
  21. pvplot-0.6.9/ln/liteserver/__init__.py +0 -0
  22. pvplot-0.6.9/ln/liteserver/device/__init__.py +0 -0
  23. pvplot-0.6.9/ln/liteserver/device/helpers.py +0 -60
  24. pvplot-0.6.9/ln/liteserver/device/i2c.py +0 -933
  25. pvplot-0.6.9/ln/liteserver/device/i2c_312.py +0 -718
  26. pvplot-0.6.9/ln/liteserver/device/i2c_320.py +0 -725
  27. pvplot-0.6.9/ln/liteserver/device/i2c_322.py +0 -755
  28. pvplot-0.6.9/ln/liteserver/device/i2c_TLV493D.py +0 -620
  29. pvplot-0.6.9/ln/liteserver/device/liteCNSserver.py +0 -51
  30. pvplot-0.6.9/ln/liteserver/device/liteGQ.py +0 -199
  31. pvplot-0.6.9/ln/liteserver/device/liteLabjack.py +0 -194
  32. pvplot-0.6.9/ln/liteserver/device/liteMCUFEC.py +0 -581
  33. pvplot-0.6.9/ln/liteserver/device/litePeakSimulator.py +0 -195
  34. pvplot-0.6.9/ln/liteserver/device/liteScaler.py +0 -224
  35. pvplot-0.6.9/ln/liteserver/device/liteUSBCam.py +0 -132
  36. pvplot-0.6.9/ln/liteserver/device/liteUvcCam.py +0 -134
  37. pvplot-0.6.9/ln/liteserver/device/liteVGM.py +0 -318
  38. pvplot-0.6.9/ln/liteserver/device/liteWLM.py +0 -77
  39. pvplot-0.6.9/ln/liteserver/device/senstation.py +0 -434
  40. pvplot-0.6.9/ln/liteserver/device/test/test_dht11.py +0 -58
  41. pvplot-0.6.9/ln/liteserver/liteserver.py +0 -984
  42. pvplot-0.6.9/ln/liteserver/liteserver_unlist.py +0 -1005
  43. pvplot-0.6.9/pvplot/apstrimAccess.py +0 -65
  44. pvplot-0.6.9/pvplot/pvp.py +0 -917
  45. pvplot-0.6.9/pvplot/pvp1.py +0 -935
  46. pvplot-0.6.9/tmp.py +0 -93
  47. {pvplot-0.6.9 → pvplot-0.7.0}/LICENSE +0 -0
  48. {pvplot-0.6.9 → pvplot-0.7.0}/README.md +0 -0
  49. {pvplot-0.6.9 → pvplot-0.7.0}/cad_epics/__init__.py +0 -0
  50. {pvplot-0.6.9 → pvplot-0.7.0}/cad_epics/epics.py +0 -0
  51. {pvplot-0.6.9 → pvplot-0.7.0}/pvplot/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pvplot
3
- Version: 0.6.9
3
+ Version: 0.7.0
4
4
  Summary: Plotting tool for EPICS PVs, ADO and LITE parameters
5
5
  Project-URL: Homepage, https://github.com/ASukhanov/pvplot
6
6
  Project-URL: Bug Tracker, https://github.com/ASukhanov/pvplot/issues
@@ -17,6 +17,8 @@ def main():
17
17
  "Prefix, which will be added to all data objects, e.g: 'L:localhost:dev1:'")
18
18
  #TODO:parser.add_argument('-H', '--histogram', help=\
19
19
  # 'Plot the space-separated parameters as histograms')
20
+ parser.add_argument('-l', '--limit', type=int, default=1048576,
21
+ help='Upper limit for number of points to store')
20
22
  parser.add_argument('-s', '--sleepTime', type=float, default=0.1,
21
23
  help='sleep time between data delivery [s]')
22
24
  parser.add_argument('-v', '--verbose', action='count', default=0, help=\
@@ -0,0 +1,5 @@
1
+ txt="""
2
+ Shortcuts
3
+ ^s: Stop
4
+ ^q: Continue
5
+ """
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env python3
2
2
  """Plotting package for EPICS PVs, ADO and LITE parameters.
3
3
  """
4
- __version__ = 'v0.6.9 2024-05-16'# statistics and yProjection are static
4
+ __version__ = 'v0.7.0 2024-07-24'# corrected vert. cursor for stripcharts, QShortcuts, --limit
5
5
  #TODO: if backend times out the gui is not responsive
6
6
  #TODO: move Add Dataset to Dataset options
7
7
  #TODO: add dataset arithmetics
8
8
 
9
- import sys, os, time
9
+ import sys, os, time, datetime
10
10
  timer = time.perf_counter
11
11
  import numpy as np
12
12
  from qtpy import QtWidgets as QW, QtGui, QtCore
@@ -269,6 +269,7 @@ class Dataset():
269
269
  self.symbolBrush = None
270
270
  self.symbolSize = None
271
271
  self.pxMode = None
272
+ self.timeAxis = False
272
273
  self.statistics = {}
273
274
 
274
275
  # ``````````````````` Add plotItem ``````````````````````````````````````
@@ -307,6 +308,7 @@ class Dataset():
307
308
  if count == 1 and not isCorrelationPlot:
308
309
  self.plotWidget = pg.PlotWidget(title=title, viewBox=self.viewBox,
309
310
  axisItems={'bottom':DateAxis(orientation='bottom')})
311
+ self.timeAxis = True
310
312
  if dock != '#0':
311
313
  self.plotWidget.setXLink(PVPlot.mapOfPlotWidgets['#0'])
312
314
  else:
@@ -427,7 +429,7 @@ class Dataset():
427
429
  else:
428
430
  # the plot is scrolling or correlation plot
429
431
  ptr = self.dataPtr
430
- if ptr >= PVPlot.maxPoints:
432
+ if ptr >= PVPlot.pargs.limit:
431
433
  # do not extent the data buffer, roll it over instead
432
434
  self.data[X] = np.roll(self.data[X],-1)
433
435
  self.data[Y] = np.roll(self.data[Y],-1)
@@ -451,8 +453,10 @@ class Dataset():
451
453
  self.data[X][ptr] = ts
452
454
  ptr += 1
453
455
  self.dataPtr = ptr
456
+
457
+ # re-alocate arrays,if necessary
454
458
  #print(f'ptr: {ptr,self.data[Y].shape[0]}')
455
- if (ptr <= PVPlot.maxPoints/2) & (ptr >= self.data[Y].shape[0]):
459
+ if (ptr <= PVPlot.pargs.limit/2) & (ptr >= self.data[Y].shape[0]):
456
460
  tmp = self.data
457
461
  self.data = [np.empty(self.data[Y].shape[0] * 2),
458
462
  np.empty(self.data[Y].shape[0] * 2)]
@@ -556,6 +560,8 @@ class PopupWindow(QW.QWidget):
556
560
  """
557
561
  def __init__(self):
558
562
  super().__init__()
563
+ qr = PVPlot.qWin.geometry()
564
+ self.setGeometry(QtCore.QRect(qr.x(), qr.y(), 0, 0))
559
565
  self.setWindowTitle('Statistics')
560
566
  layout = QW.QVBoxLayout()
561
567
  self.label = QW.QLabel()
@@ -654,11 +660,11 @@ class CustomViewBox(pg.ViewBox):
654
660
 
655
661
  runAction = QW.QWidgetAction(self.menu)
656
662
  runWidget = QW.QCheckBox('&Stop')
657
- runWidget.setChecked(False)
663
+ runWidget.setChecked(PVPlot.stopped)
658
664
  runWidget.stateChanged.connect(lambda x: self.set_stop(x))
659
665
  runAction.setDefaultWidget(runWidget)
660
666
  self.menu.addAction(runAction)
661
-
667
+
662
668
  sleepTimeMenu = self.menu.addMenu('Sleep&Time')
663
669
  sleepTimeAction = QW.QWidgetAction(sleepTimeMenu)
664
670
  sleepTimeWidget = QW.QDoubleSpinBox()
@@ -671,6 +677,14 @@ class CustomViewBox(pg.ViewBox):
671
677
  sleepTimeMenu.addAction(sleepTimeAction)
672
678
  return self.menu
673
679
 
680
+ def cursor_text(self, pos, horizontal):
681
+ #print(f'timeAxis = {self.dataset.timeAxis}')
682
+ if (not horizontal) and self.dataset.timeAxis:
683
+ txt = datetime.datetime.fromtimestamp(pos).strftime('%H:%M:%S')
684
+ else:
685
+ txt = f'{pos:.4g}'
686
+ return txt
687
+
674
688
  def cursorAction(self, direction):
675
689
  angle = {'Vertical':90, 'Horizontal':0}[direction]
676
690
  pwidget = PVPlot.mapOfPlotWidgets[self.dockName]
@@ -680,11 +694,12 @@ class CustomViewBox(pg.ViewBox):
680
694
  pos = (vr[vid][1] + vr[vid][0])/2.
681
695
  pen = pg.mkPen(color='b', width=1, style=QtCore.Qt.DotLine)
682
696
  cursor = pg.InfiniteLine(pos=pos, pen=pen, movable=True, angle=angle
683
- , label=str(round(pos,3)))
697
+ , label=self.cursor_text(pos,vid), labelOpts={'color':(0,0,0)})#,'fill':(0,255,255)})
684
698
  cursor.sigPositionChangeFinished.connect(\
685
699
  (partial(self.cursorPositionChanged,cursor)))
686
700
  self.cursors.add(cursor)
687
701
  pwidget.addItem(cursor)
702
+ self.cursorPositionChanged(cursor)
688
703
 
689
704
  def cursorPositionChanged(self, cursor):
690
705
  pos = cursor.value()
@@ -695,7 +710,7 @@ class CustomViewBox(pg.ViewBox):
695
710
  pwidget.removeItem(cursor)
696
711
  self.cursors.remove(cursor)
697
712
  else:
698
- cursor.label.setText(str(round(pos,3)))
713
+ cursor.label.setText(self.cursor_text(pos, horizontal))
699
714
 
700
715
  def changed_datasetOptions(self):
701
716
  """Dialog Plotting Options"""
@@ -800,10 +815,7 @@ class CustomViewBox(pg.ViewBox):
800
815
  set_legend(self.dockName, state)
801
816
 
802
817
  def set_stop(self, state):
803
- if state == QtCore.Qt.Checked:
804
- PVPlot.qTimer.stop()
805
- else:
806
- PVPlot.qTimer.start(int(PVPlot.pargs.sleepTime*1000))
818
+ PVPlot.stop(state == QtCore.Qt.Checked)
807
819
 
808
820
  def set_sleepTime(self, itemData):
809
821
  #print('setting SleepTime to: '+str(itemData))
@@ -906,10 +918,10 @@ class PVPlot():
906
918
  dockArea = None
907
919
  minPlottingPeriod = 1/10.# the data will not be plotted faster than that limit.
908
920
  lastPlotTime = 0.
909
- maxPoints = 1048576# Max number of data points to store.
910
921
  statisticsWindow = None
911
922
  yProjectionWindow = None
912
923
  yProjectionPlotItem = None
924
+ stopped = False
913
925
 
914
926
  def start():
915
927
  pargs = PVPlot.pargs
@@ -928,6 +940,18 @@ class PVPlot():
928
940
 
929
941
  PVPlot.qWin.setWindowTitle(f'pvplot {pargs.parms}')
930
942
 
943
+ # Shortcuts
944
+ shortcut = QW.QShortcut(QtGui.QKeySequence("Ctrl+H"), PVPlot.qWin)
945
+ shortcut.activated.connect(PVPlot.actionHelp)
946
+ shortcut = QW.QShortcut(QtGui.QKeySequence("Ctrl+S"), PVPlot.qWin)
947
+ shortcut.activated.connect(partial(PVPlot.actionStop,True))
948
+ shortcut = QW.QShortcut(QtGui.QKeySequence("Ctrl+Q"), PVPlot.qWin)
949
+ shortcut.activated.connect(partial(PVPlot.actionStop,False))
950
+ #shortcut = QW.QShortcut(QtGui.QKeySequence("Ctrl+U"), PVPlot.qWin)
951
+ #shortcut.activated.connect(partial(PVPlot.actionStop,False))
952
+ from . import helptxt
953
+ PVPlot.helptxt = helptxt.txt
954
+
931
955
  # plots for other docks
932
956
  if pargs.dock:
933
957
  for par in pargs.dock:
@@ -979,3 +1003,20 @@ class PVPlot():
979
1003
  ret = qApp.instance().exec_()
980
1004
  print('Application exited')
981
1005
  sys.exit(ret)
1006
+
1007
+ def actionStop(state:bool):
1008
+ print(f'actionStop {state}')
1009
+ PVPlot.stop(state)
1010
+
1011
+ def stop(state):
1012
+ print(f'>PVPlot.stop {state}')
1013
+ PVPlot.stopped = state
1014
+ if state == True:
1015
+ PVPlot.qTimer.stop()
1016
+ else:
1017
+ PVPlot.qTimer.start(int(PVPlot.pargs.sleepTime*1000))
1018
+
1019
+ def actionHelp():
1020
+ PVPlot.helpWin = PopupWindow()
1021
+ PVPlot.helpWin.label.setText(PVPlot.helptxt)
1022
+ PVPlot.helpWin.show()
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  """Plotting package for EPICS PVs, ADO and LITE parameters.
3
3
  """
4
- __version__ = 'v0.6.7 2023-09-21'# correct correlation plot for vector parameters
4
+ __version__ = 'v0.6.8 2024-05-10'#
5
5
  #TODO: if backend times out the gui is not responsive
6
6
  #TODO: add_curves is not correct for multiple curves
7
7
  #TODO: move Add Dataset to Dataset options
@@ -388,7 +388,7 @@ class Dataset():
388
388
  self.plot(ts)
389
389
  return
390
390
  self.lastTimeUpdated = ts
391
- #printv(f'update_plot: {curvePars}, data:{yd}')
391
+ printv(f'update_plot: {curvePars}')# data:{yd}')
392
392
  #print(f'update {self.name, round(ts,3), round(self.lastTimePlotted,3)}')
393
393
  try:
394
394
  l = len(yd)
@@ -398,7 +398,7 @@ class Dataset():
398
398
 
399
399
  # Evaluate X and Y arrays
400
400
  if l > 1:
401
- #printv('Array plot')
401
+ # the plot is array plot
402
402
  self.data[Y] = np.array(yd)
403
403
  if len(curvePars) > 1:
404
404
  # use last item as horizontal axis
@@ -413,13 +413,12 @@ class Dataset():
413
413
  # the plot is scrolling or correlation plot
414
414
  ptr = self.dataPtr
415
415
  if ptr >= PVPlot.maxPoints:
416
- # do not extent the data buffer, roll it over instead
416
+ # do not extent the data buffer, roll it over insted
417
417
  self.data[X] = np.roll(self.data[X],-1)
418
418
  self.data[Y] = np.roll(self.data[Y],-1)
419
419
  ptr -= 1
420
420
  self.data[Y][ptr] = yd
421
- if len(curvePars) > 1:
422
- #print('Correlation Plot')
421
+ if len(curvePars) > 1:
423
422
  printv(f'correlation plot: {curvePars[1][0]}')
424
423
  try:
425
424
  v,*_ = get_pv(curvePars[1][0])
@@ -548,6 +547,9 @@ class CustomViewBox(pg.ViewBox):
548
547
  setDatasets = self.menu.addAction('Datasets &Options')
549
548
  setDatasets.triggered.connect(self.changed_datasetOptions)
550
549
 
550
+ _statistics = self.menu.addAction('Show Statistics')
551
+ _statistics.triggered.connect(self.show_statistics)
552
+
551
553
  cursorMenu = self.menu.addMenu('Add &Cursor')
552
554
  for cursor in ['Vertical','Horizontal']:
553
555
  action = cursorMenu.addAction(cursor)
@@ -747,6 +749,9 @@ class CustomViewBox(pg.ViewBox):
747
749
  return
748
750
  self.setRange(xRange=viewRange[X], yRange=viewRange[Y], padding=None,
749
751
  update=True, disableAutoRange=True)
752
+
753
+ def show_statistics(self):
754
+ label = QW.QLabel('Statistics')
750
755
  #,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
751
756
 
752
757
  def callback(args):
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pvplot"
7
- version = "0.6.9"
7
+ version = "0.7.0"
8
8
  authors = [
9
9
  { name="Andrei Sukhanov", email="cyxandr@gmail.com" },
10
10
  ]
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Dynamic plotting tool for control system frameworks.
3
- Frameworks supported: EPICS, ADO, LiteServer.
4
- The framework is distinguished by adding a prefix to Process Variable names:
5
- 'E:' - for EPICS, 'L:' - for LiteServer, 'A:' - apstrim file.
6
- """
7
- import sys,os
8
- from . import pvplot
9
-
10
- def main():
11
- import argparse
12
- global pargs
13
- parser = argparse.ArgumentParser(description=__doc__
14
- ,formatter_class=argparse.ArgumentDefaultsHelpFormatter
15
- ,epilog=(f'pvplot: {pvplot.__version__}'))
16
- parser.add_argument('-a', '--prefix', default='', help=\
17
- "Prefix, which will be added to all data objects, e.g: 'L:localhost:dev1:'")
18
- #TODO:parser.add_argument('-H', '--histogram', help=\
19
- # 'Plot the space-separated parameters as histograms')
20
- parser.add_argument('-s', '--sleepTime', type=float, default=0.1,
21
- help='sleep time between data delivery [s]')
22
- parser.add_argument('-v', '--verbose', nargs='*', help=\
23
- 'Show more log messages (-vv: show even more).')
24
- parser.add_argument('-x', '--xscale', help=\
25
- 'Parameter, which provides dynamic scale for X-axis')
26
- parser.add_argument('-X', '--xrange', help=\
27
- 'Fixed range of X axis, e.g: -x10:20')
28
- parser.add_argument('-y', '--yscale', help=\
29
- 'Parameter, which provides dynamic scale for Y-axis')
30
- parser.add_argument('-Y', '--yrange', help=\
31
- 'Fixed range of Y axis, e.g: -y1000:4095')
32
- parser.add_argument('-z', '--zoomin', type=float, default=1., help=\
33
- 'Zoom the application window by a factor')
34
- parser.add_argument('-#','--dock', action='append', nargs='*',
35
- help='''Plot a specified dock, i.e: to plot two scrolling plots in lower
36
- dock and correlation plot in upper dock:
37
- pvplot -a'L:localhost:dev1:' -#0'yMax yMin' -#1'yMax,yMin' ''')
38
- parser.add_argument('parms', nargs = '?', default='yMax yMin',
39
- help='''For stripchart: space-separated list, for correlation plot: comma-separated list of data objects.''')
40
- pargs = parser.parse_args()
41
- PVPlot = pvplot.PVPlot
42
- PVPlot.pargs = pargs
43
-
44
- #``````````````arrange keyboard interrupt to kill the program from terminal.
45
- import signal
46
- signal.signal(signal.SIGINT, signal.SIG_DFL)
47
-
48
- PVPlot.start()
49
-
50
- if __name__ == "__main__":
51
- main()
@@ -1,47 +0,0 @@
1
- # Copyright (c) 2021 Andrei Sukhanov. All rights reserved.
2
- #
3
- # Licensed under the MIT License, (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # https://github.com/ASukhanov/upstrim/blob/main/LICENSE
8
- #
9
-
10
- """Logger of Control System parameters and data objects.
11
- Features:
12
- - Supported Control Systems infrastructures: ADO, EPICS, LITE.
13
- - Very fast random access retrieval of objects for selected time interval.
14
- - Nonhomogeneous and homogeneous data are processed equally fast.
15
- - Self-describing data format, no schema required.
16
- - Efficient binary serialization format.
17
- - Like JSON. But it's faster and smaller.
18
- - Numpy arrays supported.
19
- - Optional online compression.
20
- - Basic plotting of logged data.
21
- - Data extraction from a file is allowed when the file is being written.
22
-
23
- Example of command line usage:
24
-
25
- # Serialization of EPICS PVs MeanValue_RBV and Waveform_RBV from simscope IOC
26
- python -m apstrim -nEPICS --compress testAPD:scope1:MeanValue_RBV,Waveform_RBV
27
-
28
- # Serialization of 'cycle' and 'y'-array from a liteServer, running at liteHost
29
- python -m apstrim -nLITE --compress liteHost:dev1:cycle,y
30
-
31
- # De-serialization and plotting of the logged data files
32
- python -m apstrim.plot *.aps
33
-
34
- Example of Python usage for EPICS infrastructure:
35
-
36
- import apstrim
37
- from apstrim.pubEPICS import Access as publisher
38
- pvNames = ['testAPD:scope1:MeanValue_RBV','testAPD:scope1:Waveform_RBV']
39
- aps = apstrim.apstrim(publisher, pvNames)
40
- aps.start('myLogbook.aps')
41
- ...
42
- aps.stop()
43
- """
44
-
45
- from .apstrim import apstrim
46
-
47
- __version__ = '2.0.5'
@@ -1,69 +0,0 @@
1
- Description = '''Serializer of Process Variables (from EPICS infrastructure)
2
- or Data Objects from other infrastructures, e.g. ADO or LITE).'''
3
- __version__ = '3.0.0 2023-09-24'# pubLITE removed, use_single_float removed
4
-
5
- import sys, argparse
6
- from .apstrim import apstrim, __version__
7
-
8
- def main():
9
- # parse common arguments
10
- parser = argparse.ArgumentParser(description=Description
11
- ,formatter_class=argparse.ArgumentDefaultsHelpFormatter
12
- ,epilog=f'apstrim: {__version__}')
13
- parser.add_argument('-c', '--compress', action='store_true', help=\
14
- 'Enable online compression')
15
- #parser.add_argument('-D', '--dirSize', type=int, default=10240, help=\
16
- #'Size of a directory section, set it to 0 to disable random access retrieval')
17
- #parser.add_argument('-d', '--doublePrecision', action='store_true', help=\
18
- #'Disable conversion of float64 to float32')
19
- #parser.add_argument('-f', '--file', default=None, help=\
20
- #'Configuration file')
21
- parser.add_argument('-o', '--outfile', default='apstrim.aps', help=\
22
- 'Logbook file for storing PVs and data objects')
23
- parser.add_argument('-n', '--namespace', default='EPICS', help=\
24
- 'Infrastructure namespace, e.g.: EPICS, ADO or LITE')
25
- parser.add_argument('-t', '--sectionTime', type=float, default=60., help=\
26
- 'Time interval of writing of sections to logbook')
27
- parser.add_argument('-T', '--acqTime', type=float, default=99e6, help=\
28
- 'How long (seconds) to take data.')
29
- parser.add_argument('-q', '--quiet', action='store_true', help=\
30
- 'Quiet: dont print section progress')
31
- parser.add_argument('-v', '--verbose', action='store_true', help=\
32
- 'Show more log messages')
33
- parser.add_argument('pvNames', nargs='*', help=\
34
- 'Data Object names, one item per device parameters are comma-separated: dev1:par1,par2 dev2:par1,par2')
35
- pargs = parser.parse_args()
36
- #print(f'pargs:{pargs}')
37
-
38
- s = pargs.namespace.upper()
39
- if s == 'LITE':
40
- from liteaccess import Access as publisher
41
- elif s == 'EPICS':
42
- from .pubEPICS import Access
43
- publisher = Access()
44
- else:
45
- print(f'ERROR: Unsupported namespace {s}')
46
- sys.exit(1)
47
-
48
- pvNames = []
49
- for pvn in pargs.pvNames:
50
- tokens = pvn.split(',')
51
- first = tokens[0]
52
- pvNames.append(first)
53
- if len(tokens) > 1:
54
- dev = first.rsplit(':',1)[0]
55
- for par in tokens[1:]:
56
- pvNames.append(dev+':'+par)
57
- #print(f'pvNames: {pvNames}')
58
-
59
- apstrim.Verbosity = pargs.verbose
60
- aps = apstrim(publisher, pvNames, pargs.sectionTime, compress=pargs.compress
61
- #, quiet=pargs.quiet, use_single_float=not pargs.doublePrecision)
62
- , quiet=pargs.quiet)
63
- aps.start(pargs.outfile, howLong=pargs.acqTime)
64
-
65
- txt = f'for {round(pargs.acqTime/60., 2)} m' if pargs.acqTime<99e6 else 'endlessly'
66
- print(f'Streaming started {txt}, press Ctrl/C to stop.')
67
-
68
- if __name__ == '__main__':
69
- main()