apstrim 4.0.2__tar.gz → 4.0.4__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 (56) hide show
  1. {apstrim-4.0.2 → apstrim-4.0.4}/PKG-INFO +1 -1
  2. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/view.py +37 -11
  3. {apstrim-4.0.2 → apstrim-4.0.4}/pyproject.toml +1 -1
  4. {apstrim-4.0.2 → apstrim-4.0.4}/CHANGELOG.md +0 -0
  5. {apstrim-4.0.2 → apstrim-4.0.4}/LICENSE +0 -0
  6. {apstrim-4.0.2 → apstrim-4.0.4}/README.md +0 -0
  7. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/__init__.py +0 -0
  8. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/__main__.py +0 -0
  9. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/apstrim.py +0 -0
  10. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/helpTxtView.py +0 -0
  11. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/liteCNS.py +0 -0
  12. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/pubEPICS.py +0 -0
  13. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/pvplot.py +0 -0
  14. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/scan.py +0 -0
  15. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/view-v400a.py +0 -0
  16. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim/view_v141.py +0 -0
  17. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim.aps +0 -0
  18. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim.egg-info/PKG-INFO +0 -0
  19. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim.egg-info/SOURCES.txt +0 -0
  20. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim.egg-info/dependency_links.txt +0 -0
  21. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim.egg-info/entry_points.txt +0 -0
  22. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim.egg-info/requires.txt +0 -0
  23. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim.egg-info/top_level.txt +0 -0
  24. {apstrim-4.0.2 → apstrim-4.0.4}/apstrim_20241111_1916.aps +0 -0
  25. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/__init__.py +0 -0
  26. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/__main__.py +0 -0
  27. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/apstrim.py +0 -0
  28. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/apview.py +0 -0
  29. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/deserializer-v04.py +0 -0
  30. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/deserializer.py +0 -0
  31. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/liteCNS.py +0 -0
  32. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/plot.py +0 -0
  33. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/plot1.py +0 -0
  34. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/pubEPICS.py +0 -0
  35. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/pubLITE.py +0 -0
  36. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/scan.py +0 -0
  37. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/view.py +0 -0
  38. {apstrim-4.0.2 → apstrim-4.0.4}/build/lib/apstrim/view_v141.py +0 -0
  39. {apstrim-4.0.2 → apstrim-4.0.4}/config/peaksim_pvp.py +0 -0
  40. {apstrim-4.0.2 → apstrim-4.0.4}/docs/_config.yml +0 -0
  41. {apstrim-4.0.2 → apstrim-4.0.4}/docs/apstrim.html +0 -0
  42. {apstrim-4.0.2 → apstrim-4.0.4}/docs/apstrim_file_format.png +0 -0
  43. {apstrim-4.0.2 → apstrim-4.0.4}/docs/daily_downloads.jpg +0 -0
  44. {apstrim-4.0.2 → apstrim-4.0.4}/docs/scan.html +0 -0
  45. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/scan-v200.py +0 -0
  46. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/v1.4.1/__init__.py +0 -0
  47. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/v1.4.1/__main__.py +0 -0
  48. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/v1.4.1/apstrim.py +0 -0
  49. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/v1.4.1/liteCNS.py +0 -0
  50. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/v1.4.1/pubEPICS.py +0 -0
  51. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/v1.4.1/pubLITE.py +0 -0
  52. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/v1.4.1/scan.py +0 -0
  53. {apstrim-4.0.2 → apstrim-4.0.4}/fallback/v1.4.1/view.py +0 -0
  54. {apstrim-4.0.2 → apstrim-4.0.4}/html/apstrim.html +0 -0
  55. {apstrim-4.0.2 → apstrim-4.0.4}/html/scan.html +0 -0
  56. {apstrim-4.0.2 → apstrim-4.0.4}/pyproject0.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apstrim
3
- Version: 4.0.2
3
+ Version: 4.0.4
4
4
  Summary: Logger and extractor of time-series data (e.g. EPICS PVs or liteServer LDOs).
5
5
  Project-URL: Homepage, https://github.com/ASukhanov/apstrim
6
6
  Project-URL: Bug Tracker, https://github.com/ASukhanov/apstrim/issues
@@ -1,5 +1,5 @@
1
1
  """Plot data from the apstrim-generated files."""
2
- __version__ = 'v4.0.2 2025-01-23'# Faster plotting of 1D arrays, cleanup.
2
+ __version__ = 'v4.0.4 2025-01-26'# fix: Cell names from config file. Detection of corrupted data
3
3
  #TODO: Cellname did not change on plot after changing it in dataset options
4
4
  #TODO: data acquisition stops when section is dumped to disk. Is writing really buffered?
5
5
  #TODO: interactive works only for one file
@@ -214,7 +214,7 @@ class CustomViewBox(pg.ViewBox):
214
214
 
215
215
  def set_label(self,side,labelGui):
216
216
  dock,label = self.dockNum,str(labelGui.text())
217
- #print('Changed_label '+side+': '+str((dock,label)))
217
+ #print(f'Changed_label {side}: {dock,label}')
218
218
  plotWidget = C.dockList[self.dockNum]['dock'].widgets[0]
219
219
  plotWidget.setLabel(side,label, units='')
220
220
  # it might be useful to return the prompt back:
@@ -246,7 +246,7 @@ def set_legend(dockNum:int, state:bool):
246
246
  #print(f'add legends to dock{dockNum}')
247
247
  plotWidget = C.dockList[dockNum]['dock'].widgets[0]
248
248
  listOfItems = plotWidget.getPlotItem().listDataItems()
249
- l = pg.LegendItem((100,60), offset=(70,30), verSpacing=-20,
249
+ l = pg.LegendItem((100,60), offset=(70,30), verSpacing=-10,
250
250
  labelTextColor=TxtColor) # args are (size, offset)
251
251
  l.setParentItem(plotWidget.graphicsItem())
252
252
  C.legends[dockNum] = l
@@ -299,7 +299,7 @@ def shortcutStatistics():
299
299
  sl = get_statistics()
300
300
  try: statWindow = C.statisticsWindow
301
301
  except:
302
- header = ['Parameter','XMin','XMax','Mean','StDev','Peak2Peak']
302
+ header = ['Cell','Parameter','From','To','Mean','StDev','Peak2Peak']
303
303
  C.statisticsWindow = TableWindow(sl, header)
304
304
  statWindow = C.statisticsWindow
305
305
  statWindow.model.refresh_data(sl)
@@ -323,13 +323,17 @@ def xRange(plotDataItem):
323
323
  def get_statistics():
324
324
  statList = []
325
325
  for pvName,cc in C.curves.items():
326
+ if not cc.enabled:
327
+ continue
326
328
  plotDataItem = cc.plotDataItem
329
+ if plotDataItem is None:
330
+ continue
327
331
  ileft,iright = xRange(plotDataItem)
328
332
  x,y = plotDataItem.getData()
329
333
  y = np.array(y[ileft:iright])
330
334
  numbers = ileft, iright, y.mean(), y.std(), (y.max() - y.min())
331
335
  ntxt = [f'{i:.6g}' for i in numbers]
332
- statList.append([pvName, *ntxt])
336
+ statList.append([cc.cell, pvName, *ntxt])
333
337
  return statList
334
338
 
335
339
  class PopupHelp(QW.QWidget):
@@ -391,11 +395,12 @@ class TableWindow(QW.QWidget):
391
395
  """
392
396
  def __init__(self, data, headers=[]):
393
397
  super().__init__()
394
- self.setWindowTitle('Statistics')
398
+ self.setWindowTitle(f'Statistics of {pargs.files[0]}')
395
399
  layout = QW.QVBoxLayout()
396
400
  self.table = QW.QTableView()
397
401
  self.model = TableModel(data, headers)
398
402
  self.table.setModel(self.model)
403
+ self.table.setSizeAdjustPolicy(QW.QAbstractScrollArea.AdjustToContents)
399
404
  vh = self.table.verticalHeader()
400
405
  vh.setDefaultSectionSize(20)
401
406
  #vh.sectionResizeMode(QW.QHeaderView.Fixed)
@@ -577,6 +582,7 @@ def change_datasetOptions():
577
582
  # print('Save clicked')
578
583
 
579
584
  def change_cell(pvName, txt):
585
+ #print(f'change_cell: {pvName, txt}')
580
586
  C.curves[pvName].cell = txt
581
587
 
582
588
  def change_enable(pvName, state):
@@ -681,6 +687,10 @@ def register_dock(dockNum:int):
681
687
  dockName = str(dockNum)
682
688
  dock = Dock(dockName, size=(500,200), hideTitle=True)
683
689
  vb = CustomViewBox(dockNum)
690
+ try: vb.setYRange(C.config.YMINIMUM, C.config.YMAXIMUM)
691
+ except: pass
692
+ #Exception as e:
693
+ # printw(f'in setYRange: {e}')
684
694
  ax = {'bottom':DateAxis(orientation='bottom')}
685
695
  plotWidget = pg.PlotWidget(title=None, name=dockName, viewBox=vb, axisItems=ax)#, plotItem=plotItem)
686
696
  dock.addWidget(plotWidget)
@@ -716,9 +726,13 @@ else:
716
726
  maxColors = len(curveMap)
717
727
  i = 0
718
728
  for cell,pvName in curveMap.items():
719
- #print(f'color {i} of {pvName}')
729
+ #print(f'color {i} of {pvName}')
730
+ if not pvName in C.curves:
731
+ printw(f'There is no item {pvName} in the logbook')
732
+ continue
720
733
  lcolor = hsvToRgb(i, maxColors)
721
734
  printv(f'adding curve {pvName}{lcolor} as {cell} to dock {dockNum}')
735
+ C.curves[pvName].cell = cell
722
736
  C.curves[pvName].dock = dockNum
723
737
  C.curves[pvName].enabled = True
724
738
  C.curves[pvName].color = lcolor
@@ -736,7 +750,7 @@ else:
736
750
  s = ''
737
751
  for i,pvName in enumerate(C.curves):
738
752
  if C.curves[pvName].enabled:
739
- printv(f'Enabled: {C.curves[pvName].cell}')
753
+ printv(f'Enabled {i}: {C.curves[pvName].cell}')
740
754
  s += str(i)+','
741
755
  pargs.items = s[:-1]
742
756
  print(f'Index list of requested items from the apstrim: {pargs.items}')
@@ -832,21 +846,32 @@ for extracted in allExtracted:
832
846
  continue
833
847
  # check if y is array of numbers
834
848
  if APScan.Verbosity >= 2: printvv(f'y: {y}')
835
- if not np.issubdtype(y[0].dtype, np.number):
849
+ try: y0dtype = y[0].dtype
850
+ except:
851
+ printw(f'Corrupted data {par}? y[0] is not numpy but {type(y[0])}')
852
+ continue
853
+ if not np.issubdtype(y0dtype, np.number):
836
854
  msg = f'PV[{key}] is not array of numbers dtype:{y[0].dtype}'
837
855
  print(f'WARNING: {msg}')
838
856
  #raise ValueError(msg)
839
- y = [float(i) for i in y]
857
+ y = np.array([float(i) for i in y])
840
858
  x = []
841
859
  spread = 0
842
- try: ly = len(y[0])
860
+ try:
861
+ ly = len(y[0])
843
862
  except: ly = 1
844
863
  if ly == 1:
845
864
  # y is 1D list
846
865
  x = np.array(timestamps)
866
+ if isinstance(y[0],np.ndarray):
867
+ y = np.array(y).flatten()
847
868
  else:
848
869
  # y is list of ndarrays. Expand X.
870
+ if len(y) != len(timestamps):
871
+ printw(f'Corrupted data of {par}? nPoints {len(y)} != nStamps {len(timestamps)}')
872
+ continue
849
873
  for i,tstamp in enumerate(timestamps):
874
+ #print(f'ndarray of {par}: {i,len(y)}')
850
875
  ly = len(y[i])
851
876
  try: spread = (timestamps[i+1] - tstamp)/2
852
877
  except: pass
@@ -868,6 +893,7 @@ for extracted in allExtracted:
868
893
  #print(f'pw {cc.cell}: {plotWidget}')
869
894
  symPen,symBrush = pen.color(), pen.color()
870
895
  sym = None if nn > XRangeTooLarge else cc.symbol
896
+ #print(f'x,y of {par}: {len(x),type(x[0]),len(y),type(y[0])}')
871
897
  try:
872
898
  plotDataItem = pg.PlotDataItem(x, y, name=cc.cell,
873
899
  downsample=1, autoDownsample=False, downsampleMethod='peak',#3.6s plotting time, this is default
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "apstrim"
7
- version = "4.0.2"
7
+ version = "4.0.4"
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
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes