LLNL-PyDV 3.8.0__tar.gz → 3.8.2__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.4
2
2
  Name: LLNL-PyDV
3
- Version: 3.8.0
3
+ Version: 3.8.2
4
4
  Summary: PyDV: Python Data Visualizer
5
5
  License: BSD
6
6
  License-File: LICENSE
@@ -1613,18 +1613,6 @@ class Command(cmd.Cmd, object):
1613
1613
  [PyDV]: stats a:b
1614
1614
  [PyDV]: stats c d
1615
1615
  """
1616
-
1617
- def find_mode(array):
1618
-
1619
- try:
1620
- mode = scipy.stats.mode(array, keepdims=True)
1621
- except:
1622
- mode = scipy.stats.mode(array)
1623
- if mode.count[0] == 1 and len(array) != 1:
1624
- return numpy.nan, numpy.nan
1625
- else:
1626
- return mode.mode[0], mode.count[0]
1627
-
1628
1616
  if not line:
1629
1617
  return 0
1630
1618
 
@@ -1638,25 +1626,7 @@ class Command(cmd.Cmd, object):
1638
1626
  try:
1639
1627
  curvidx = pdvutil.getCurveIndex(line[i], self.plotlist)
1640
1628
  cur = self.plotlist[curvidx]
1641
- numx, countx = find_mode(cur.x)
1642
- numy, county = find_mode(cur.y)
1643
-
1644
- print('\nCurve ' + cur.plotname)
1645
- print('\n\t X:\t Y:')
1646
- print(f'\n\tlength: {len(cur.x):<15.10g}\t{len(cur.y):<15.10g}')
1647
- print(f'\tmean: {numpy.mean(cur.x):<15.10g}\t{numpy.mean(cur.y):<15.10g}')
1648
- print(f'\tmedian: {numpy.median(cur.x):<15.10g}\t{numpy.median(cur.y):<15.10g}')
1649
- print(f'\tmode: {numx:<15.10g}\t{numy:<15.10g}')
1650
- print(f'\t count: {countx:<15.10g}\t{county:<15.10g}')
1651
- print(f'\tstd: {numpy.std(cur.x):<15.10g}\t{numpy.std(cur.y):<15.10g}')
1652
- print(f'\tskew: {scipy.stats.skew(cur.x):<15.10g}\t{scipy.stats.skew(cur.y):<15.10g}')
1653
- print(f'\tkurtosis: {scipy.stats.kurtosis(cur.x):<15.10g}\t{scipy.stats.kurtosis(cur.y):<15.10g}') # noqae501
1654
- print(f'\tmin: {numpy.min(cur.x):<15.10g}\t{numpy.min(cur.y):<15.10g}')
1655
- print(f'\t25%: {numpy.quantile(cur.x,.25):<15.10g}\t{numpy.quantile(cur.y,.25):<15.10g}')
1656
- print(f'\t50%: {numpy.quantile(cur.x,.50):<15.10g}\t{numpy.quantile(cur.y,.50):<15.10g}')
1657
- print(f'\t75%: {numpy.quantile(cur.x,.75):<15.10g}\t{numpy.quantile(cur.y,.75):<15.10g}')
1658
- print(f'\tmax: {numpy.max(cur.x):<15.10g}\t{numpy.max(cur.y):<15.10g}')
1659
- print(f'\tsum: {numpy.sum(cur.x):<15.10g}\t{numpy.sum(cur.y):<15.10g}')
1629
+ pydvpy.stats(cur)
1660
1630
 
1661
1631
  except pdvutil.CurveIndexError:
1662
1632
  pass
@@ -233,13 +233,13 @@ class Plotter(QMainWindow):
233
233
  # Create or clear table
234
234
  if self._tableWidget is None:
235
235
  self._tableWidget = QTableWidget(rows, cols, self)
236
- self._tableWidget.setEditTriggers(QAbstractItemView.NoEditTriggers)
236
+ self._tableWidget.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
237
237
  self._tableWidget.setHorizontalHeaderLabels(headerLabels)
238
238
  self._tableWidget.setAlternatingRowColors(True)
239
- self._tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
239
+ self._tableWidget.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
240
240
 
241
241
  # Setup Right-click menu
242
- self._tableWidget.setContextMenuPolicy(Qt.ActionsContextMenu)
242
+ self._tableWidget.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)
243
243
  deleteCurveAction = QAction("Delete selected curve(s)", self._tableWidget)
244
244
  deleteCurveAction.triggered.connect(self.__deleteCurve)
245
245
  self._tableWidget.addAction(deleteCurveAction)
@@ -257,7 +257,7 @@ class Plotter(QMainWindow):
257
257
  if c.edited:
258
258
  prefix = '*'
259
259
  plotnameItem = QTableWidgetItem(self.tr("%s%s" % (prefix, c.plotname)))
260
- plotnameItem.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
260
+ plotnameItem.setTextAlignment(Qt.AlignmentFlag.AlignHCenter | Qt.AlignmentFlag.AlignVCenter)
261
261
  self._tableWidget.setItem(row, col, plotnameItem)
262
262
  col += 1
263
263
 
@@ -324,7 +324,7 @@ class Plotter(QMainWindow):
324
324
  vbox.addWidget(scroll)
325
325
 
326
326
  hbox = QHBoxLayout(self._listDialog)
327
- hbox.setAlignment(Qt.AlignCenter)
327
+ hbox.setAlignment(Qt.AlignmentFlag.AlignCenter)
328
328
 
329
329
  # Dismiss Button
330
330
  okButton = QPushButton(self._listDialog)
@@ -361,13 +361,13 @@ class Plotter(QMainWindow):
361
361
  # Create or clear table
362
362
  if self._menuTableWidget is None:
363
363
  self._menuTableWidget = QTableWidget(rows, cols, self)
364
- self._menuTableWidget.setEditTriggers(QAbstractItemView.NoEditTriggers)
364
+ self._menuTableWidget.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
365
365
  self._menuTableWidget.setHorizontalHeaderLabels(headerLabels)
366
366
  self._menuTableWidget.setAlternatingRowColors(True)
367
- self._menuTableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
367
+ self._menuTableWidget.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
368
368
 
369
369
  # Setup Right-click menu
370
- self._menuTableWidget.setContextMenuPolicy(Qt.ActionsContextMenu)
370
+ self._menuTableWidget.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)
371
371
  plotCurveAction = QAction("Plot selected curve(s)", self._menuTableWidget)
372
372
  plotCurveAction.triggered.connect(self.__plotMenuCurve)
373
373
  self._menuTableWidget.addAction(plotCurveAction)
@@ -456,7 +456,7 @@ class Plotter(QMainWindow):
456
456
  vbox.addWidget(scroll)
457
457
 
458
458
  hbox = QHBoxLayout(self._menuDialog)
459
- hbox.setAlignment(Qt.AlignCenter)
459
+ hbox.setAlignment(Qt.AlignmentFlag.AlignCenter)
460
460
 
461
461
  # Dismiss Button
462
462
  okButton = QPushButton(self._menuDialog)
@@ -560,7 +560,7 @@ class Plotter(QMainWindow):
560
560
  okButton.setMinimumSize(100, 20)
561
561
  okButton.setMaximumSize(100, 20)
562
562
  okButton.setText('OK')
563
- hbox.addWidget(okButton, Qt.AlignCenter)
563
+ hbox.addWidget(okButton, Qt.AlignmentFlag.AlignCenter)
564
564
  vbox.addLayout(hbox)
565
565
 
566
566
  copy_dialog.resize(300, 500)
@@ -2046,8 +2046,9 @@ def xmax(curvelist, max):
2046
2046
  curves = _convert_to_curvelist(curvelist)
2047
2047
 
2048
2048
  for c in curves:
2049
- c.x = c.x[np.where(c.x <= float(max))]
2050
- c.y = c.y[np.where(c.x <= float(max))]
2049
+ mask = np.where(c.x <= float(max))
2050
+ c.x = c.x[mask]
2051
+ c.y = c.y[mask]
2051
2052
 
2052
2053
 
2053
2054
  def xmin(curvelist, min):
@@ -2063,8 +2064,9 @@ def xmin(curvelist, min):
2063
2064
  curves = _convert_to_curvelist(curvelist)
2064
2065
 
2065
2066
  for c in curves:
2066
- c.x = c.x[np.where(c.x >= float(min))]
2067
- c.y = c.y[np.where(c.x >= float(min))]
2067
+ mask = np.where(c.x >= float(min))
2068
+ c.x = c.x[mask]
2069
+ c.y = c.y[mask]
2068
2070
 
2069
2071
 
2070
2072
  def xminmax(curvelist, min, max):
@@ -2082,8 +2084,9 @@ def xminmax(curvelist, min, max):
2082
2084
  curves = _convert_to_curvelist(curvelist)
2083
2085
 
2084
2086
  for c in curves:
2085
- c.x = c.x[np.where(np.logical_and(c.x >= float(min), c.x <= float(max)))]
2086
- c.y = c.y[np.where(np.logical_and(c.x >= float(min), c.x <= float(max)))]
2087
+ mask = np.where(np.logical_and(c.x >= float(min), c.x <= float(max)))
2088
+ c.x = c.x[mask]
2089
+ c.y = c.y[mask]
2087
2090
 
2088
2091
 
2089
2092
  def ymax(curvelist, max):
@@ -2099,8 +2102,9 @@ def ymax(curvelist, max):
2099
2102
  curves = _convert_to_curvelist(curvelist)
2100
2103
 
2101
2104
  for c in curves:
2102
- c.x = c.x[np.where(c.y <= float(max))]
2103
- c.y = c.y[np.where(c.y <= float(max))]
2105
+ mask = np.where(c.y <= float(max))
2106
+ c.x = c.x[mask]
2107
+ c.y = c.y[mask]
2104
2108
 
2105
2109
 
2106
2110
  def ymin(curvelist, min):
@@ -2116,8 +2120,9 @@ def ymin(curvelist, min):
2116
2120
  curves = _convert_to_curvelist(curvelist)
2117
2121
 
2118
2122
  for c in curves:
2119
- c.x = c.x[np.where(c.y >= float(min))]
2120
- c.y = c.y[np.where(c.y >= float(min))]
2123
+ mask = np.where(c.y >= float(min))
2124
+ c.x = c.x[mask]
2125
+ c.y = c.y[mask]
2121
2126
 
2122
2127
 
2123
2128
  def yminmax(curvelist, min, max):
@@ -2135,8 +2140,9 @@ def yminmax(curvelist, min, max):
2135
2140
  curves = _convert_to_curvelist(curvelist)
2136
2141
 
2137
2142
  for c in curves:
2138
- c.x = c.x[np.where(np.logical_and(c.y >= float(min), c.y <= float(max)))]
2139
- c.y = c.y[np.where(np.logical_and(c.y >= float(min), c.y <= float(max)))]
2143
+ mask = np.where(np.logical_and(c.y >= float(min), c.y <= float(max)))
2144
+ c.x = c.x[mask]
2145
+ c.y = c.y[mask]
2140
2146
 
2141
2147
 
2142
2148
  def yn(curvelist, n):
@@ -3324,6 +3330,45 @@ def getnumpoints(curve):
3324
3330
  return len(curve.x)
3325
3331
 
3326
3332
 
3333
+ def stats(curve):
3334
+ """
3335
+ Print statistics of the given curve.
3336
+
3337
+ :param curve: The given curve
3338
+ """
3339
+
3340
+ def find_mode(array):
3341
+
3342
+ try:
3343
+ mode = scipy.stats.mode(array, keepdims=True)
3344
+ except:
3345
+ mode = scipy.stats.mode(array)
3346
+ if mode.count[0] == 1 and len(array) != 1:
3347
+ return np.nan, np.nan
3348
+ else:
3349
+ return mode.mode[0], mode.count[0]
3350
+
3351
+ numx, countx = find_mode(curve.x)
3352
+ numy, county = find_mode(curve.y)
3353
+
3354
+ print('\nCurve ' + curve.plotname)
3355
+ print('\n\t X:\t Y:')
3356
+ print(f'\n\tlength: {len(curve.x):<15.10g}\t{len(curve.y):<15.10g}')
3357
+ print(f'\tmean: {np.mean(curve.x):<15.10g}\t{np.mean(curve.y):<15.10g}')
3358
+ print(f'\tmedian: {np.median(curve.x):<15.10g}\t{np.median(curve.y):<15.10g}')
3359
+ print(f'\tmode: {numx:<15.10g}\t{numy:<15.10g}')
3360
+ print(f'\t count: {countx:<15.10g}\t{county:<15.10g}')
3361
+ print(f'\tstd: {np.std(curve.x):<15.10g}\t{np.std(curve.y):<15.10g}')
3362
+ print(f'\tskew: {scipy.stats.skew(curve.x):<15.10g}\t{scipy.stats.skew(curve.y):<15.10g}')
3363
+ print(f'\tkurtosis: {scipy.stats.kurtosis(curve.x):<15.10g}\t{scipy.stats.kurtosis(curve.y):<15.10g}') # noqae501
3364
+ print(f'\tmin: {np.min(curve.x):<15.10g}\t{np.min(curve.y):<15.10g}')
3365
+ print(f'\t25%: {np.quantile(curve.x,.25):<15.10g}\t{np.quantile(curve.y,.25):<15.10g}')
3366
+ print(f'\t50%: {np.quantile(curve.x,.50):<15.10g}\t{np.quantile(curve.y,.50):<15.10g}')
3367
+ print(f'\t75%: {np.quantile(curve.x,.75):<15.10g}\t{np.quantile(curve.y,.75):<15.10g}')
3368
+ print(f'\tmax: {np.max(curve.x):<15.10g}\t{np.max(curve.y):<15.10g}')
3369
+ print(f'\tsum: {np.sum(curve.x):<15.10g}\t{np.sum(curve.y):<15.10g}')
3370
+
3371
+
3327
3372
  def getrange(curvelist):
3328
3373
  """
3329
3374
  Get the range of the curve or list of curves.
@@ -0,0 +1 @@
1
+ 10.22.2025
@@ -0,0 +1 @@
1
+ 3.8.2
@@ -1,7 +1,7 @@
1
1
  [tool]
2
2
  [tool.poetry]
3
3
  name = "LLNL-PyDV"
4
- version = "3.8.0"
4
+ version = "3.8.2"
5
5
  description = "PyDV: Python Data Visualizer"
6
6
  license = "BSD"
7
7
  classifiers = [
@@ -64,7 +64,7 @@ build-backend = "poetry.core.masonry.api"
64
64
  line-length = 79
65
65
 
66
66
  [tool.bumpver]
67
- current_version = "3.8.0"
67
+ current_version = "3.8.2"
68
68
  version_pattern = "MAJOR.MINOR.PATCH"
69
69
  commit_message = "bump version {old_version} -> {new_version}"
70
70
  commit = true
@@ -1 +0,0 @@
1
- 09.02.2025
@@ -1 +0,0 @@
1
- 3.8.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes