LLNL-PyDV 3.4.3__py3-none-any.whl

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.
@@ -0,0 +1,60 @@
1
+ Copyright (c) 2011-2024, Lawrence Livermore National Security, LLC.
2
+ Produced at the Lawrence Livermore National Laboratory
3
+ Written by Mason Kwiat, Douglas S. Miller, and Kevin Griffin, Ephraim Rusu, Sarah El-Jurf, Jorge Moreno
4
+ e-mail: eljurf11@llnl.gov, moreno45@llnl.gov
5
+ LLNL-CODE-507071
6
+ All rights reserved.
7
+
8
+ This file is part of PDV. For details, see <https://lc.llnl.gov/confluence/pages/viewpage.action?spaceKey=PYDV&title=PyDV%3A+Python+Data+Visualizer>.
9
+ Please also read "Additional BSD Notice".
10
+
11
+ Redistribution and use in source and binary forms, with or without
12
+ modification, are permitted provided that the following conditions
13
+ are met:
14
+
15
+ Redistributions of source code must retain the above copyright
16
+ notice, this list of conditions and the disclaimer below.
17
+ Redistributions in binary form must reproduce the above copyright
18
+ notice, this list of conditions and the disclaimer (as noted below)
19
+ in the documentation and/or other materials provided with the
20
+ distribution. Neither the name of the LLNS/LLNL nor the names of
21
+ its contributors may be used to endorse or promote products derived
22
+ from this software without specific prior written permission.
23
+
24
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE
28
+ LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR
29
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
32
+ USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
33
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36
+ SUCH DAMAGE.
37
+
38
+ Additional BSD Notice
39
+
40
+ 1. This notice is required to be provided under our contract with
41
+ the U.S. Department of Energy (DOE). This work was produced at
42
+ Lawrence Livermore National Laboratory under Contract
43
+ No. DE-AC52-07NA27344 with the DOE.
44
+
45
+ 2. Neither the United States Government nor Lawrence Livermore
46
+ National Security, LLC nor any of their employees, makes any
47
+ warranty, express or implied, or assumes any liability or
48
+ responsibility for the accuracy, completeness, or usefulness of any
49
+ information, apparatus, product, or process disclosed, or represents
50
+ that its use would not infringe privately-owned rights.
51
+
52
+ 3. Also, reference herein to any specific commercial products,
53
+ process, or services by trade name, trademark, manufacturer or
54
+ otherwise does not necessarily constitute or imply its endorsement,
55
+ recommendation, or favoring by the United States Government or
56
+ Lawrence Livermore National Security, LLC. The views and opinions
57
+ of authors expressed herein do not necessarily state or reflect
58
+ those of the United States Government or Lawrence Livermore National
59
+ Security, LLC, and shall not be used for advertising or product
60
+ endorsement purposes.
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.1
2
+ Name: LLNL-PyDV
3
+ Version: 3.4.3
4
+ Summary: PyDV: Python Data Visualizer
5
+ Home-page: https://github.com/LLNL/PyDV
6
+ License: BSD
7
+ Author: Sarah El-Jurf
8
+ Author-email: eljurf1@llnl.gov
9
+ Maintainer: Sarah El-Jurf
10
+ Maintainer-email: eljurf1@llnl.gov
11
+ Requires-Python: >=3.6
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: BSD License
17
+ Classifier: License :: Other/Proprietary License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.6
21
+ Classifier: Programming Language :: Python :: 3.7
22
+ Classifier: Programming Language :: Python :: 3.8
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Topic :: Scientific/Engineering
28
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
29
+ Requires-Dist: PyQt5
30
+ Requires-Dist: PySide2
31
+ Requires-Dist: matplotlib
32
+ Requires-Dist: numpy
33
+ Requires-Dist: scikit-learn
34
+ Requires-Dist: scipy
35
+ Project-URL: Bug Tracker, https://github.com/LLNL/PyDV/issues
36
+ Project-URL: Documentation, https://pydv.readthedocs.io/en/latest/
37
+ Project-URL: Discussions, https://github.com/LLNL/PyDV/discussions
38
+ Description-Content-Type: text/markdown
39
+
40
+ ## PyDV
41
+
42
+ A 1D graphics and data analysis tool, heavily based on the ULTRA plotting tool.
43
+
44
+ ### PyDV Importable Interface Module ###
45
+ You can now call most of PyDV's functionality from within a Python script. Below is an example of how to do this.
46
+
47
+ import sys
48
+ sys.path.append("/usr/gapps/pydv/current")
49
+ import pydvpy as pydvif
50
+
51
+ curves = list()
52
+ curves.append(pydvif.span(1,10,6))
53
+ pydvif.save('myFile.txt', curves)
54
+
55
+ ## Documentation
56
+
57
+ [PyDV Users Manual](https://pydv.readthedocs.io/en/latest/) [![Documentation Status](https://readthedocs.org/projects/pydv/badge/?version=latest)](https://pydv.readthedocs.io/en/latest/?badge=latest)
58
+
59
+ ## License
60
+
61
+ PyDV is distributed under the terms of the [BSD-3 License](LICENSE)
62
+
63
+ All new contributions must be made under the [BSD-3 License](LICENSE)
64
+
65
+ See [LICENSE](LICENSE) for details.
66
+
67
+ LLNL-CODE-507071
68
+
@@ -0,0 +1,21 @@
1
+ pydv/NOTES,sha256=GJJBUPtflXyav9es8KfWXIZi691EhxvzQiGg5m-gC48,1466
2
+ pydv/README.md,sha256=vicxwbT1JDVxWuMVaqkEXJQEBEgtJEjlOd92DXLpjIc,1014
3
+ pydv/__init__.py,sha256=IFiiy2sFQuZxeaAqVebdM2Iyp53p4yHA4BjBbBFU27U,72
4
+ pydv/curve.py,sha256=iId5H-UiieN1SaeDWM58X7FPB2m7P7YEheX67-INpcc,11564
5
+ pydv/img/app_icon3.png,sha256=Bb0_DvrZWyj478dAnJ-8wb6BKqN1CnZOz9Qgk0ru-yg,648
6
+ pydv/img/window-code-7.png,sha256=-ASYO3unIlbABwq_3MuEXBL4g2Ruo0CBRcpTyJ5NlPY,232
7
+ pydv/img/window-code-7@2x.png,sha256=i7v_GKXKuVqmNH-h-pBMBa9juZ7_yYZ_T3A9h_ykxt4,417
8
+ pydv/pdv,sha256=TagiVokxyLWxakRwpkI-PVPLlBw4vW5E1_KDUGtbb1w,278
9
+ pydv/pdv.py,sha256=UsSWerO2FGye5KWEmm8LsqSfW8IFH9Sf1DORwLi66Gg,327119
10
+ pydv/pdvnavbar.py,sha256=QO6wJmLvFEh59LFHPwrt9KKh34M_pjIlDjKqlz9aD3o,3644
11
+ pydv/pdvplot.py,sha256=YCuCYSVcMGLmjVPXTx5WeI4Uo1I1pAWfiGa9Aj3G0u0,27560
12
+ pydv/pdvutil.py,sha256=3RnX422di7OOSCKUz_Y_ICh76IXr4TutQYfj4AGyBdk,11501
13
+ pydv/pydvpy.py,sha256=WnStYInG4bYFrr-JkSmbajpxIsk7A6UVOtT8UD3SXdg,125595
14
+ pydv/scripts/date.txt,sha256=VAgcesSClo65LVe0FB38UCRzjDg1Rn8_gmXvlxnFS6Q,10
15
+ pydv/scripts/update_version_and_date.py,sha256=BfpM7fT-vnp93BdOfL0uiH774ll-jdoXm8etMoNOLgo,2293
16
+ pydv/scripts/version.txt,sha256=gADxPn4ry7n3zqv_mqIkOcv1hqZFPVOPsHcYUvY6Tx8,5
17
+ llnl_pydv-3.4.3.dist-info/LICENSE,sha256=StKqccUgzYI7wx5ZOCsSDNgbKLs-UO1KApla7EAN6vc,3220
18
+ llnl_pydv-3.4.3.dist-info/METADATA,sha256=ioOZVafgj8eNodENRoPsVGBn1awg7XCcpnmL1qCPOVw,2412
19
+ llnl_pydv-3.4.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
20
+ llnl_pydv-3.4.3.dist-info/entry_points.txt,sha256=sA7p09LmqRUqDCBJbjbgxW2El_j-pvUX_gQX5Pq-0J0,37
21
+ llnl_pydv-3.4.3.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ pdv=pydv.pdv:main
3
+
pydv/NOTES ADDED
@@ -0,0 +1,57 @@
1
+ TO UPDATE TO LATEST VERSION, DO:
2
+
3
+ hg pull https://dougmillerLLNL@bitbucket.org/dougmillerLLNL/pdv
4
+
5
+ THEN
6
+
7
+ chmod ugo+r *
8
+
9
+ 2015/05
10
+ Added 'savecsv' command.
11
+
12
+ 2015/04
13
+ Added 'newcurve' command.
14
+
15
+ 2013/04/12
16
+ Redefined norm so it does not divide by the interval. This
17
+ definition is more consistent with usual mathematical
18
+ definitions of norm. Also, fixed bug in integrate() where if
19
+ either xmin or xmax were zero, then the user supplied interval
20
+ was ignored.
21
+
22
+ 2012/11/30
23
+ Added ability to change width of label column, upgraded regex
24
+ syntax documentation.
25
+
26
+ 2012/11/12
27
+ Made linespoints show up as o-o in the legend rather than -o-.
28
+
29
+ 2012/09/04
30
+ Added 'linespoints' mode for curves. Syntax like the 'scatter'
31
+ mode command.
32
+
33
+ 2012/05/10
34
+ Ticks pretty much good, Owen added headerless reads. Clear that
35
+ we need a re-factoring of the code, several missed opportunities
36
+ for encapsulation exist.
37
+
38
+ 2011/12/2
39
+ Working on ticks. Currently does not run script xx correctly.
40
+
41
+ 2011/11/22
42
+ Added ability to read column formatted data, via '-gnu' command
43
+ line argument or '.gnu' file suffix.
44
+
45
+ 2011/11/17
46
+ /usr/gapps/pdv/bin/pdv version wasn't the latest, updated that.
47
+
48
+ 2011/11/1
49
+ Set up on GoogleCode. Went to Mercurial repo on code.google.com.
50
+ Also have bug tracker working on GoogleCode.
51
+
52
+ 2011/10/22
53
+ Making branches/dev branch, because tick work is messing up trunk.
54
+
55
+ 2011/10/11
56
+ Adding tick mark specification.
57
+
pydv/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # README #
2
+
3
+ ## PDV is a 1D graphics and data analysis tool, heavily based on the ULTRA plotting tool. ##
4
+
5
+ To use it, download the source, and run with Python. You need pyside or pyqt4, matplotlib and numpy installed.
6
+
7
+ ### PyDV Importable Interface Module ###
8
+ You can now call most of PyDV's functionality from within a Python script. Below is an example of how to do this.
9
+
10
+ import sys
11
+ sys.path.append("/usr/gapps/pydv/2.0")
12
+ import pydvpy as pydvif
13
+
14
+ curves = list()
15
+ curves.append(pydvif.span(1,10,6))
16
+ pydvif.save('myFile.txt', curves)
17
+
18
+ ### Links ###
19
+ * PDV Home Page: https://lc.llnl.gov/confluence/display/PYDV/PDV%3A+Python+Data+Visualizer
20
+ * PDV JIRA: https://lc.llnl.gov/jira/projects/PYDV
21
+ * PDV Build and Test Results: https://lc.llnl.gov/bamboo/browse/PYDV-BUIL
22
+ * Ultra User's Manual: https://wci.llnl.gov/codes/pact/ultra.html
23
+
24
+ ### Who do I talk to? ###
25
+
26
+ * Sarah El-Jurf <eljurf1@llnl.gov>
27
+ * Jorge Moreno <moreno45@llnl.gov>
pydv/__init__.py ADDED
@@ -0,0 +1 @@
1
+ __all__ = ["curve", "pdv", "pdvutil", "pdvnavbar", "pdvplot", "pydvpy"]
pydv/curve.py ADDED
@@ -0,0 +1,356 @@
1
+ # Copyright (c) 2011-2024, Lawrence Livermore National Security, LLC.
2
+ # Produced at the Lawrence Livermore National Laboratory
3
+ # Written by Mason Kwiat, Douglas S. Miller, and Kevin Griffin, Ephraim Rusu
4
+ # e-mail: rusu1@llnl.gov
5
+ # LLNL-CODE-507071
6
+ # All rights reserved.
7
+
8
+ # This file is part of PDV. For details, see <URL describing code and
9
+ # how to download source>. Please also read "Additional BSD Notice".
10
+
11
+ # Redistribution and use in source and binary forms, with or without
12
+ # modification, are permitted provided that the following conditions
13
+ # are met:
14
+
15
+ # Redistributions of source code must retain the above copyright
16
+ # notice, this list of conditions and the disclaimer below.
17
+ # Redistributions in binary form must reproduce the above copyright
18
+ # notice, this list of conditions and the disclaimer (as noted below)
19
+ # in the documentation and/or other materials provided with the
20
+ # distribution. Neither the name of the LLNS/LLNL nor the names of
21
+ # its contributors may be used to endorse or promote products derived
22
+ # from this software without specific prior written permission.
23
+
24
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
+ # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE
28
+ # LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR
29
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
32
+ # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
33
+ # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
34
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
35
+ # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36
+ # SUCH DAMAGE.
37
+
38
+ # Additional BSD Notice
39
+
40
+ # 1. This notice is required to be provided under our contract with
41
+ # the U.S. Department of Energy (DOE). This work was produced at
42
+ # Lawrence Livermore National Laboratory under Contract
43
+ # No. DE-AC52-07NA27344 with the DOE.
44
+
45
+ # 2. Neither the United States Government nor Lawrence Livermore
46
+ # National Security, LLC nor any of their employees, makes any
47
+ # warranty, express or implied, or assumes any liability or
48
+ # responsibility for the accuracy, completeness, or usefulness of any
49
+ # information, apparatus, product, or process disclosed, or represents
50
+ # that its use would not infringe privately-owned rights.
51
+
52
+ # 3. Also, reference herein to any specific commercial products,
53
+ # process, or services by trade name, trademark, manufacturer or
54
+ # otherwise does not necessarily constitute or imply its endorsement,
55
+ # recommendation, or favoring by the United States Government or
56
+ # Lawrence Livermore National Security, LLC. The views and opinions
57
+ # of authors expressed herein do not necessarily state or reflect
58
+ # those of the United States Government or Lawrence Livermore National
59
+ # Security, LLC, and shall not be used for advertising or product
60
+ # endorsement purposes.
61
+
62
+ import sys
63
+ import numpy as np
64
+ from scipy import interpolate, integrate
65
+
66
+
67
+ class Curve(object):
68
+
69
+ name = ''
70
+ filename = ''
71
+ record_id = ''
72
+ xlabel = ''
73
+ ylabel = ''
74
+ title = ''
75
+ plotname = ''
76
+ color = ''
77
+ edited = False
78
+ scatter = False
79
+ linespoints = False
80
+ linewidth = None
81
+ linestyle = '-'
82
+ drawstyle = 'default'
83
+ dashes = None
84
+ hidden = False
85
+ x = np.empty(0)
86
+ y = np.empty(0)
87
+ ebar = None # errorbar
88
+ erange = None # errorrange
89
+ marker = '.' # Use matplotlib markers when setting directly
90
+ markerstyle = None
91
+ markersize = 3
92
+ markerfacecolor = None
93
+ markeredgecolor = None
94
+ plotprecedence = 0
95
+ legend_show = True
96
+
97
+ def __init__(self, filename='', name='', record_id='', xlabel='', ylabel='', title='',
98
+ step=False, xticks_labels=None):
99
+ self.filename = filename
100
+ self.name = name
101
+ self.record_id = record_id
102
+ self.xlabel = xlabel
103
+ self.ylabel = ylabel
104
+ self.title = title
105
+ self.step = step
106
+ self.xticks_labels = xticks_labels
107
+
108
+ def __add__(a, b):
109
+ c = Curve('', '')
110
+ c.drawstyle = a.drawstyle
111
+ c.plotname = str(a.plotname + ' + ' + b.plotname + ' ').strip(' ')
112
+ ia, ib = getinterp(a, b)
113
+ if ia.x is not None and ib.x is not None:
114
+ c.x = ia.x
115
+ c.y = ia.y + ib.y
116
+ return c
117
+
118
+ def __sub__(a, b):
119
+ c = Curve('', '')
120
+ c.drawstyle = a.drawstyle
121
+ c.plotname = str(a.plotname + ' - ' + b.plotname + ' ').strip(' ')
122
+ ia, ib = getinterp(a, b)
123
+ if ia.x is not None and ib.x is not None:
124
+ c.x = ia.x
125
+ c.y = ia.y - ib.y
126
+ return c
127
+
128
+ def __mul__(a, b):
129
+ c = Curve('', '')
130
+ c.drawstyle = a.drawstyle
131
+ c.plotname = str(a.plotname + ' * ' + b.plotname + ' ').strip(' ')
132
+ ia, ib = getinterp(a, b)
133
+ if ia.x is not None and ib.x is not None:
134
+ c.x = ia.x
135
+ c.y = ia.y * ib.y
136
+ return c
137
+
138
+ def __div__(a, b):
139
+ c = Curve('', '')
140
+ c.drawstyle = a.drawstyle
141
+ c.plotname = str(a.plotname + ' / ' + b.plotname + ' ').strip(' ')
142
+ ia, ib = getinterp(a, b)
143
+ if ia.x is not None and ib.x is not None:
144
+ c.x = ia.x
145
+
146
+ zero_indices = np.where(ib.y == 0)
147
+ for idx in zero_indices:
148
+ ib.y[idx] = 0.000000001
149
+
150
+ c.y = ia.y / ib.y
151
+ for idx in zero_indices:
152
+ c.y[idx] = float(sys.maxsize)
153
+
154
+ return c
155
+
156
+ def __truediv__(a, b):
157
+ c = Curve('', '')
158
+ c.drawstyle = a.drawstyle
159
+ c.plotname = str(a.plotname + ' / ' + b.plotname + ' ').strip(' ')
160
+ ia, ib = getinterp(a, b)
161
+ if ia.x is not None and ib.x is not None:
162
+ c.x = ia.x
163
+
164
+ zero_indices = np.where(ib.y == 0)
165
+ for idx in zero_indices:
166
+ ib.y[idx] = 0.000000001
167
+
168
+ c.y = ia.y / ib.y
169
+ for idx in zero_indices:
170
+ c.y[idx] = float(sys.maxsize)
171
+
172
+ return c
173
+
174
+ def __pow__(a, b):
175
+ c = Curve('', '')
176
+ c.drawstyle = a.drawstyle
177
+ c.plotname = str(a.plotname + '^' + str(b)).strip(' ')
178
+ c.x = np.array(a.x)
179
+ c.y = np.power(a.y, b)
180
+ nans = np.isnan(c.y) # remove NaNs
181
+ c.x = c.x[~nans]
182
+ c.y = c.y[~nans]
183
+ return c
184
+
185
+ def __neg__(a):
186
+ c = Curve('', '')
187
+ c.drawstyle = a.drawstyle
188
+ c.plotname = str('-' + a.plotname)
189
+ c.x = np.array(a.x)
190
+ c.y = np.array(-a.y)
191
+ return c
192
+
193
+ def copy(self):
194
+ """
195
+ Return a new copy of the curve object
196
+ """
197
+
198
+ c = Curve(self.filename, self.name, self.record_id, self.xlabel, self.ylabel, self.title)
199
+ c.plotname = self.plotname
200
+ c.x = np.array(self.x)
201
+ c.y = np.array(self.y)
202
+ c.color = self.color
203
+ c.edited = self.edited
204
+ c.scatter = self.scatter
205
+ c.linespoints = self.linespoints
206
+ c.linewidth = self.linewidth
207
+ c.linestyle = self.linestyle
208
+ c.drawstyle = self.drawstyle
209
+ c.dashes = self.dashes
210
+ c.hidden = self.hidden
211
+ c.marker = self.marker
212
+ c.markerstyle = self.markerstyle
213
+ c.markersize = self.markersize
214
+ c.markeredgecolor = self.markeredgecolor
215
+ c.markerfacecolor = self.markerfacecolor
216
+ c.ebar = self.ebar
217
+ c.erange = self.erange
218
+ c.plotprecedence = self.plotprecedence
219
+
220
+ return c
221
+
222
+ def normalize(self):
223
+ """
224
+ Return a new normalized copy of the curve object
225
+ """
226
+
227
+ c = self.copy()
228
+
229
+ area0 = integrate.simpson(c.y, c.x)
230
+ c.y /= float(area0)
231
+ c.name = "Normalized %s" % self.plotname
232
+ return c
233
+
234
+
235
+ def getinterp(a, b, left=None, right=None, samples=100, match='domain'):
236
+ """
237
+ Gets the interpolated and domain matched versions of the two curves.
238
+
239
+ :param a: Curve A
240
+ :type a: curve
241
+ :param b: Curve B
242
+ :type b: curve
243
+ :param left: Value to return for `x < a.x[0]`, default is `a.y[0]`.
244
+ :type left: float, optional
245
+ :param right: Value to return for `x > a.x[-1]`, default is `a.y[-1]`.
246
+ :type: right: float, optional
247
+ :param match {'domain','step'},optional: A string indicating how to interpolate the two curves
248
+ :type match: str
249
+ :returns: curve pair -- the interpolated and domain matched versions of a and b
250
+ """
251
+ if match == 'domain':
252
+ ux = list(set(a.x).union(set(b.x))) # get union of xvals
253
+ ux.sort()
254
+
255
+ ia = a.copy()
256
+ ia.x = np.array(ux)
257
+ ia.y = np.interp(ux, a.x, a.y, left, right) # interpolate y vals
258
+
259
+ ib = Curve('', '')
260
+ ib.x = np.array(ux)
261
+ ib.y = np.interp(ux, b.x, b.y, left, right) # interpolate y vals
262
+
263
+ return ia, ib
264
+ elif match == 'step':
265
+ ax, step = np.linspace(min(a.x), max(a.x), num=samples, retstep=True)
266
+
267
+ bxsamples = int((max(b.x) - min(b.x)) / step)
268
+ if bxsamples < 1:
269
+ bxsamples = 1
270
+
271
+ bx = np.linspace(min(b.x), max(b.x), bxsamples)
272
+
273
+ ia = a.copy()
274
+ ia.x = ax
275
+ ia.y = np.interp(ax, a.x, a.y, left, right) # interpolate y vals
276
+
277
+ ib = Curve('', '')
278
+ ib.x = bx
279
+ ib.y = np.interp(bx, b.x, b.y, left, right) # interpolate y vals
280
+
281
+ return ia, ib
282
+ else:
283
+ raise ValueError("{} is not a supported option for match".format(match))
284
+
285
+
286
+ def interp1d(a, num=100, retstep=False):
287
+ """
288
+ Gets the interpolated values of the curve with the specified number of samples.
289
+
290
+ :param a: Curve A
291
+ :type a: curve
292
+ :param num: Number of samples to generate. Default is 100. Must be non-negative.
293
+ :type: num: int, optional
294
+ :param retstep: return the spacing between samples
295
+ :type: retstep: bool, optional
296
+ :returns: ia: curve -- the interpolated and dimensions matched version of a
297
+ step: float, optional -- only returned if retstep is True. Size of the spacing between samples
298
+ """
299
+ num = int(num)
300
+ f = interpolate.interp1d(a.x, a.y, kind='linear', bounds_error=False, fill_value=0)
301
+
302
+ ia = a.copy()
303
+
304
+ if retstep:
305
+ ia.x, step = np.linspace(min(a.x), max(a.x), num=num, retstep=True)
306
+ ia.y = f(ia.x)
307
+ return ia, step
308
+ else:
309
+ ia.x = np.linspace(min(a.x), max(a.x), num=num, retstep=False)
310
+ ia.y = f(ia.x)
311
+ return ia
312
+
313
+
314
+ def append(a, b):
315
+ """
316
+ Merge curve a and curve b over the union of their domains. Where domains overlap, take
317
+ the average of the curve's y-values.
318
+
319
+ :param a: Curve A
320
+ :type a: curve
321
+ :param b: Curve B
322
+ :type b: curve
323
+ :return: a new curve resulting from the merging of curve a and curve b
324
+ """
325
+ ux = list(set(a.x).union(set(b.x))) # get union of xvals
326
+ ux.sort()
327
+
328
+ aub = Curve('', '')
329
+ aub.x = np.array(ux)
330
+ aub.y = np.zeros(len(aub.x))
331
+
332
+ for i in range(len(aub.x)):
333
+ xval = aub.x[i]
334
+
335
+ aidx = np.where(a.x == xval)[0]
336
+ bidx = np.where(b.x == xval)[0]
337
+
338
+ has_a = len(aidx) != 0
339
+ has_b = len(bidx) != 0
340
+
341
+ sum = float(0)
342
+ tot = 0
343
+
344
+ if has_a:
345
+ for idx in aidx:
346
+ sum += float(a.y[idx])
347
+ tot += 1
348
+
349
+ if has_b:
350
+ for idx in bidx:
351
+ sum += float(b.y[idx])
352
+ tot += 1
353
+
354
+ aub.y[i] = sum / float(tot)
355
+
356
+ return aub
pydv/img/app_icon3.png ADDED
Binary file
Binary file
Binary file
pydv/pdv ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env /usr/apps/weave/weave-develop-cpu/bin/python3
2
+
3
+ import sys
4
+ import os
5
+
6
+ sys.path.insert(0, os.path.dirname(__file__))
7
+
8
+ # HPC Import
9
+ try:
10
+ import pdv
11
+ pdv.Command().main()
12
+
13
+ # Package Import
14
+ except ImportError:
15
+ import pydv.pdv
16
+ pydv.pdv.Command().main()
17
+