pvplot 1.0.0__tar.gz → 1.0.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pvplot
3
- Version: 1.0.0
3
+ Version: 1.0.1
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
@@ -3,9 +3,13 @@ The command line to start litePeakSimulator:
3
3
  python3 -m liteserver.device.litePeakSimulator -ilo -p9710
4
4
  """
5
5
  configFormat='pvplot'
6
+
6
7
  TITLE="PeakSimulator"
8
+ XLABEL = "Time (us)"
9
+ YLABEL = "V"
10
+ POINTS = 1000# data arrays will be rolled over after accumulating this number of points
7
11
 
8
- """ The following variables are not handled yet:
12
+ """ The following attributes are not handled yet:
9
13
  YES = 1
10
14
  POLLPERIOD = 0
11
15
  MINPOLLPERIOD = 0
@@ -19,8 +23,6 @@ LOGCORRELATION = 'NOTREQUIRED'
19
23
  FILLDATA = YES
20
24
  LOGTREEPATH = '/operations/app_store/RunData/currentFill/'
21
25
  PREFERREDLOGDISPLAY = Snapshot
22
- XLABEL = "Time (us)"
23
- YLABEL = "V"
24
26
  DATASTAMPTYPE = 'WCTPERIOD'
25
27
  WCTCORRPERIOD_MSEC = 1000
26
28
  WCTCORRWINDOW_MSEC = 1000
@@ -36,6 +38,7 @@ ERRORBARS = 0
36
38
  FONTTYPE = 'Medium'
37
39
  KEEPPREVIOUS = 0
38
40
  """
41
+
39
42
  dev='L:localhost;9710:dev1:'
40
43
 
41
44
  DOCKS = [
@@ -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('-c','--configDir',default='/operations/app_store/pvplot',
21
+ help='Configuration directory')
20
22
  parser.add_argument('-f', '--file', help=
21
23
  'Configuration file')
22
24
  parser.add_argument('-l', '--limit', type=int, default=1048576,
@@ -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__ = 'v1.0.0 2024-07-26'# configuration file, shortcuts,
4
+ __version__ = 'v1.0.1 2024-07-28'# sys.path.append(pargs.configDir,
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
@@ -281,12 +281,20 @@ class Dataset():
281
281
  PVPlot.mapOfPlotWidgets[dockNum] = self.plotWidget
282
282
  PVPlot.mapOfDocks[dockNum].addWidget(self.plotWidget)
283
283
  printv(f'docks: {PVPlot.mapOfDocks.keys()}, widgets: {PVPlot.mapOfPlotWidgets.keys()}')
284
- if isCorrelationPlot:
285
- self.plotWidget.setLabel('bottom',self.adoPars[1][0])
286
- elif count == 1:
287
- self.plotWidget.setLabel('bottom','time', units='date', unitPrefix='')
284
+
285
+ c = PVPlot.config
286
+ #print(f'd:{self.dockNum}, X,Y: {c.XLABEL,c.YLABEL}')
287
+ if self.dockNum == 0 and c.YLABEL != 'LabelY':
288
+ self.plotWidget.setLabel('left',c.YLABEL)
289
+ if self.dockNum == 0 and c.XLABEL != 'LabelX':
290
+ self.plotWidget.setLabel('bottom',c.XLABEL)
288
291
  else:
289
- self.plotWidget.setLabel('bottom',PVPlot.scaleUnits[X][Units])
292
+ if isCorrelationPlot:
293
+ self.plotWidget.setLabel('bottom',self.adoPars[1][0])
294
+ elif count == 1:
295
+ self.plotWidget.setLabel('bottom','time', units='date', unitPrefix='')
296
+ else:
297
+ self.plotWidget.setLabel('bottom',PVPlot.scaleUnits[X][Units])
290
298
 
291
299
  # set X and Y ranges
292
300
  rangeMap = {X: (PVPlot.pargs.xrange, self.plotWidget.setXRange),
@@ -428,8 +436,8 @@ class Dataset():
428
436
  self.dataPtr = ptr
429
437
 
430
438
  # re-alocate arrays,if necessary
431
- #print(f'ptr: {ptr,self.data[Y].shape[0]}')
432
- if (ptr <= PVPlot.pargs.limit/2) & (ptr >= self.data[Y].shape[0]):
439
+ if (ptr >= self.data[Y].shape[0]):
440
+ #print(f'realllocate: ptr: {ptr,self.data[Y].shape[0]}')
433
441
  tmp = self.data
434
442
  self.data = [np.empty(self.data[Y].shape[0] * 2),
435
443
  np.empty(self.data[Y].shape[0] * 2)]
@@ -493,6 +501,7 @@ class MapOfDatasets():
493
501
  devList.reverse()
494
502
  pnameAndCount = []
495
503
  for adoPar in devList:
504
+ adoPar = adoPar.lstrip()#remove leading whitespaces
496
505
  printv(f'adoPar: {adoPar}')
497
506
  if adoPar.startswith('device('):
498
507
  e = adoPar.index(')')
@@ -601,13 +610,13 @@ class CustomViewBox(pg.ViewBox):
601
610
  action.triggered.connect(partial(self.cursorAction,cursor))
602
611
 
603
612
  labelX = QW.QWidgetAction(self.menu)
604
- self.labelXGui = QW.QLineEdit('LabelX')
613
+ self.labelXGui = QW.QLineEdit(PVPlot.config.XLABEL)
605
614
  self.labelXGui.returnPressed.connect(
606
615
  lambda: self.set_label('bottom',self.labelXGui))
607
616
  labelX.setDefaultWidget(self.labelXGui)
608
617
  self.menu.addAction(labelX)
609
618
  labelY = QW.QWidgetAction(self.menu)
610
- self.labelYGui = QW.QLineEdit('LabelY')
619
+ self.labelYGui = QW.QLineEdit(PVPlot.config.YLABEL)
611
620
  self.labelYGui.returnPressed.connect(
612
621
  lambda: self.set_label('left',self.labelYGui))
613
622
  labelY.setDefaultWidget(self.labelYGui)
@@ -866,22 +875,22 @@ def excepthook(exc_type, exc_value, exc_tb):
866
875
  tb = "".join(traceback.format_exception(exc_type, exc_value, exc_tb))
867
876
  print("error caught!:")
868
877
  print("error message:\n", tb)
869
- QtWidgets.QApplication.quit()
870
- # or QtWidgets.QApplication.exit(0)
878
+ QApplication.quit()
879
+ # or QApplication.exit(0)
871
880
 
872
881
  class tmpClass():
873
882
  DOCKS = [{}]
874
883
 
875
884
  def parse_input_parameters(pargs):
876
885
  fn = pargs.file
877
- print(f'fn:`{fn}`')
878
886
  if fn:
879
- print(f'importing {fn}')
887
+ sys.path.append(pargs.configDir)
888
+ printv(f'importing {fn}')
880
889
  try:
881
890
  ConfigModule = import_module(fn)
882
891
  configFormat = ConfigModule.configFormat
883
892
  except ModuleNotFoundError as e:
884
- printe(f'Trying to import {fn}: {e}')
893
+ printe(f'Trying to import {pargs.configDir}/{fn}: {e}')
885
894
  sys.exit(0)
886
895
  return ConfigModule
887
896
  else:
@@ -893,6 +902,7 @@ def parse_input_parameters(pargs):
893
902
  return tmpClass
894
903
 
895
904
  class PVPlot():
905
+ config = None
896
906
  pargs = None
897
907
  mapOfPlotWidgets = {}
898
908
  mapOfDocks = {}
@@ -914,7 +924,7 @@ class PVPlot():
914
924
 
915
925
  def start():
916
926
  pargs = PVPlot.pargs
917
- print(f'pargs: {PVPlot.pargs}')
927
+ printv(f'pargs: {PVPlot.pargs}')
918
928
 
919
929
  try: os.environ["QT_SCALE_FACTOR"] = str(pargs.zoomin)
920
930
  except: pass
@@ -939,14 +949,21 @@ class PVPlot():
939
949
  from . import helptxt
940
950
  PVPlot.helptxt = helptxt.txt
941
951
 
942
- configModule = parse_input_parameters(pargs)
943
- try: title = configModule.TITLE
944
- except: title = f'pvplot {pargs.parms}'
952
+ #``````````process configuration file
953
+ if pargs.file is not None:
954
+ PVPlot.config = parse_input_parameters(pargs)
955
+
956
+ try: pargs.limit = PVPlot.config.POINTS
957
+ except: pass
958
+
959
+ try: title = PVPlot.config.TITLE
960
+ except: title = title = f'pvplot {pargs.parms}'
945
961
  PVPlot.qWin.setWindowTitle(title)
946
- dockList = configModule.DOCKS
962
+ dockList = PVPlot.config.DOCKS
947
963
  for dockNum,curveMap in enumerate(dockList):
948
964
  printv(f'add_curves to dock{dockNum}, {curveMap}')
949
965
  add_curves(dockNum, curveMap)
966
+ #,,,,,,,,,,
950
967
 
951
968
  if len(MapOfDatasets.dtsDict) == 0:
952
969
  printe(f'No datasets created')
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pvplot"
7
- version = "1.0.0"
7
+ version = "1.0.1"
8
8
  authors = [
9
9
  { name="Andrei Sukhanov", email="cyxandr@gmail.com" },
10
10
  ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes