LLNL-PyDV 3.6.1__tar.gz → 3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: LLNL-PyDV
3
- Version: 3.6.1
3
+ Version: 3.7.0
4
4
  Summary: PyDV: Python Data Visualizer
5
5
  License: BSD
6
6
  Author: Sarah El-Jurf
@@ -76,6 +76,8 @@ class Curve(object):
76
76
  title='',
77
77
  record_id='',
78
78
  step=False,
79
+ step_original_x=np.empty(0),
80
+ step_original_y=np.empty(0),
79
81
  xticks_labels=None,
80
82
  plotname='',
81
83
  color='',
@@ -108,6 +110,8 @@ class Curve(object):
108
110
  self.title = title
109
111
  self.record_id = record_id
110
112
  self.step = step
113
+ self.step_original_x = step_original_x,
114
+ self.step_original_y = step_original_y,
111
115
  self.xticks_labels = xticks_labels
112
116
  self.plotname = plotname
113
117
  self.color = color
@@ -254,6 +258,8 @@ class Curve(object):
254
258
  title=self.title,
255
259
  record_id=self.record_id,
256
260
  step=self.step,
261
+ step_original_x=self.step_original_x,
262
+ step_original_y=self.step_original_y,
257
263
  xticks_labels=self.xticks_labels,
258
264
  plotname=self.plotname,
259
265
  color=self.color,
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env bash
2
+ pth=$(realpath $0)
3
+ pth=$(dirname $pth)
4
+ pth="$pth/pdv_launcher.py $*"
5
+
6
+ if [[ $pth == *"pdv-sa"* ]]; then
7
+
8
+ /usr/tce/bin/python3 $pth
9
+
10
+ else
11
+
12
+ FILE="/usr/apps/weave/weave-prod-cpu/bin/activate"
13
+
14
+ if [ -e "$FILE" ]; then
15
+
16
+ source $FILE
17
+
18
+ fi
19
+
20
+ python3 $pth
21
+
22
+ fi
@@ -258,6 +258,7 @@ class Command(cmd.Cmd, object):
258
258
  tightlayout = 0
259
259
  group = 0
260
260
  slashes = 100
261
+ do_label_done = False
261
262
 
262
263
  # Users wanted support for automatically loading some plot attributes. The
263
264
  # following commands handle the situations where there are multiple plots or
@@ -1353,7 +1354,12 @@ class Command(cmd.Cmd, object):
1353
1354
  return 0
1354
1355
  if "*." in line:
1355
1356
  for fdx in range(len(self.filelist)):
1356
- temp_line = line.replace("*", chr(ord('a') + fdx))
1357
+
1358
+ if fdx < 26:
1359
+ temp_line = line.replace("*", chr(ord('a') + fdx))
1360
+ else:
1361
+ temp_line = line.replace("*", f"@{fdx + 1}")
1362
+
1357
1363
  if len(line.split(':')) > 1: # check for list notation
1358
1364
  self.do_curve(pdvutil.getnumberargs(temp_line, self.filelist))
1359
1365
  else:
@@ -1368,8 +1374,15 @@ class Command(cmd.Cmd, object):
1368
1374
  for i in range(len(line)):
1369
1375
  curvedex = 0
1370
1376
  skip = False
1371
- if ord('A') <= ord(line[i][0].upper()) <= ord('Z'): # check for a.% b.% file index notation
1372
- filedex = ord(line[i][0].upper()) - ord('A') # file index we want
1377
+
1378
+ # check for a.% b.% @#. file index notation
1379
+ if ord('A') <= ord(line[i][0].upper()) <= ord('Z') or '@' in line[i]:
1380
+
1381
+ if ord('A') <= ord(line[i][0].upper()) <= ord('Z'):
1382
+ filedex = ord(line[i][0].upper()) - ord('A') # file index we want
1383
+ else:
1384
+ filedex = int(line[i].split(".")[0].replace("@", "")) - 1 # 0 index
1385
+
1373
1386
  prevfile = '' # set prevfile to impossible value
1374
1387
  filecounter = 0
1375
1388
  fileend = 0
@@ -1385,9 +1398,9 @@ class Command(cmd.Cmd, object):
1385
1398
  curvedex += int(line[i].split('.')[-1]) - 1
1386
1399
  if curvedex + 1 > fileend:
1387
1400
  filestart = fileend - self.filelist[filedex][1] + 1
1388
- print('error: curve index out of bounds')
1389
- print(f"\tFile {self.filelist[filedex]}: Start {filestart}, End {fileend}")
1390
- print(f"\tRequested Curve {line[i]}")
1401
+ print(f"File {filedex + 1}: {self.filelist[filedex]}: Start {filestart}, End {fileend}")
1402
+ print(f"\tRequested Curve {line[i]}: {curvedex + 1}")
1403
+ print('\tError: curve index out of bounds')
1391
1404
  skip = True
1392
1405
  elif 0 < int(line[i]) <= len(self.curvelist):
1393
1406
  curvedex = int(line[i]) - 1
@@ -1565,6 +1578,80 @@ class Command(cmd.Cmd, object):
1565
1578
  print('\n Display the mean and standard deviation for the given curves.'
1566
1579
  '\n usage: stats <curve-list>\n')
1567
1580
 
1581
+ def do_deltax(self, line):
1582
+ """
1583
+ Create new curve that calculates difference between its own X points. Delta X vs # of points - 1.
1584
+ """
1585
+
1586
+ if not line:
1587
+ return 0
1588
+
1589
+ if len(line.split(':')) > 1:
1590
+ self.do_deltax(pdvutil.getletterargs(line))
1591
+ return 0
1592
+ else:
1593
+ try:
1594
+ line = line.split()
1595
+ for i in range(len(line)):
1596
+ try:
1597
+ curvidx = pdvutil.getCurveIndex(line[i], self.plotlist)
1598
+ cur = self.plotlist[curvidx]
1599
+
1600
+ c = pydvpy.makecurve(x=range(len(cur.x) - 1),
1601
+ y=cur.x[1:] - cur.x[:-1],
1602
+ name=f"{cur.name} Delta X", # we name the curve with the input 'line'
1603
+ plotname=self.getcurvename()) # get the next available data ID label
1604
+ self.addtoplot(c)
1605
+
1606
+ except pdvutil.CurveIndexError:
1607
+ pass
1608
+ except:
1609
+ if self.debug:
1610
+ traceback.print_exc(file=sys.stdout)
1611
+ finally:
1612
+ self.redraw = True
1613
+
1614
+ def help_deltax(self):
1615
+ print('\n Create new curve that calculates difference between its own X points. Delta X vs # of points - 1.'
1616
+ '\n usage: deltax <curve-list>\n')
1617
+
1618
+ def do_deltay(self, line):
1619
+ """
1620
+ Create new curve that calculates difference between its own Y points. Delta Y vs # of points - 1.
1621
+ """
1622
+
1623
+ if not line:
1624
+ return 0
1625
+
1626
+ if len(line.split(':')) > 1:
1627
+ self.do_deltay(pdvutil.getletterargs(line))
1628
+ return 0
1629
+ else:
1630
+ try:
1631
+ line = line.split()
1632
+ for i in range(len(line)):
1633
+ try:
1634
+ curvidx = pdvutil.getCurveIndex(line[i], self.plotlist)
1635
+ cur = self.plotlist[curvidx]
1636
+
1637
+ c = pydvpy.makecurve(x=range(len(cur.y) - 1),
1638
+ y=cur.y[1:] - cur.y[:-1],
1639
+ name=f"{cur.name} Delta Y", # we name the curve with the input 'line'
1640
+ plotname=self.getcurvename()) # get the next available data ID label
1641
+ self.addtoplot(c)
1642
+
1643
+ except pdvutil.CurveIndexError:
1644
+ pass
1645
+ except:
1646
+ if self.debug:
1647
+ traceback.print_exc(file=sys.stdout)
1648
+ finally:
1649
+ self.redraw = True
1650
+
1651
+ def help_deltay(self):
1652
+ print('\n Create new curve that calculates difference between its own Y points. Delta Y vs # of points - 1.'
1653
+ '\n usage: deltay <curve-list>\n')
1654
+
1568
1655
  def do_getattributes(self, line):
1569
1656
  """
1570
1657
  Return a curve's attributes
@@ -4495,11 +4582,8 @@ class Command(cmd.Cmd, object):
4495
4582
  ('densely_dashdotdotted', '(0, (3, 1, 1, 1, 1, 1))')]
4496
4583
 
4497
4584
  for i, filename in enumerate(groups):
4498
- if i < 14:
4499
- curves_ = " ".join(groups[filename])
4500
- self.do_lnstyle(curves_ + ' ' + styles[i][0].replace("'", ""))
4501
- else:
4502
- print('There are only fourteen linestyles available. Please reduce the number of files.')
4585
+ curves_ = " ".join(groups[filename])
4586
+ self.do_lnstyle(curves_ + ' ' + styles[i % len(styles)][0].replace("'", ""))
4503
4587
 
4504
4588
  # Setting Colors at the curve level
4505
4589
  curve_names = []
@@ -4520,11 +4604,8 @@ class Command(cmd.Cmd, object):
4520
4604
  colors = plt.rcParams['axes.prop_cycle'].by_key()['color']
4521
4605
 
4522
4606
  for i, curve_name in enumerate(groups):
4523
- if i < 10:
4524
- curves_ = " ".join(groups[curve_name])
4525
- self.do_color(curves_ + ' ' + colors[i].replace("'", ""))
4526
- else:
4527
- print('There are only ten colors available. Please reduce the number of same name curves.')
4607
+ curves_ = " ".join(groups[curve_name])
4608
+ self.do_color(curves_ + ' ' + colors[i % len(colors)].replace("'", ""))
4528
4609
 
4529
4610
  for cur in self.plotlist:
4530
4611
  path = os.path.normpath(cur.filename)
@@ -4540,10 +4621,10 @@ class Command(cmd.Cmd, object):
4540
4621
  if len(curve_names) == 1 and title_update:
4541
4622
  self.do_title(f"{curve_names[0].strip()}")
4542
4623
 
4543
- if not self.group:
4624
+ if not self.group or len(files) == 1:
4544
4625
  for i, cur in enumerate(self.plotlist):
4545
4626
  self.do_label(f"{cur.plotname} {cur._original_name}")
4546
- temp_color = colors[i].replace("'", "")
4627
+ temp_color = colors[i % len(colors)].replace("'", "")
4547
4628
  self.do_color(f"{cur.plotname} {temp_color}")
4548
4629
  self.do_lnstyle(f"{cur.plotname} solid")
4549
4630
  self.slashes = 100
@@ -5815,7 +5896,7 @@ class Command(cmd.Cmd, object):
5815
5896
 
5816
5897
  def do_linemarker(self, line):
5817
5898
  """
5818
- Set the marker symbol for the curves
5899
+ Set the marker symbol and marker size for the curves
5819
5900
  """
5820
5901
 
5821
5902
  if not line:
@@ -6679,16 +6760,18 @@ class Command(cmd.Cmd, object):
6679
6760
  """
6680
6761
 
6681
6762
  try:
6682
- if len(line.split(':')) > 1:
6763
+ if len(line.split(':')) > 1 and not self.do_label_done:
6764
+ self.do_label_done = True
6683
6765
  self.do_label(pdvutil.getletterargs(line))
6684
6766
  return 0
6685
6767
  else:
6686
- line_labels = line.split('#')[1:] # First entry will be curves
6768
+ self.do_label_done = False
6769
+ line_labels = line.split('`')[1:] # First entry will be curves
6687
6770
 
6688
6771
  if line_labels: # Multiple curves and labels
6689
- curves = line.split('#')[0].split()
6772
+ curves = line.split('`')[0].split()
6690
6773
  else: # single curve and label
6691
- curves = line.split()[0]
6774
+ curves = [line.split()[0]]
6692
6775
  line_labels = [' '.join(line.split()[1:])]
6693
6776
 
6694
6777
  for i in range(len(curves)):
@@ -6698,16 +6781,17 @@ class Command(cmd.Cmd, object):
6698
6781
 
6699
6782
  self.plotedit = True
6700
6783
  except:
6784
+ self.do_label_done = False
6701
6785
  print('error - usage: label <curve> <new-label>\n')
6702
- print('For multiple curves, each label must start with #')
6703
- print('label a:c #mynewlabel #my other label #my thirdlabel')
6786
+ print('For multiple curves, each label must start with `')
6787
+ print('label a:c `mynewlabel `my other label `my thirdlabel')
6704
6788
  if self.debug:
6705
6789
  traceback.print_exc(file=sys.stdout)
6706
6790
 
6707
6791
  def help_label(self):
6708
6792
  print('\n Procedure: Change the key and list label for a curve\n Usage: label <curve> <new-label>\n')
6709
- print(' For multiple curves, each label must start with #')
6710
- print(' label a:c #mynewlabel #my other label #my thirdlabel')
6793
+ print(' For multiple curves, each label must start with `')
6794
+ print(' label a:c `mynewlabel `my other label `my thirdlabel')
6711
6795
 
6712
6796
  def do_labelrecordids(self, line):
6713
6797
  """
@@ -7644,10 +7728,7 @@ class Command(cmd.Cmd, object):
7644
7728
  xmin = 1e-2
7645
7729
  for cur in orderlist:
7646
7730
  if not cur.hidden:
7647
- xdat = numpy.array(cur.x)
7648
- for i in range(len(xdat)):
7649
- if xdat[i] < 1e-300:
7650
- xdat[i] = 1e301
7731
+ xdat = numpy.where(cur.x < 1e-300, 1e301, cur.x)
7651
7732
  localmin = min(xdat)
7652
7733
  if localmin and localmin < xmin:
7653
7734
  xmin = localmin
@@ -8511,13 +8592,9 @@ class Command(cmd.Cmd, object):
8511
8592
  xdat = numpy.array(cur.x)
8512
8593
  ydat = numpy.array(cur.y)
8513
8594
  if yls:
8514
- for i in range(len(ydat)):
8515
- if (ydat[i] < 0):
8516
- ydat[i] = 1e-301 # custom ydata clipping
8595
+ ydat = numpy.where(ydat < 0, 1e-301, ydat) # custom ydata clipping
8517
8596
  if xls:
8518
- for i in range(len(xdat)):
8519
- if xdat[i] < 0:
8520
- xdat[i] = 1e-301 # custom ydata clipping
8597
+ xdat = numpy.where(xdat < 0, 1e-301, xdat) # custom ydata clipping
8521
8598
 
8522
8599
  if cur.ebar is not None:
8523
8600
  plt.errorbar(xdat,
@@ -1,5 +1,3 @@
1
- #!/usr/bin/env /usr/apps/weave/weave-prod-cpu/bin/python3
2
-
3
1
  import sys
4
2
  import os
5
3
 
@@ -14,4 +12,3 @@ try:
14
12
  except ImportError:
15
13
  import pydv.pdv
16
14
  pydv.pdv.Command().main()
17
-
@@ -60,6 +60,7 @@
60
60
  # endorsement purposes.
61
61
 
62
62
  import numpy as np
63
+ import re
63
64
 
64
65
 
65
66
  class CurveIndexError(ValueError):
@@ -203,11 +204,16 @@ def getnumberargs(line, filelist):
203
204
  arglist += nolist + ' '
204
205
  start = line[i].split()[-1]
205
206
  end = line[i + 1].split()[0]
206
- # File notation e.g. a.1:a.10
207
+ # File notation e.g. a.1:a.10 and @#.
207
208
  filedex = None
208
209
  filestart = 0
209
210
  if (len(start.split('.')) > 1):
210
- filedex = ord(start[0].upper()) - ord('A')
211
+
212
+ if ord('A') <= ord(start[0].upper()) <= ord('Z'):
213
+ filedex = ord(start[0].upper()) - ord('A')
214
+ else:
215
+ filedex = int(start.split(".")[0].replace("@", "")) - 1 # 0 index
216
+
211
217
  start = start.split('.')[-1]
212
218
  if (filedex != 0):
213
219
  for f in range(filedex):
@@ -216,7 +222,12 @@ def getnumberargs(line, filelist):
216
222
  filestart += 1
217
223
  fileend = 0
218
224
  if (len(end.split('.')) > 1):
219
- filedex = ord(end[0].upper()) - ord('A')
225
+
226
+ if ord('A') <= ord(end[0].upper()) <= ord('Z'):
227
+ filedex = ord(end[0].upper()) - ord('A')
228
+ else:
229
+ filedex = int(end.split(".")[0].replace("@", "")) - 1 # 0 index
230
+
220
231
  end = end.split('.')[-1]
221
232
  if (filedex != 0):
222
233
  for f in range(filedex):
@@ -231,45 +242,49 @@ def getnumberargs(line, filelist):
231
242
  step = 1
232
243
  if filedex is not None:
233
244
  if int(start) > fileend and int(end) > fileend:
234
- print(f"File {filelist[filedex]}: Start {filestart}, End {fileend}")
245
+ print(f"File {filedex + 1}: {filelist[filedex]}: Start {filestart}, End {fileend}")
235
246
  print(f"\tRequested Start {start}, End {end}")
236
247
  print(f'\tStart {start} and End {end} is greater than file end {fileend}')
237
248
  print("\tThis range will not be plotted")
238
249
  ignore = True
239
250
  elif int(start) > fileend:
240
- print(f"File {filelist[filedex]}: Start {filestart}, End {fileend}")
251
+ print(f"File {filedex + 1}: {filelist[filedex]}: Start {filestart}, End {fileend}")
241
252
  print(f"\tRequested Start {start}, End {end}")
242
253
  print(f'\tStart {start} is greater than file end {fileend}')
243
254
  start = str(fileend)
244
255
  print(f'\tSetting Start to {start}')
256
+ print(f'\tNew Start {start} and New End {end}')
245
257
  elif int(end) > fileend:
246
- print(f"File {filelist[filedex]}: Start {filestart}, End {fileend}")
258
+ print(f"File {filedex + 1}: {filelist[filedex]}: Start {filestart}, End {fileend}")
247
259
  print(f"\tRequested Start {start}, End {end}")
248
260
  print(f'\tEnd {end} is greater than file end {fileend}')
249
261
  end = str(fileend)
250
262
  print(f'\tSetting End to {end}')
263
+ print(f'\tNew Start {start} and New End {end}')
251
264
  delta = int(end) - int(start)
252
265
  else:
253
266
  step = -1
254
267
  if filedex is not None:
255
268
  if int(end) > fileend and int(start) > fileend:
256
- print(f"File {filelist[filedex]}: Start {filestart}, End {fileend}")
269
+ print(f"File {filedex + 1}: {filelist[filedex]}: Start {filestart}, End {fileend}")
257
270
  print(f"\tRequested Start {end}, End {start}")
258
271
  print(f'\tStart {end} and End {start} is greater than file end {fileend}')
259
272
  print("\tThis range will not be plotted")
260
273
  ignore = True
261
274
  elif int(end) > fileend:
262
- print(f"File {filelist[filedex]}: Start {filestart}, End {fileend}")
275
+ print(f"File {filedex + 1}: {filelist[filedex]}: Start {filestart}, End {fileend}")
263
276
  print(f"\tRequested Start {end}, End {start}")
264
277
  print(f'\tStart {end} is greater than file end {fileend}')
265
278
  end = str(fileend)
266
279
  print(f'\tSetting Start to {end}')
280
+ print(f'\tNew Start {end} and New End {start}')
267
281
  elif int(start) > fileend:
268
- print(f"File {filelist[filedex]}: Start {filestart}, End {fileend}")
282
+ print(f"File {filedex + 1}: {filelist[filedex]}: Start {filestart}, End {fileend}")
269
283
  print(f"\tRequested Start {end}, End {start}")
270
284
  print(f'\tEnd {start} is greater than file end {fileend}')
271
285
  start = str(fileend)
272
286
  print(f'\tSetting End to {start}')
287
+ print(f'\tNew Start {end} and New End {start}')
273
288
  delta = int(end) - int(start)
274
289
  for j in range(int(start), int(start) + delta + step, step):
275
290
  args += str(j) + ' '
@@ -288,7 +303,16 @@ def getletterargs(line):
288
303
  Get a full list of arguments from compact list or mixed notation (ex a:d)
289
304
  """
290
305
 
291
- line = line.split(':') # begin arduous list parsing
306
+ if "`" in line: # list of multiple label names from do_label()
307
+ label_line = line.split("`", 1)
308
+ temp_line = label_line[0].split(':')
309
+ temp_line[-1] = temp_line[-1] + "`" + label_line[1]
310
+ line = temp_line
311
+ elif len(re.split(r"(^[a-zA-Z]:[a-zA-Z]$)|(^[a-zA-Z]:@\d+$)|(^@\d+:@\d+$)", line)) == 1: # single label w/ :
312
+ return line
313
+ else:
314
+ line = line.split(':') # begin arduous list parsing
315
+
292
316
  arglist = ''
293
317
  if len(line) > 1:
294
318
  for i in range(len(line)):