PyDV API Specification¶
pydvpy module¶
- pydv.pydvpy.AbsAndRelDiff(cr1, cr2, npts=0, abs_tol=1e+80, rel_tol=1e+80)¶
Calculate the absolute and relative difference between the overlapping interpolated curves. Returns the updated AND statement for failed along with curves from AbsDiff and RelDiff
>>> curves = pydvpy.read('testData.txt')
>>> (cr1_interp, cr2_interp, differences_Abs, avgDiff_Abs, maxDiff_Abs, failed_curve_Abs, failed_Abs differences_Rel, avgDiff_Rel, maxDiff_Rel, failed_curve_Rel, failed_Rel failed_AND) = pydvpy.AbsAndRelDiff(curves[0], curves[1], npts=0, abs_tol=1e80, rel_tol=1e80)
- Parameters:
- Returns:
cr1_interp (
Curve) - The first overlapping interpolated curvecr2_interp (
Curve) - The second overlapping interpolated curvedifferences_Abs (
Curve) - The differences curve for AbsDiffavgDiff_Abs (
float) - The average difference for AbsDiffmaxDiff_Abs (
float) - The maximum difference for AbsDifffailed_curve_Abs (
Curve) - The failed points curve for AbsDifffailed_Abs (
bool) - If the differences failed the tolerance or not for AbsDiffdifferences_Rel (
Curve) - The differences curve for RelDiffavgDiff_Rel (
float) - The average difference for RelDiffmaxDiff_Rel (
float) - The maximum difference for RelDifffailed_curve_Rel (
Curve) - The failed points curve for RelDifffailed_Rel (
bool) - If the differences failed the tolerance or not for RelDifffailed_AND (
bool) - If the differences failed the tolerance or not for AbsDiff AND RelDiff
- pydv.pydvpy.AbsDiff(cr1, cr2, npts=0, tol=1e+80)¶
Calculate the absolute difference between the overlapping interpolated curves.
>>> curves = pydvpy.read('testData.txt')
>>> cr1_interp, cr2_interp, differences, avgDiff, maxDiff, failed_curve, failed = pydvpy.AbsDiff(curves[0], curves[1], npts=0, tol=1e80)
- Parameters:
- Returns:
cr1_interp (
Curve) - The first overlapping interpolated curvecr2_interp (
Curve) - The second overlapping interpolated curvedifferences (
Curve) - The differences curveavgDiff (
float) - The average differencemaxDiff (
float) - The maximum differencefailed_curve (
Curve) - The failed points curvefailed (
bool) - If the differences failed the tolerance or not
- pydv.pydvpy.AbsOrRelDiff(cr1, cr2, npts=0, abs_tol=1e+80, rel_tol=1e+80)¶
Calculate the absolute and relative difference between the overlapping interpolated curves. Returns the updated OR statement for failed along with curves from AbsDiff and RelDiff
>>> curves = pydvpy.read('testData.txt')
>>> (cr1_interp, cr2_interp, differences_Abs, avgDiff_Abs, maxDiff_Abs, failed_curve_Abs, failed_Abs differences_Rel, avgDiff_Rel, maxDiff_Rel, failed_curve_Rel, failed_Rel failed_OR) = pydvpy.AbsOrRelDiff(curves[0], curves[1], npts=0, abs_tol=1e80, rel_tol=1e80)
- Parameters:
- Returns:
cr1_interp (
Curve) - The first overlapping interpolated curvecr2_interp (
Curve) - The second overlapping interpolated curvedifferences_Abs (
Curve) - The differences curve for AbsDiffavgDiff_Abs (
float) - The average difference for AbsDiffmaxDiff_Abs (
float) - The maximum difference for AbsDifffailed_curve_Abs (
Curve) - The failed points curve for AbsDifffailed_Abs (
bool) - If the differences failed the tolerance or not for AbsDiffdifferences_Rel (
Curve) - The differences curve for RelDiffavgDiff_Rel (
float) - The average difference for RelDiffmaxDiff_Rel (
float) - The maximum difference for RelDifffailed_curve_Rel (
Curve) - The failed points curve for RelDifffailed_Rel (
bool) - If the differences failed the tolerance or not for RelDifffailed_OR (
bool) - If the differences failed the tolerance or not for AbsDiff OR RelDiff
- pydv.pydvpy.AvgDiff(cr1, cr2, npts=0, tol=1e+80)¶
Calculate the difference between the overlapping interpolated curves.
>>> curves = pydvpy.read('testData.txt')
>>> cr1_interp, cr2_interp, differences, avgDiff, maxDiff, failed_curve, failed = pydvpy.AvgDiff(curves[0], curves[1], npts=0, tol=1e80)
- Parameters:
- Returns:
cr1_interp (
Curve) - The first overlapping interpolated curvecr2_interp (
Curve) - The second overlapping interpolated curvedifferences (
Curve) - The differences curve cr1_interp - cr2_interpavgDiff (
float) - The average differencemaxDiff (
float) - The maximum differencefailed_curve (
Curve) - The failed points curvefailed (
bool) - If the differences failed the tolerance or not
- pydv.pydvpy.ClipValues(curvelist, ymin, ymax)¶
Clip the y values for the specified curves using np.clip().
>>> curves = pydvpy.read('testData.txt')
>>> new_curves = pydvpy.ClipValues(curves, ymin=3, ymax=7) OR
>>> new_curves = pydvpy.ClipValues(curves[0], ymin=3, ymax=7)
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
ymin (float) – The minimum y value
ymax (float) – The maximum y value
- Returns:
Curve – A list of new curves with the clipped y values
- pydv.pydvpy.GuassianFilter(c, sigma)¶
This smooths a curve using a Gaussian filter.
>>> curves = pydvpy.read('testData.txt')
>>> new_curve = pydvpy.GuassianFilter(curves[0], 5)
- Parameters:
c (Curve) – The Curve
sigma (float) – Standard deviation for Gaussian kernel
- Returns:
Curve – A new smoothed curve
- pydv.pydvpy.LinearFit(c, x)¶
This method takes in a value for x and uses linear interpolation to return the cooresponding y value for the given data
>>> curves = pydvpy.read('testData.txt')
>>> vals = pydvpy.LinearFit(curves[0], 2)
>>> x, y = vals[0]
- Parameters:
c (Curve) – The curve
value (float) – x value
- Returns:
list – A list of tuples where each tuple contains the y value, and the given x
- pydv.pydvpy.MedianFilter(c, npts)¶
This smooths a curve using a Median filter.
>>> curves = pydvpy.read('testData.txt')
>>> new_curve = pydvpy.MedianFilter(curves[0], 5)
- Parameters:
c (Curve) – The Curve
npts (int) – The sizes of the median filter
- Returns:
Curve – A new smoothed curve
- pydv.pydvpy.MovingAvg(c, npts)¶
This filter returns a smooth a curve using a moving average technique. The function takes N points and reassigns each point in a curve as the average of the N points around it.
>>> curves = pydvpy.read('testData.txt')
>>> new_curve = pydvpy.MovingAvg(curves[0], 5)
- Parameters:
c (Curve) – The Curve
npts (int) – Number of points for the moving average
- Returns:
Curve – A new smoothed curve
- pydv.pydvpy.PolyFit(c, value, order)¶
Using a Polynomial Fit, get the y values of the curve for a given x.
>>> curves = pydvpy.read('testData.txt')
>>> vals = pydvpy.PolyFit(curves[0], 2)
>>> x, y = vals[0]
- Parameters:
c (Curve) – The curve
value (float) – x value
order (int) – Order of polynomial
- Returns:
list – A list of tuples where each tuple contains the y value, and the given x
- pydv.pydvpy.RelDiff(cr1, cr2, npts=0, tol=1e+80)¶
Calculate the relative difference between the overlapping interpolated curves.
>>> curves = pydvpy.read('testData.txt')
>>> cr1_interp, cr2_interp, differences, avgDiff, maxDiff, failed_curve, failed = pydvpy.RelDiff(curves[0], curves[1], npts=0, tol=1e80)
- Parameters:
- Returns:
cr1_interp (
Curve) - The first overlapping interpolated curvecr2_interp (
Curve) - The second overlapping interpolated curvedifferences (
Curve) - The differences curveavgDiff (
float) - The average differencemaxDiff (
float) - The maximum differencefailed_curve (
Curve) - The failed points curvefailed (
bool) - If the differences failed the tolerance or not
- pydv.pydvpy.SplineFit(c, value, order, smooth)¶
Using a Spline Fit, get the y values of the curve for a given x.
>>> curves = pydvpy.read('testData.txt')
>>> vals = pydvpy.SplineFit(curves[0], 2, 3)
>>> x, y = vals[0]
- Parameters:
c (Curve) – The curve
value (float) – x value
order (int) – Order for spline
smooth (int) – Smoothing condition for spline
- Returns:
list – A list of tuples where each tuple contains the y value, and the given x
- pydv.pydvpy.TimeShift(cbase, cset, tol=1e+80, pairID=0, version=0)¶
This filter will take a curve and return a time shifted curve. It uses the slope of the baseline curve to find the time offset for each point of the new curve such that the new curve would match the baseline. It uses the time offset at the point with the largest slope. This only works well for small offsets. It zeros out the slope when the baseline and new curve have slopes of opposite sign when searching for the max slope.
>>> curves = pydvpy.read('testData.txt')
>>> new_curve = pydvpy.TimeShift(curves[0], curves[1], tol=1e80, pairID=0, version=0)
- pydv.pydvpy.UniformFilter(c, npts)¶
This smooths a curve using a Uniform filter.
>>> curves = pydvpy.read('testData.txt')
>>> new_curve = pydvpy.UniformFilter(curves[0], 5)
- Parameters:
c (Curve) – The Curve
npts (int) – The sizes of the uniform filter
- Returns:
Curve – A new smoothed curve
- pydv.pydvpy.abs(curvelist)¶
Take the absolute value of the y values of the Curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.abs(curves) OR
>>> pydvpy.abs(curves[0])
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
- pydv.pydvpy.absx(curvelist)¶
Take the absolute value of the x values of the Curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.absx(curves) OR
>>> pydvpy.absx(curves[0])
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
- pydv.pydvpy.acos(curvelist)¶
Take the arccosine of y values of a Curve or list of Curves
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.acos(curves) OR
>>> pydvpy.acos(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of curves
- pydv.pydvpy.acosh(curvelist)¶
Take the hyperbolic arccosine of y values of a Curve or list of Curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.acosh(curves) OR
>>> pydvpy.acosh(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of curves
- pydv.pydvpy.acoshx(curvelist)¶
Take the hyperbolic arccosine of x values of a Curve or list of Curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.acoshx(curves) OR
>>> pydvpy.acoshx(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of curves
- pydv.pydvpy.acosx(curvelist)¶
Take the arccosine of x values of a Curve or list of Curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.acosx(curves) OR
>>> pydvpy.acosx(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of curves
- pydv.pydvpy.add(curvelist)¶
Add one or more curves.
>>> curves = pydvpy.read('testData.txt')
>>> c = pydvpy.add(curves)
- Parameters:
curvelist (list) – The list of curves
- Returns:
curve – the curve containing the sum of the curves in curvelist
- pydv.pydvpy.addPoint(curvelist, x, y)¶
Appends both x and y coordinates to the end of each list of values of a Curve.
>>> curves = pydvpy.read('testData.txt')
>>> new_curves = pydvpy.addPoint(curves, x=10, y=11) OR
>>> new_curves = pydvpy.addPoint(curves[0], x=10, y=11)
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
x (float) – The point to append to the x array
y (float) – The point to append to the y array
- Returns:
Curve – A list of new curves with the appended point
- pydv.pydvpy.alpha(ac, ig, res, npts=-1)¶
- pydv.pydvpy.appendcurves(curvelist)¶
Merge two or more curves over the union of their domains. Where domains overlap, take the average of the curve’s y-values.
>>> curves = pydvpy.read('testData.txt')
>>> newcurve = pydvpy.appendcurve(curves)
- Parameters:
curvelist (list) – the specified curves
- Returns:
Curve – the merging of the two curves c1 and c2
- pydv.pydvpy.area(curvelist)¶
Return area of each curve.
>>> curves = pydvpy.read('testData.txt')
>>> areas = pydvpy.area(curves)
>>> plotname, area = areas[0]
- Parameters:
curvelist (Curve or list) – The given curve or list of curves
- Returns:
list – A list of tuples where each tuple contains the curve name and area
- pydv.pydvpy.asin(curvelist)¶
Take the arcsine of y values of a single curve or curves in a list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.asin(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.asinh(curvelist)¶
Take the hyperbolic arcsine of y values of a single curve or curves in a list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.asinh(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.asinhx(curvelist)¶
Take the hyperbolic arcsine of x values of a single curve or curves in a list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.asinhx(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.asinx(curvelist)¶
Take the arcsine of x values of a single curve or curves in a list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.asinx(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.atan(curvelist)¶
Take the arctangent of y values of a single curve or curves in a list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.atan(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.atan2(c1, c2, t=None)¶
Perform the atan2 method for a pair of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.atan2(curves[0], curves[1]) OR
>>> pydvpy.atan2(curves[0], curves[1], tuple(['A', 'B']))
- Parameters:
c1 (curve) – the first curve
c2 (curve) – the second curve
t (tuple) – A tuple containing exactly two values to insert into the name string for the new curve
- Returns:
curve – a new curve with the results from this operation
- pydv.pydvpy.atanh(curvelist)¶
Take the hyperbolic arctangent of y values of a single curve or curves in a list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.atanh(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.atanhx(curvelist)¶
Take the hyperbolic arctangent of x values of a single curve or curves in a list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.atanhx(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.atanx(curvelist)¶
Take the arctangent of x values of a single curve or curves in a list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.atanx(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.average_curve(curvelist)¶
Average the specified curves over the intersection of their domains.
- Parameters:
curvelist – the specified curves
- Returns:
Curve – a new curve with the average values over the intersection of the domains of the specified curves.
- pydv.pydvpy.convolve(c1, c2, npts=100, norm=True, debug=False)¶
- pydv.pydvpy.convolve_int(c1, c2, norm=True, npts=100, npts_interp=100, debug=False)¶
Computes the convolution of the two given curves: - - norm=False:
(g*h)(x) = Int(-inf, inf, dt*g(t)*h(x-t))- norm=True :(g*h)(x) = Int(-inf, inf, dt*g(t)*h(x-t)) / Int(-inf, inf, dt*h(t))- This computes the integrals directly which avoid padding and aliasing problems associated with FFT methods (it is however slower).- Parameters:
c1 (Curve) – (N,) The first curve g(t)
c2 (Curve) – (M,) The second curve h(t)
norm (bool) – if true then normalize c2 h(t) before integration. Used in convolc
npts (int) – the number of points to divide the combined domain of the curves to give delx
npts_interp (int) – the number of points to interpolate at each delx step
debug (bool) – Used only in CLI, plots curves and c2 h(x-t) as it moves
- Returns:
nc: Curve – the convolution of the two curves c1 and c2
- pydv.pydvpy.convolveb(c1, c2, npts=100, npts_interp=100, debug=False)¶
Computes the convolution of the two given curves: - -
(g*h)(x) = Int(-inf, inf, dt*g(t)*h(x-t)) / Int(-inf, inf, dt*h(t))- This computes the integrals directly which avoid padding and aliasing problems associated with FFT methods (it is however slower).- Parameters:
c1 (Curve) – (N,) The first curve g(t)
c2 (Curve) – (M,) The second curve h(t)
npts (int) – the number of points to divide the combined domain of the curves to give delx
npts_interp (int) – the number of points to interpolate at each delx step
debug (bool) – Used only in CLI, plots curves and c2 h(x-t) as it moves
- Returns:
Curve – the convolution of the two curves c1 and c2 using integration and normalizing by c2
- pydv.pydvpy.convolvec(c1, c2, npts=100, npts_interp=100, debug=False)¶
Computes the convolution of the two given curves: - -
(g*h)(x) = Int(-inf, inf, dt*g(t)*h(x-t))- This computes the integrals directly which avoid padding and aliasing problems associated with FFT methods (it is however slower).- Parameters:
c1 (Curve) – (N,) The first curve g(t)
c2 (Curve) – (M,) The second curve h(t)
npts (int) – the number of points to divide the combined domain of the curves to give delx
npts_interp (int) – the number of points to interpolate at each delx step
debug (bool) – Used only in CLI, plots curves and c2 h(x-t) as it moves
- Returns:
Curve – the convolution of the two curves c1 and c2 using integration and no normalization
- pydv.pydvpy.correlate(c1, c2, mode='valid')¶
Computes the cross-correlation of two 1D sequences (c1.y and c2.y) as defined by numpy.correlate.
- Parameters:
c1 (Curve) – The first curve with 1D input sequence c1.y
c2 (Curve) – The second curve with 1D input sequence c2.y
mode ('full'(default), 'same' or 'valid') –
- full:
By default, mode is ‘full’. This returns the convolution at each point of overlap, with an output shape of (N+M-1,). At the end-points of the convolution, the signals do not overlap completely, and boundary effects may be seen.
- same:
Mode ‘same’ returns output of length
max(M, N). Boundary effects are still visible.- valid:
Mode ‘valid’ returns output of length
max(M, N) - min(M, N) + 1. The convolution product is only given for points where the signals overlap completely. Values outside the signal boundary have no effect.
- Returns:
Curve – the cross-correlation of c1.y and c2.y
- pydv.pydvpy.cos(curvelist)¶
Take the cosine of y values of a Curve or list of Curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.cos(curves) OR
>>> pydvpy.cos(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
- pydv.pydvpy.cosh(curvelist)¶
Take the hyperbolic cosine of y values of a Curve or list of Curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.cosh(curves) OR
>>> pydvpy.cosh(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of curves
- pydv.pydvpy.coshx(curvelist)¶
Take the hyperbolic cosine of x values of a Curve or list of Curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.coshx(curves) OR
>>> pydvpy.coshx(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of curves
- pydv.pydvpy.cosx(curvelist)¶
Take the cosine of x values of a Curve or list of Curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.cosx(curves) OR
>>> pydvpy.cosx(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
- pydv.pydvpy.create_plot(curvelist, fname=None, ftype='png', title='', xlabel='', ylabel='', legend=False, stylename='ggplot', xls=False, yls=False, fwidth=None, fheight=None)¶
Create a plot of the curves in the curvelist using the curve attributes.
>>> curves = pydvpy.read('testData.txt')
>>> plot1, fig1, ax1 = pydvpy.create_plot(curves, fname='myPlot1')
>>> plot2, fig2, ax2 = pydvpy.create_plot(curves, fname='myPlot2', ftype='pdf', title='My Plot', xlabel='X', ylabel='Y', legend=True, stylename='ggplot', fwidth=10.1, fheight=11.3)
See makecurve() for available curve attributes. Some of these are not applicable to plotting but the ones that are, have the same/similar name to their plotting counterparts. To see the curve attributes, one can execute:
>>> print(curvelist[0].__dict__) # this will also contain the x and y data so it will be a long print statement
>>> print(curvelist[0].color) # specific attribute
To set a curve attribute:
>>> curvelist[0].color = "blue"
- Parameters:
curvelist (list) – The list of curves to plot
fname (str, optional) – The filename of the plot not including the file type, defaults to None which doesn’t save anything
ftype (str, optional) – The save format of the plot, defaults to ‘png’
title (str, optional) – The title of the plot, defaults to ‘’
xlabel (str, optional) – The x label of the plot, defaults to ‘’
ylabel (str, optional) – The y label of the plot, defaults to ‘’
legend (bool, optional) – Include a legend in the plot, defaults to False
stylename (str, optional) – The style of the plot, defaults to ‘ggplot’
xls (bool, optional) – Show x-axis in log scale, defaults to False
yls (bool, optional) – Show y-axis in log scale, defaults to False
fwidth (float, optional) – The width of the figure in inches, defaults to None which is the default width of 6.4 inches
fheight (float, optional) – the height of the figure in inches, defaults to None which is the default height of 4.8 inches
- Returns:
plt (
matplotlib.pyplot) - The plot objectfigure (
matplotlib.pyplot.figure) - The figure objectaxis (
matplotlib.pyplot.axes) - The axis object
- pydv.pydvpy.crop_and_interp(curvelist, npts=None, idomian=None)¶
Returns new curves that are cropped and interpolated.
>>> curves = pydvpy.read('testData.txt')
>>> new_curves = pydvpy.crop_and_interp(curves, 100, [24, 42]) OR
>>> new_curves = pydvpy.crop_and_interp(curves[0], 100, [24, 42])
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
npts (int) – Number of extra points for interpolation
idomain (list) – Index domain for cropped curve
- Returns:
Curve – A list of new curves that are cropped and interpolated
- pydv.pydvpy.cumsum(c1)¶
Creates a new curve which is the cumulative sum of the original curve
- Parameters:
c1 (Curve) – The original curve
- Returns:
Curve – the cumulative sum of the original curve
- pydv.pydvpy.delta(xmn, x0, xmx, npts=100)¶
- Procedure: Generate a Dirac delta distribution such that
Int(xmin, xmax, dt*delta(t - x0)) = 1
- Parameters:
xmn (float) – The minimum x location
x0 (float) – The location of the unit impulse
xmx (float) – The maximum x location
npts (int) – The number of points for the curve
- Returns:
The Dirac delta distribution
- Return type:
- pydv.pydvpy.derivative(c, eo=1)¶
Take the derivative of the curve.
>>> curves = pydvpy.read('testData.txt')
>>> newCurve = pydvpy.derivative(curves[0])
- Parameters:
c (Curve) – The curve
eo (int, optional) – edge_order, gradient is calculated using N-th order accurate differences at the boundaries. Default: 1.
- Returns:
A new curve representing the derivate of c
- pydv.pydvpy.diffMeasure(c1, c2, tol=1e-08)¶
Compare two curves. For the given curves a fractional difference measure and its average are computed.
>>> curves = pydvpy.read('testData.txt')
>>> c1, c2 = pydvpy.diffMeasure(curves[0], curves[1])
>>> curves.append(c1)
>>> curves.append(c2)
>>> pydvpy.create_plot(curves, legend=True)
- pydv.pydvpy.disp(c, domain=True, format='g')¶
Create a string formatted list of the curve’s x-values if domain is True, otherwise y-values.
>>> c = pydvpy.span(1, 10)
>>> yvalues = pydvpy.disp(c, False)
- Parameters:
c – The given curve
domain (bool, optional) – if True, display the x-values of the curve. Otherwise, display the y-values of the curve
format (str, optional) – String format for the data
- Returns:
list – The list of x- or y-values as strings
- pydv.pydvpy.divide(curvelist)¶
Take quotient of curves.
>>> curves = pydvpy.read('testData.txt')
>>> c = pydvpy.divide(curves)
- Parameters:
curvelist (list) – The list of curves
- Returns:
curve – the curve containing the quotient of the curves
- pydv.pydvpy.divx(curvelist, value)¶
Divide x values of the curve(s) by a constant value.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.divx(curves, 4)
- Parameters:
curvelist (Curve or list) – The curve or curvelist
value (float) – The divisor
- pydv.pydvpy.divy(curvelist, value)¶
Divide y values of the curve(s) by a constant value.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.divy(curves, 4)
- Parameters:
curvelist (Curve or list) – The curve or curvelist
value (float) – The divisor
- pydv.pydvpy.dupx(curvelist)¶
Duplicate the x-values such that y = x for each of the given curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.dupx(curves)
>>> pydvpy.create_plot(curves, legend=True)
- Parameters:
curvelist (Curve or list) – The curve or list of curves
- pydv.pydvpy.dx(curvelist, value)¶
Shift x values of a curve or list of curves by a constant value.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.dx(curves, 4) OR
>>> pydvpy.dx(curves[0], 4)
- Parameters:
curvelist (Curve or list) – A curve or curvelist
value (float) – The amount to shift the x values by
- pydv.pydvpy.dy(curvelist, value)¶
Shift y values of a curve or list of curves by a constant value.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.dy(curves, 4) OR
>>> pydvpy.dy(curves[0], 4)
- Parameters:
curvelist (Curve or list) – A curve or curvelist
value (float) – The amount to shift the y values by
- pydv.pydvpy.errorbar(scur, cury1, cury2, curx1=None, curx2=None, mod=1)¶
Plot error bars on the given curve.
>>> curves = list()
>>> curves.append(pydvpy.span(1,10))
>>> curves.append(pydvpy.span(1,10))
>>> curves.append(pydvpy.span(1,10))
>>> pydvpy.dy(curves[0], 0.25)
>>> pydvpy.dy(curves[2], -0.25)
>>> pydvpy.errorbar(curves[1], curves[0], curves[2])
>>> pydvpy.create_plot(curves, legend=True)
- pydv.pydvpy.errorrange(scur, cury1, cury2)¶
Plot shaded error region on given curve.
>>> curves = list()
>>> curves.append(pydvpy.span(1,10))
>>> curves.append(pydvpy.span(1,10))
>>> curves.append(pydvpy.span(1,10))
>>> pydvpy.dy(curves[0], 0.25)
>>> pydvpy.dy(curves[2], -0.25)
>>> pydvpy.errorrange(curves[1], curves[0], curves[2])
>>> pydvpy.create_plot(curves, legend=True)
- pydv.pydvpy.exp(curvelist)¶
Exponentiate y values of the Curve or list of curves (e**y).
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.exp(curves) OR
>>> pydvpy.exp(curves[0])
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
- pydv.pydvpy.expx(curvelist)¶
Exponentiate x values of the Curve or list of curves (e**x).
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.expx(curves) OR
>>> pydvpy.expx(curves[0])
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
- pydv.pydvpy.fft(c, n=None, axis=-1, norm=None)¶
Compute the one-dimensional discrete Fourier Transform for the x- or y-values of c.
This function computes the one-dimensional n-point discrete Fourier Transform (DFT) with the efficient Fast Fourier Transform (FFT) algorithm [CT].
Raises IndexError: if axes is larger than the last axis of a.
Notes: FFT (Fast Fourier Transform) refers to a way the discrete Fourier Transform (DFT) can be calculated efficiently, by using symmetries in the calculated terms. The symmetry is highest when n is a power of 2, and the transform is therefore most efficient for these sizes.
The DFT is defined, with the conventions used in this implementation, in the documentation for the numpy.fft module.
- Citation: Cooley, James W., and John W. Tukey, 1965, “An algorithm for the
machine calculation of complex Fourier series,” Math. Comput. 19: 297-301.
>>> curves = pydvpy.read('testData.txt')
>>> realcurve, imagcurve = pydvpy.fft(curves[0])
- Parameters:
c (Curve) – Curve with x- or y-values as input array, can be complex.
n (int, optional) – Length of the transformed axis of the output. If n is smaller than the length of the input, the input is cropped. If it is larger, the input is padded with zeros. If n is not given, the length of the input along the axis specified by axis is used.
axis (int, optional) – Axis over which to compute the FFT. If not given, the last axis is used.
norm (None, "ortho", optional) – Normalization mode (see numpy.fft). Default is None.
- Returns:
Curve tuple – Two curves with the real and imaginary parts.
- pydv.pydvpy.filtercurves(curvelist, pattern)¶
Filters the list of curves based on the regular expression pattern.
>>> curves = pydvpy.filtercurves(curves, "*_name")
- Parameters:
curvelist (Curve) – the list of curves
pattern (str) – the regular expression pattern
- Returns:
list – The list of filtered curves from curvelist based on the regular expression pattern
- pydv.pydvpy.fit(c, n=1, logx=False, logy=False)¶
Make a new curve that is a polynomial fit to curve c.
>>> curves = list()
>>> curves.append(pydvpy.span(1,10))
>>> pydvpy.sin(curves)
>>> curves.append(pydvpy.fit(curves[0], 2))
>>> pydvpy.create_plot(curves, legend=True)
- Parameters:
c (Curve) – The curve to fit
n (int) – Degree of the fitting polynomial
logx (bool) – Take the log(x-values) before fitting if True
logy (bool) – Take the log(y-values) before fitting if True
- Returns:
Curve – The fitting polynomial
- pydv.pydvpy.gaussian(amp, wid, center, num=100, nsd=3)¶
Generate a gaussian function.
>>> curve = pydvpy.gaussian(5, 10, 0)
>>> pydvpy.create_plot(curve, legend=True, stylename='ggplot')
- Parameters:
amp (float) – amplitude
wid (float) – width
center (float) – center
num (int) – optional, number of points
nsd (float) – optional, number of half-widths
- Returns:
Curve – representing the gaussian function
- pydv.pydvpy.get_styles()¶
Get the list of available plot styles.
- Returns:
list – the list of available style names or an empty list if no styles exist.
- pydv.pydvpy.getdomain(curvelist)¶
Get domain of the curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> domains = pydvpy.getdomain(curves)
>>> plotname, minx, maxx = domains[0]
- Parameters:
curvelist (Curve or list) – The given curve or list of curves
- Returns:
list – A list of tuples where each tuple contains the curve name, minimum x, and maximum x
- pydv.pydvpy.getfl(curvelist)¶
Returns the first and last data point from the yData array
>>> curves = pydvpy.read('testData.txt')
>>> first_last = pydvpy.getfl(curves) OR
>>> first_last = pydvpy.getfl(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
- Returns:
list – A list of y values at the first and last index
- pydv.pydvpy.getnumpoints(curve)¶
Return the given curve’s number of points.
- Parameters:
curve – The given curve
- Returns:
int – the number of points in curve
- pydv.pydvpy.getrange(curvelist)¶
Get the range of the curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> ranges = pydvpy.getrange(curves)
>>> plotname, miny, maxy = ranges[0]
- Parameters:
curvelist (Curve or list) – The given curve or list of curves
- Returns:
list – A list of tuples where each tuple contains the curve name, minimum y, and maximum y
- pydv.pydvpy.getx(c, value, xmin=None, xmax=None)¶
Get the x values of the curve for a given y.
>>> curves = pydvpy.read('testData.txt')
>>> vals = pydvpy.getx(curves[0], 4)
>>> x, y = vals[0]
- Parameters:
c (Curve) – The curve
value (float) – y value
- Returns:
list – A list of tuples where each tuple contains the x value, and the given y
- pydv.pydvpy.getxi(curvelist, i)¶
Returns a discrete data point from the xData array
>>> curves = pydvpy.read('testData.txt')
>>> xvals = pydvpy.getxi(curves, 42) OR
>>> xvals = pydvpy.getxi(curves[0], 42)
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
i (int) – The index of the point to return
- Returns:
list – A list of x values at the given index
- pydv.pydvpy.gety(c, value)¶
Get the y values of the curve for a given x.
>>> curves = pydvpy.read('testData.txt')
>>> vals = pydvpy.gety(curves[0], 2)
>>> x, y = vals[0]
- Parameters:
c (Curve) – The curve
value (float) – x value
- Returns:
list – A list of tuples where each tuple contains the y value, and the given x
- pydv.pydvpy.getyi(curvelist, i)¶
Returns a discrete data point from the yData array
>>> curves = pydvpy.read('testData.txt')
>>> yvals = pydvpy.getyi(curves, 42) OR
>>> yvals = pydvpy.getyi(curves[0], 42)
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
i (int) – The index of the point to return
- Returns:
list – A list of y values at the given index
- pydv.pydvpy.getymax(c, xmin=None, xmax=None)¶
Get the maximum y-value for the curve within the specified domain.
- Parameters:
c – the curve
xmin (float, optional) – the minimum x-value for the sub-domain
xmax (float, optional) – the maximum x-value for the sub-domain
- Returns:
str – curve name list – a list of tuples where each tuple contains the x-value and the max y-value.
- pydv.pydvpy.getymin(c, xmin=None, xmax=None)¶
Get the minimum y-value for the curve within the specified domain.
- Parameters:
c – the curve
xmin (float, optional) – the minimum x-value for the sub-domain
xmax (float, optional) – the maximum x-value for the sub-domain
- Returns:
str – curve name list – a list of tuples where each tuple contains the x-value and the min y-value.
- pydv.pydvpy.hypot(c1, c2)¶
Calculate harmonic average of two curves, sqrt(a^2+b^2).
- Parameters:
c1 (curve.Curve) – The first curve
c2 (curve.Curve) – The second curve
- Returns:
The harmonic average of two curves, sqrt(a^2+b^2)
- Return type:
- pydv.pydvpy.integrate(curvelist, low=None, high=None)¶
Take the integral of the curve or curves in curvelist.
- Parameters:
curvelist (curve or list) – A curve or list of curves
low (float) – The lower limit
high (float) – The maximum limit
- Returns:
list – the list of integrated curves
- pydv.pydvpy.j0(curvelist)¶
Take the Bessel function of the first kind of the zeroth order for the y values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
- pydv.pydvpy.j0x(curvelist)¶
Take the Bessel function of the first kind of the zeroth order for the x values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
- pydv.pydvpy.j1(curvelist)¶
Take the Bessel function of the first kind of the first order for the y values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
- pydv.pydvpy.j1x(curvelist)¶
Take the Bessel function of the first kind of the first order for the x values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
- pydv.pydvpy.jn(curvelist, n)¶
Take the Bessel function of the first kind of the nth order for the y values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
n (float) – The order
- pydv.pydvpy.jnx(curvelist, n)¶
Take the Bessel function of the first kind of the nth order for the x values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
n (float) – The order
- pydv.pydvpy.l1(c1, c2, xmin=None, xmax=None)¶
Make a new curve that is the L1 norm of curve c1 and curve c2. The L1-norm is the integral(|c1 - c2|) over the interval [xmin, xmax]. # noqa w605
>>> c = pydvpy.l1(curve1, curve2)
>>> c2 = pydvpy.l1(curve1, curve2, 1.1, 10.9)
- pydv.pydvpy.l2(c1, c2, xmin=None, xmax=None)¶
Make a new curve that is the L2 norm of curve c1 and curve c2. The L2-norm is (integral((c1 - c2)**2)**(1/2) over the interval [xmin, xmax].
>>> c = pydvpy.l2(curve1, curve2)
>>> c2 = pydvpy.l2(curve1, curve2, 3.1, 30.9)
- pydv.pydvpy.line(m, b, xmin, xmax, numpts=100)¶
Generate a line with y = mx + b and an optional number of points.
>>> curves = list()
>>> curves.append(pydvpy.line(2, 5, 0, 10))
>>> pydvpy.create_plot(curves, legend=True, stylename='ggplot')
- Parameters:
m (float) – The slope
b (float) – The y-intercept
xmin (float) – The minimum x value
xmax (float) – The maximum x value
numpts (int) – The number of points to use for the new line
- Returns:
Curve – The curve representing the newly created line
- pydv.pydvpy.log(curvelist, keep=True)¶
Take the natural logarithm of y values of the Curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.log(curves) OR
>>> pydvpy.log(curves[0])
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
keep (optional, boolean) – flag to determine whether or not to discard zero or negative y-values before taking the log. keep is True by default.
- pydv.pydvpy.log10(curvelist, keep=True)¶
Take the base 10 logarithm of y values of a Curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.log10(curves) OR
>>> pydvpy.log10(curves[0])
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
keep (optional, boolean) – flag to determine whether or not to discard zero or negative y-values before taking the base 10 logarithm. keep is True by default.
- pydv.pydvpy.log10x(curvelist, keep=True)¶
Take the base 10 logarithm of x values of a Curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.log10x(curves) OR
>>> pydvpy.log10x(curves[0])
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
keep (optional, boolean) – flag to determine whether or not to discard zero or negative y-values before taking the base 10 logarithm. keep is True by default.
- pydv.pydvpy.logx(curvelist, keep=True)¶
Take the natural logarithm of x values of the Curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.logx(curves) OR
>>> pydvpy.logx(curves[0])
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
keep (optional, boolean) – flag to determine whether or not to discard zero or negative x-values before taking the log. keep is True by default.
- pydv.pydvpy.makecurve(x=array([], dtype=float64), y=array([], dtype=float64), name='', filename='', xlabel='', ylabel='', title='', record_id='', step=False, step_original_x=array([], dtype=float64), step_original_y=array([], dtype=float64), xticks_labels=None, plotname='', color='', edited=False, scatter=False, linespoints=False, linewidth=None, linestyle='-', drawstyle='default', dashes=None, hidden=False, ebar=None, erange=None, marker='.', markerstyle=None, markersize=3, markerfacecolor=None, markeredgecolor=None, plotprecedence=0, legend_show=True, math_interp_left=None, math_interp_right=None, math_interp_period=None)¶
Generate a curve from two lists of numbers.
>>> c1 = pydvpy.makecurve([1, 2, 3, 4], [5, 10, 15, 20])
>>> c2 = pydvpy.makecurve([1, 2, 3, 4], [7, 8, 9, 10], 'Line')
- Parameters:
x (list) – list of x values
y (list) – list of y values
name (str) – the name of the new curve
filename (str) – the name of the file containing this curves data.
xlabel (str) – the xlabel of the data.
ylabel (str) – the ylabel of the data.
title (str) – the title of the data.
record_id (str) – the Sina record id of the data.
step (bool) – whether this is a step curve.
step_original_x (list) – list of original x values for step function
step_original_y (list) – list of original y values for step function
xticks_labels (dict) – Dictionary of x tick labels if x data are strings.
plotname (str) – The plot name of the curve.
color (str) – The color of the curve.
edited (bool) – Internally check if curve has been edited to update on plot.
scatter (bool) – Plot this as a scatter plot.
linespoints (bool) – Plot this as a line with point markers.
linewidth (int) – The line width of the curve.
linestyle (str) – The line style of the curve.
drawstyle (str) – The draw style of the curve.
dashes (bool) – Line style has dashes.
hidden (bool) – Hide curve on plot.
ebar (list) – The error bar of the data [y0, y1, x0, x1].
erange (list) – The error range fill between of the data [y0, y1].
marker (str) – The marker type.
markerstyle (str) – The marker style.
markersize (int) – The marker size.
markerfacecolor (str) – The marker face color.
markeredgecolor (str) – The marker edge color.
plotprecedence (int) – The order of the curve.
legend_show (bool) – Show the curve in the legend.
math_interp_left (float) – numpy.interp() left parameter for internal curve math methods
math_interp_right (float) – numpy.interp() right parameter for internal curve math methods
math_interp_period (float) – numpy.interp() period parameter for internal curve math methods
- Returns:
curve – the curve generated from the x and y list of values.
- Return type:
- pydv.pydvpy.makeextensive(curvelist)¶
Set the y-values such that
y[i] *= (x[i+1] - x[i])>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.makeextensive(curves)
>>> pydvpy.create_plot(curves, legend=True)
- Parameters:
curvelist (Curve or list) – The curve or list of curves
- pydv.pydvpy.makeintensive(curvelist)¶
Set the y-values such that y[i] /= (x[i+1] - x[i]).
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.makeintensive(curves)
>>> pydvpy.create_plot(curves, legend=True)
- Parameters:
curvelist (Curve or list) – The curve or list of curves
- pydv.pydvpy.max_curve(curvelist)¶
Construct a curve from the maximum y values of the intersection of the curves domain.
- Parameters:
curvelist – the specified curves
- Returns:
Curve – a new curve with the maximum y-values over the intersection of the domains of the specified curves.
- pydv.pydvpy.min_curve(curvelist)¶
Construct a curve from the minimum y values of the intersection of the curves domain.
- Parameters:
curvelist – the specified curves
- Returns:
Curve – a new curve with the minimum y-values over the intersection of the domains of the specified curves.
- pydv.pydvpy.multiply(curvelist)¶
Take product of curves.
>>> curves = pydvpy.read('testData.txt')
>>> c = pydvpy.multiply(curves)
- Parameters:
curvelist (list) – The list of curves
- Returns:
Curve – the curve containing the product of the curves
- pydv.pydvpy.mx(curvelist, value)¶
Scale x values of a curve or list of curves by a constant value.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.mx(curves, 4) OR
>>> pydvpy.mx(curves[0], 4)
- Parameters:
curvelist (Curve or list) – A curve or curvelist
value (float) – The amount to scale the x values by
- pydv.pydvpy.my(curvelist, value)¶
Scale y values of a curve or list of curves by a constant value.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.my(curves, 4) OR
>>> pydvpy.my(curves[0], 4)
- Parameters:
curvelist (Curve or list) – A curve or curvelist
value (float) – The amount to scale the y values by
- pydv.pydvpy.norm(c1, c2, p, xmin=None, xmax=None)¶
Make a new curve that is the p-norm of curve c1 and curve c2.
>>> curves = pydvpy.read('testData.txt')
>>> c = pydvpy.norm(curves[0], curves[1], 'inf')
>>> curves.append(c)
- pydv.pydvpy.normalize(c)¶
Normalize a curve.
- Parameters:
c (curve.Curve) – The curve to normalize
- Returns:
The normalized curve
- Return type:
- pydv.pydvpy.overlap_interp(cr1, cr2, npts_interp=0)¶
Get the a set of overlapping interpolated curves.
>>> curves = pydvpy.read('testData.txt')
>>> cr1_interp, cr2_interp = pydvpy.overlap_interp(curves[0], curves[1], npts_interp=100)
- pydv.pydvpy.powa(curvelist, a)¶
Raise a fixed value, a, to the power of the y values of the Curve or list of curves. y = a^y
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.powa(curves, 2) OR
>>> pydvpy.powa(curves[0], 2)
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
a (float) – the fixed value
- pydv.pydvpy.powax(curvelist, a)¶
Raise a fixed value, a, to the power of the x values of the Curve or curves. x = a^x
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.powax(curves, 4.2) OR
>>> pydvpy.powax(curves[0], 4.2)
- Parameters:
curvelist (Curve or list) – the Curve or list of curves
a (float) – the fixed value
- pydv.pydvpy.powr(curvelist, a)¶
Raise a the y values of a curve or list of curves to a fixed power, y = y^a.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.powr(curves, 4.2) OR
>>> pydvpy.powr(curves[0], 4.2)
- Parameters:
curvelist (curve or list) – the curve or list of curves
a (float) – the fixed value
- pydv.pydvpy.powrx(curvelist, a)¶
Raise a the x values of a curve or list of curves to a fixed power, x = x^a.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.powrx(curves, 4.2) OR
>>> pydvpy.powrx(curves[0], 4.2)
- Parameters:
curvelist (curve or list) – the curve or list of curves
a (float) – the fixed value
- pydv.pydvpy.random(curve)¶
Generate random y values between -1 and 1 for the specified curves.
>>> c = pydvpy.span(1, 10)
>>> pydvpy.random(c)
- Parameters:
curve (Curve) – The curve to sort
- pydv.pydvpy.read(fname, gnu=False, xcol=0, verbose=False, pattern=None, matches=None)¶
Read the file and add parsed curves to a curvelist
>>> curves = pydvpy.read('testData.txt')
>>> curves = pydvpy.read('testData.txt', False, 0, False, '*_name', 20)
- Parameters:
fname (str) – ULTRA filename
gnu (bool) – optional, flag to determine if the file is a column oriented (.gnu) file.
xcol (int) – optional, x-column number for column oriented (.gnu) files
verbose (bool) – optional, prints the error stacktrace when True
pattern (str) – optional, the regular expression pattern
matches (int) – optional, maximum number of times to match pattern, if specified
- Returns:
list – the list of curves from the file matching pattern, if specified
- pydv.pydvpy.readcsv(fname, xcol=0, verbose=False)¶
Load a csv (comma separated values) data file, add parsed curves to a curvelist. ‘#’ is the comment character. First uncommented line must be the column labels. We assume the first column is the x-data, every other column is y-data. We also assume all columns are the same length.
>>> curves = readcsv('testData.csv')
- Parameters:
fname (str) – csv filename
xcol (int) – x-column number for column oriented (.gnu) files
verbose (bool) – prints the error stacktrace when True
- Returns:
list – the list of curves from the csv file
- pydv.pydvpy.readsina(fname, verbose=False)¶
Load a Sina JSON data file, add parsed curves to a curvelist.
We assume JSON conforming to the Sina schema, with each curve defined in a curve_set. We assume there is only one record, and if there are more then we only read the first one. We also assume only one independent variable per curve_set; if there are more than one, then PyDV may exhibit undefined behavior. Can also read curve_sets within libraries in library_data.
>>> curves = readsina('testData.json')
- Parameters:
fname (str) – Sina JSON filename
verbose (bool) – prints the error stacktrace when True
- Returns:
list: the list of curves from the sina file
- pydv.pydvpy.recip(curvelist)¶
Take the reciprocal of the y values of the curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.recip(curves[1])
>>> pydvpy.create_plot(curves, legend=True, stylename='ggplot')
- Parameters:
curvelist (Curve or list) – The curve or list of curves
- pydv.pydvpy.recipx(curvelist)¶
Take the reciprocal of the x values of the curve or list of curves.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.dx(curves, 2)
>>> pydvpy.recipx(curves)
>>> pydvpy.create_plot(curves, legend=True, stylename='ggplot')
- Parameters:
curvelist (Curve or list) – The curve or list of curves
- Returns:
- pydv.pydvpy.rev(curve)¶
Swap x and y values for the specified curves. You may want to sort after this one.
>>> c = pydvpy.span(1, 10)
>>> pydvpy.rev(c)
- Parameters:
curve (Curve) – The curve to sort
- pydv.pydvpy.save(fname, curvelist, verbose=False, save_labels=False)¶
Saves the given Curve or list of Curves to a file named fname.
>>> curves = list()
>>> curves.append(pydvpy.makecurve([1, 2, 3, 4], [5, 10, 15, 20]))
>>> pydvpy.save('myfile.txt', curves) OR
>>> pydvpy.save('myfile.txt', curves[0])
- Parameters:
fname (str) – ULTRA filename
curvelist (Curve or list) – The curve or list of curves to save
verbose (bool) – prints the error stacktrace when True
- pydv.pydvpy.savecsv(fname, curvelist, verbose=False)¶
Saves the Curve or list of Curves to file in comma separated values (csv) format. Assumes all curves have the same x basis.
>>> curves = list()
>>> curves.append(pydvpy.makecurve([1, 2, 3, 4], [5, 10, 15, 20]))
>>> pydvpy.savecsv('myfile.csv', curves)
- Parameters:
fname (str) – ULTRA filename
curvelist (list) – The Curve or list of Curves to save
verbose (bool) – prints the error stacktrace when True
- pydv.pydvpy.shift(curvelist, x=0, y=0)¶
Shifts curves by an x and y value.
>>> curves = pydvpy.read('testData.txt')
>>> new_curves = pydvpy.shift(curves, x=10, y=11) OR
>>> new_curves = pydvpy.shift(curves[0], x=10, y=11)
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
x (float) – The point to shift the x array
y (float) – The point to shift the y array
- Returns:
Curve – A list of new curves with the shifted x and y values
- pydv.pydvpy.sin(curvelist)¶
Take the sine of y values of a single curve or multiple curves in list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.sin(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.sinh(curvelist)¶
Take the hyperbolic sine of y values of a single curve or multiple curves in list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.sinh(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.sinhx(curvelist)¶
Take the hyperbolic sine of x values of a single curve or multiple curves in list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.sinhx(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.sinx(curvelist)¶
Take the sine of x values of a single curve or multiple curves in list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.sinx(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.smooth(curvelist, factor=1)¶
Smooth the curve to the given degree.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.smooth(curves, 4)
>>> pydvpy.create_plot(curves, legend=True)
- Parameters:
curvelist (Curve or list) – The curve or list of curves
factor (int) – The smooth factor
- pydv.pydvpy.sort(curve)¶
Sort the specified curve so that their points are plotted in order of ascending x values.
>>> c = pydvpy.span(1, 10)
>>> pydvpy.sort(c)
- Parameters:
curve (Curve) – The curve to sort
- pydv.pydvpy.span(xmin, xmax, numpts=100)¶
Generates a straight line of slope 1 and y intercept 0 in the specified domain with an optional number of points.
>>> c = pydvpy.span(1, 10)
- Parameters:
xmin (float) – The minimum x value
xmax (float) – The maximum x value
numpts (int) – The number of points used to plot the line
- Returns:
curve – the curve object representing the straight line.
- pydv.pydvpy.sqr(curvelist)¶
Take the square of the y values in a curve or list of curves.
- Parameters:
curvelist (curve or list) – the curve or list of curves
- pydv.pydvpy.sqrt(curvelist)¶
Take the square root of the y values in a curve or list of curves.
- Parameters:
curvelist (curve or list) – the curve or list of curves
- pydv.pydvpy.sqrtx(curvelist)¶
Take the square root of the x values in a curve or list of curves.
- Parameters:
curvelist (curve or list) – the curve or list of curves
- pydv.pydvpy.sqrx(curvelist)¶
Take the square of the x values in a curve or list of curves.
- Parameters:
curvelist (curve or list) – the curve or list of curves
- pydv.pydvpy.subsample(curvelist, stride=2, verbose=False)¶
Subsample the curve or list of curves, i.e., reduce to every nth value.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.subsample(curves, 4)
>>> pydvpy.create_plot(curves, legend=True)
- Parameters:
curvelist (Curve or list) – The curve or list of curves
stride (int) – The step size through the array
verbose (bool) – If True additional information will be printed to stdout
- pydv.pydvpy.subtract(curvelist)¶
Take difference of curves.
>>> curves = pydvpy.read('testData.txt')
>>> c = pydvpy.subtract(curves)
- Parameters:
curvelist (list) – The list of curves
- Returns:
curve – the curve containing the difference of the curves
- pydv.pydvpy.sum(curvelist)¶
Return sum of the x and y values of each curve.
>>> curves = pydvpy.read('testData.txt')
>>> sums = pydvpy.sum(curves)
>>> plotname, sumx, sumy = sums[0]
- Parameters:
curvelist (Curve or list) – The given curve or list of curves
- Returns:
list – A list of tuples where each tuple contains the curve name, sum of x-values, and sum of y-values
- pydv.pydvpy.swapCoords(curvelist)¶
Swap x and y values for the specified curves.
>>> curves = pydvpy.read('testData.txt')
>>> new_curves = pydvpy.swapCoords(curves) OR
>>> new_curves = pydvpy.swapCoords(curves[0])
- Parameters:
curvelist (Curve or list) – The Curve or list of Curves
- Returns:
Curve – A list of new curves with the swapped x and y values
- pydv.pydvpy.tan(curvelist)¶
Take the tangent of y values of a single curve or multiple curves in list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.tan(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.tanh(curvelist)¶
Take the hyperbolic tangent of y values of a single curve or multiple curves in list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.tanh(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.tanhx(curvelist)¶
Take the hyperbolic tangent of x values of a single curve or multiple curves in list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.tanhx(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.tanx(curvelist)¶
Take the tangent of x values of a single curve or multiple curves in list.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.tanx(curves)
- Parameters:
curvelist (curve or list) – A single curve or a list of curves
- pydv.pydvpy.theta(xmin, x0, xmax, numpts=100)¶
Generate a unit step distribution.
- Parameters:
xmin (Union[int,float]) – The left most point
x0 (Union[int,float]) – The step point
xmax (Union[int,float]) – The right most point
numpts (Union[int,float], optional) – Number of points, defaults to 100
- Returns:
The curve
- Return type:
- pydv.pydvpy.vs(c1, c2)¶
Create a new curve that will plot as the range of the first curve against the range of the second curve.
>>> curves = pydvpy.read('testData.txt')
>>> c1 = pydvpy.vs(curves[0], curves[1])
>>> curves.append(c1)
>>> pydvpy.create_plot(curves, legend=True)
- pydv.pydvpy.xindex(curvelist)¶
Create curves with y-values vs. integer index values.
>>> curves = pydvpy.read('testData.txt')
>>> pydvpy.xindex(curves)
>>> pydvpy.create_plot(curves, legend=True)
- Parameters:
curvelist (Curve or list) – The curve or list of curves
- pydv.pydvpy.xmax(curvelist, max)¶
Filter out points in the curve or list of curves whose x values are greater than limit.
- Parameters:
curvelist (curve or list) – The curve or list of curves
max (float) – The maximum value
- pydv.pydvpy.xmin(curvelist, min)¶
Filter out points in the curve or list of curves whose x values are less than min.
- Parameters:
curvelist (curve or list) – The curve or list of curves
min (float) – The minimum value
- pydv.pydvpy.xminmax(curvelist, min, max)¶
Filter out points in the curve or list of curves whose x values are less than min or greater than max.
- Parameters:
curvelist (curve or list) – The curve or list of curves
min (float) – The minimum value
max (float) – The maximum value
- pydv.pydvpy.y0(curvelist)¶
Take the Bessel function of the second kind of the zeroth order for the y values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
- pydv.pydvpy.y0x(curvelist)¶
Take the Bessel function of the second kind of the zeroth order for the x values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
- pydv.pydvpy.y1(curvelist)¶
Take the Bessel function of the second kind of the first order for the y values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
- pydv.pydvpy.y1x(curvelist)¶
Take the Bessel function of the second kind of the first order for the x values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
- pydv.pydvpy.ymax(curvelist, max)¶
Filter out points in the curve or list of curves whose y values are greater than limit.
- Parameters:
curvelist (curve or list) – The curve or list of curves
max (float) – The maximum value
- pydv.pydvpy.ymin(curvelist, min)¶
Filter out points in the curve or list of curves whose y values are less than min.
- Parameters:
curvelist (curve or list) – The curve or list of curves
min (float) – The minimum value
- pydv.pydvpy.yminmax(curvelist, min, max)¶
Filter out points in the curve or list of curves whose y values are less than min or greater than max.
- Parameters:
curvelist (curve or list) – The curve or list of curves
min (float) – The minimum value
max (float) – The maximum value
- pydv.pydvpy.yn(curvelist, n)¶
Take the Bessel function of the second kind of order n for the y values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
n (int) – The order
- pydv.pydvpy.ynx(curvelist, n)¶
Take the Bessel function of the second kind of order n for the x values of curves in curvelist.
- Parameters:
curvelist (curve or list) – The curve or list of curves
n (int) – The order
curve module¶
- class pydv.curve.Curve(x=array([], dtype=float64), y=array([], dtype=float64), name='', filename='', xlabel='', ylabel='', title='', record_id='', step=False, step_original_x=array([], dtype=float64), step_original_y=array([], dtype=float64), xticks_labels=None, plotname='', color='', edited=False, scatter=False, linespoints=False, linewidth=None, linestyle='-', drawstyle='default', dashes=None, hidden=False, ebar=None, erange=None, marker='.', markerstyle=None, markersize=3, markerfacecolor=None, markeredgecolor=None, plotprecedence=0, legend_show=True, math_interp_left=None, math_interp_right=None, math_interp_period=None)¶
Bases:
object- copy()¶
Return a new copy of the curve object
- normalize()¶
Return a new normalized copy of the curve object
- pydv.curve.append(a, b)¶
Merge curve a and curve b over the union of their domains. Where domains overlap, take the average of the curve’s y-values.
- Parameters:
a (curve) – Curve A
b (curve) – Curve B
- Returns:
a new curve resulting from the merging of curve a and curve b
- pydv.curve.getinterp(a, b, a_left=None, a_right=None, a_period=None, b_left=None, b_right=None, b_period=None, samples=100, match='domain')¶
Gets the interpolated and domain matched versions of the two curves.
- Parameters:
a (curve) – Curve A
b (curve) – Curve B
a_left (float, optional) – numpy.interp() left parameter for internal curve math methods for Curve A
a_right – numpy.interp() right parameter for internal curve math methods for Curve A
a_period – numpy.interp() period parameter for internal curve math methods for Curve A
b_left (float, optional) – numpy.interp() left parameter for internal curve math methods for Curve B
b_right – numpy.interp() right parameter for internal curve math methods for Curve B
b_period – numpy.interp() period parameter for internal curve math methods for Curve B
{'domain','step'},optional (match) – A string indicating how to interpolate the two curves
- Type:
a_right: float, optional
- Type:
a_period: float, optional
- Type:
b_right: float, optional
- Type:
b_period: float, optional
- Returns:
curve pair – the interpolated and domain matched versions of a and b
- pydv.curve.interp1d(a, num=100, retstep=False)¶
Gets the interpolated values of the curve with the specified number of samples.
- Parameters:
a (curve) – Curve A
num – Number of samples to generate. Default is 100. Must be non-negative.
retstep – return the spacing between samples
- Type:
num: int, optional
- Type:
retstep: bool, optional
- Returns:
ia: curve – the interpolated and dimensions matched version of a step: float, optional – only returned if retstep is True. Size of the spacing between samples
pdv module¶
- class pydv.pdv.Command(completekey='tab', stdin=None, stdout=None)¶
Bases:
Cmd,object- addtoplot(cur)¶
Ensure curve is valid and add it to the plotlist
- annotationfont = 'medium'¶
- app = None¶
- apply_uichanges()¶
Applies the changes made by the user from the GUI.
- axistickfont = 'medium'¶
- bordercolor = None¶
- console_run()¶
- curvefromlabel(label)¶
Get curve from its label/plot name
- curvelabelfont = 'medium'¶
- curvelist = []¶
- debug = False¶
- default(line)¶
Check for arithmetic calculation
- derivative(cur)¶
Return derivative of curve
- do_L1(line)¶
Take L1 norm of two curves. The L1 norm is integral( |curve1 - curve2| ) over the interval [xmin,xmax]. Also prints value of integral to command-line.
[PyDV]: L1 <curve1> <curve2> [<xmin> <xmax>] Ex: [PyDV]: L1 a b [PyDV]: L1 a b 4 10
- do_L2(line)¶
Take L2 norm of two curves. The L2 norm is integral( (curve1 - curve2)**2 )**(1/2) over the interval [xmin,xmax]. Also prints value of integral to command-line.
[PyDV]: L2 <curve1> <curve2> [<xmin> <xmax>] Ex: [PyDV]: L2 a b [PyDV]: L2 a b 4 10
- do_abs(line)¶
Take the absolute value of the y values of the curves. Modifies the existing curve.
[PyDV]: abs <curve-list> Ex: [PyDV]: abs a [PyDV]: abs a:b [PyDV]: abs c d
- do_absx(line)¶
Take the absolute value of the x values of the curves. Modifies the existing curve.
[PyDV]: absx <curve-list> Ex: [PyDV]: absx a [PyDV]: absx a:b [PyDV]: absx c d
- do_acos(line)¶
Take arccosine of y values of curves
[PyDV]: acos <curve-list> Ex: [PyDV]: acos a [PyDV]: acos a:b [PyDV]: acos c d
- do_acosh(line)¶
Take hyperbolic arccosine of y values of curves.
[PyDV]: acosh <curve-list> Ex: [PyDV]: acosh a [PyDV]: acosh a:b [PyDV]: acosh c d
- do_acoshx(line)¶
Take hyperbolic arccosine of x values of curves.
[PyDV]: acoshx <curve-list> Ex: [PyDV]: acoshx a [PyDV]: acoshx a:b [PyDV]: acoshx c d
- do_acosx(line)¶
Take arccosine of x values of curves
[PyDV]: acosx <curve-list> Ex: [PyDV]: acosx a [PyDV]: acosx a:b [PyDV]: acosx c d
- do_add(line)¶
Take the sum of curves. If the optional value is specified it will add the y-values of the curves by value (equivalent to using the dy command). Shortcut: +
Note
Be sure that the x points are in increasing order as PyDV uses numpy.interp().
Note
Adding curves by a number modifies the curve. If you want to create a new curve then copy the original curve first using the copy command.
[PyDV]: add <curve-list> [value] Ex: [PyDV]: add a [PyDV]: add a:b [PyDV]: add c d [PyDV]: add c d 7
- do_add_h(line)¶
Adds curves that have been read from a file but not yet plotted. list-of-menu-numbers are the index values displayed in the first column of the menu command.
[PyDV]: add_h <list-of-menu-numbers> Ex: [PyDV]: add_h 1 [PyDV]: add_h 1:2 [PyDV]: add_h 3 4
- do_alias(line)¶
Define a synonym for an existing command.
[PyDV]: alias <command> <alias> Ex: [PyDV]: alias list l
- do_alpha(line)¶
Find the alpha.
[PyDV]: alpha <calculated-a> <calculated-i> <response> [# points]
- do_annot(line)¶
Display text on the plot at point (x, y). List of annotations can be seen with listannot.
[PyDV]: annot <text> <x> <y> Ex: [PyDV]: annot mytext 1 2
- do_appendcurves(line)¶
Merge a list of curves over the union of their domains. Where the domains overlap, take the average of the curves’ y-values.
[PyDV]: appendcurves <curve-list> Ex: [PyDV]: appendcurves a:b [PyDV]: appendcurves c d
- do_area(line)¶
Calculate the area of the curves.
[PyDV]: area <curve-list> Ex: [PyDV]: area a [PyDV]: area a:b [PyDV]: area c d
- do_asin(line)¶
Take arcsine of y values of curves.
[PyDV]: asin <curve-list> Ex: [PyDV]: asin a [PyDV]: asin a:b [PyDV]: asin c d
- do_asinh(line)¶
Take hyperbolic arcsine of y values of curves.
[PyDV]: asinh <curve-list> Ex: [PyDV]: asinh a [PyDV]: asinh a:b [PyDV]: asinh c d
- do_asinhx(line)¶
Take hyperbolic arcsine of x values of curves.
[PyDV]: asinhx <curve-list> Ex: [PyDV]: asinhx a [PyDV]: asinhx a:b [PyDV]: asinhx c d
- do_asinx(line)¶
Take arcsine of x values of curves.
[PyDV]: asinx <curve-list> Ex: [PyDV]: asinx a [PyDV]: asinx a:b [PyDV]: asinx c d
- do_atan(line)¶
Take arctangent of y values of curves.
[PyDV]: atan <curve-list> Ex: [PyDV]: atan a [PyDV]: atan a:b [PyDV]: atan c d
- do_atan2(line)¶
Take atan2 of two curves.
[PyDV]: atan2 <curve1> <curve2> Ex: [PyDV]: atan2 a [PyDV]: atan2 a:b [PyDV]: atan2 c d
- do_atanh(line)¶
Take hyperbolic arctangent of y values of curves.
[PyDV]: atanh <curve-list> Ex: [PyDV]: atanh a [PyDV]: atanh a:b [PyDV]: atanh c d
- do_atanhx(line)¶
Take hyperbolic arctangent of x values of curves.
[PyDV]: atanhx <curve-list> Ex: [PyDV]: atanhx a [PyDV]: atanhx a:b [PyDV]: atanhx c d
- do_atanx(line)¶
Take arctangent of x values of curves.
[PyDV]: atanx <curve-list> Ex: [PyDV]: atanx a [PyDV]: atanx a:b [PyDV]: atanx c d
- do_average(line)¶
Average the specified curvelist over the intersection of their domains.
[PyDV]: average <curve-list> Ex: [PyDV]: average a [PyDV]: average a:b [PyDV]: average c d
- do_axis(line)¶
Show or hide the axis.
[PyDV]: axis <on | off> Ex: [PyDV]: axis on [PyDV]: axis off
- do_bkgcolor(line)¶
Change the background color of the plot, window, or both.
[PyDV]: bkgcolor <[plot | window] color | reset> Ex: [PyDV]: bkgcolor plot blue [PyDV]: bkgcolor window blue [PyDV]: bkgcolor reset
- do_border(line)¶
Show or hide the plot border. By default, the border color is black.
[PyDV]: border <on | 1 | off | 0> [color] Ex: [PyDV]: border on [PyDV]: border on blue [PyDV]: border off
- do_color(line)¶
Set the color of curves. Color names can be “blue”, “red”, etc., or “#eb70aa”, a 6 digit set of hexadecimal red-green-blue values #RRGGBB. The entire set of HTML-standard color names is available. Type showcolormap to see the available named colors which will show up in the PyDV plotting area (hit return to go back to your plots).
[PyDV]: color <curve-list> <color> Ex: [PyDV]: color a blue [PyDV]: color a:b blue [PyDV]: color c d blue [PyDV]: color a #aabb33 [PyDV]: showcolormap hit return to go back to your plots [PyDV]: color a lime
- do_convol(line)¶
- do_convolb(line)¶
- do_convolc(line)¶
- do_convolve(line)¶
Computes the convolution of the two given curves.
THIS IS DEPRECIATED
Use convolc for (g*h)(x) = Int(-inf, inf, dt*g(t)*h(x-t))
Use convolb for (g*h)(x) = Int(-inf, inf, dt*g(t)*h(x-t)) / Int(-inf, inf, dt*h(t))
- do_convolveb(line)¶
Computes the convolution of the two given curves and normalizes by the area under the second curve.
(g*h)(x) = Int(-inf, inf, dt*g(t)*h(x-t)) / Int(-inf, inf, dt*h(t))
[PyDV]: convolveb <curve1> <curve2> [points] [points_interp] Ex: [PyDV]: convolveb g h [PyDV]: convolveb g h 200 [PyDV]: convolveb g h 200 200
- do_convolvec(line)¶
Computes the convolution of the two given curves with no normalization.
(g*h)(x) = Int(-inf, inf, dt*g(t)*h(x-t))
[PyDV]: convolvec <curve1> <curve2> [points] [points_interp] Ex: [PyDV]: convolvec g h [PyDV]: convolvec g h 200 [PyDV]: convolvec g h 200 200
- do_copy(line)¶
Copy and plot the given curves.
[PyDV]: copy <curve-list> Ex: [PyDV]: copy a [PyDV]: copy a:b [PyDV]: copy c d
- do_correl(line)¶
Computes the cross-correlation of two curves.
[PyDV]: correl <curve1> <curve2> Ex: [PyDV]: correl a b
- do_cos(line)¶
Take the cosine of the y values of the curves.
[PyDV]: cos <curve-list> Ex: [PyDV]: cos a [PyDV]: cos a:b [PyDV]: cos c d
- do_cosh(line)¶
Take hyperbolic cosine of y values of curves.
[PyDV]: cosh <curve-list> Ex: [PyDV]: cosh a [PyDV]: cosh a:b [PyDV]: cosh c d
- do_coshx(line)¶
Take hyperbolic cosine of x values of curves.
[PyDV]: coshx <curve-list> Ex: [PyDV]: coshx a [PyDV]: coshx a:b [PyDV]: coshx c d
- do_cosx(line)¶
Take the cosine of the x values of the curves.
[PyDV]: cosx <curve-list> Ex: [PyDV]: cosx a [PyDV]: cosx a:b [PyDV]: cosx c d
- do_cumsum(line)¶
Create new curve which is the cumulative sum of the original curve.
[PyDV]: cumsum <curve-list> Ex: [PyDV]: cumsum a [PyDV]: cumsum a:b [PyDV]: cumsum c d
- do_cur(line)¶
- do_curve(line)¶
Select curves from the menu for plotting. A regular expression may be supplied in paranthesis for matching against the curve label to plot.
Regular expressions are based on the Python regex syntax, not the UNIX syntax. In particular, ‘*’ is not the wildcard you might be expecting.
For an explanation of the regex syntax, type ‘help regex’.
[PyDV]: <curve | cur> [menu (<regex>)] <list-of-menu-numbers> Ex: [PyDV]: cur 1 [PyDV]: cur 2:3 [PyDV]: cur 4 5 [PyDV]: cur (.*my_curves.*)
- do_custom(line)¶
Load a Python file of custom functions to extend PyDV. Functions must be of the form def do_commandname(self, line): ….
This custom Python script is imported at the pdv.py level and thus you can use the methods within class Command(): by calling self.do_METHOD_NAME():. These are the methods used in the [PyDV] command line prompt that are detailed in this documentation.
The pydvpy.py module is imported as pydvpy which means you can also use the PyDV Python API functions by calling pydvpy.FUNCTION_NAME():.
Below are some template functions that are used throughout PyDV. The parameter line is the text that is passed into the function after the function name in the PyDV Command Line Interface. These functions should have try statements so that PyDV doesn’t crash if there is an error. Be sure to pass in the command debug on to PyDV to get more information about any errors.
[PyDV]: custom <file-name> Ex: [PyDV]: debug on [PyDV]: custom my_custom_functions.py [PyDV]: mycustomfunction [PyDV]: myothercustomfunction [PyDV]: createcustomcurve a:b [PyDV]: customcurveinfo a:b
my_custom_functions.py:
import os def do_mycustomfunction(self, line): ''' Create new curve and add it to the `self.curvelist()`. These are the curves shown with the `menu` command. ''' try: num_curves = int(line) for i in range(num_curves): x = [i, i + 1, i + 2] y = x name = f'TestCurve_{i}' fname = f'TestFilename_{i}' xlabel = f'TestXlabel_{i}' ylabel = f'TestYlabel_{i}' title = f'TestTitle_{i}' record_id = f'TestRecordID_{i}' c = pydvpy.makecurve(x=x, y=y, name=name, filename=fname, xlabel=xlabel, ylabel=ylabel, title=title, record_id=record_id) self.curvelist.append(c) except: pdvutil.print_own_docstring(self) def do_myothercustomfunction(self, line): ''' Calling other functions within PyDV. ''' try: files = line.split() TEST_DIR = os.path.dirname(os.path.abspath(__file__)) self.do_read(os.path.join(TEST_DIR, '../tests', files[0])) self.do_readsina(os.path.join(TEST_DIR, '../tests', files[1])) except: pdvutil.print_own_docstring(self) def do_createcustomcurve(self, line): ''' Create new curve and add it to the `self.plotlist()`. These are the curves shown with the `list` command. ''' if not line: return 0 try: if len(line.split(':')) > 1: self.do_createcustomcurve(pdvutil.getletterargs(line)) return 0 else: line = line.split() for i in line: idx = pdvutil.getCurveIndex(i, self.plotlist) cur = self.plotlist[idx] x = cur.x + 10 y = cur.y - 10 nc = pydvpy.makecurve(x=x, y=y, name=name, filename=fname, xlabel=xlabel, ylabel=ylabel, title=title, record_id=record_id) self.addtoplot(nc) self.plotedit = True except: pdvutil.print_own_docstring(self) def do_customcurveinfo(self, line): ''' Acquire information from the the curves in `self.plotlist()`. ''' try: if len(line.split(':')) > 1: self.do_customcurveinfo(pdvutil.getletterargs(line)) return 0 else: print('\nCustom Curve Info:') line = line.split() for i in range(len(line)): try: idx = pdvutil.getCurveIndex(line[i], self.plotlist) cur = self.plotlist[idx] info = numpy.sum(cur.x) + 10 print(f'\nCurve {cur.plotname}: {cur.name}') print(f'\tInfo: {info:.6e}') except pdvutil.CurveIndexError: pass print('') except: pdvutil.print_own_docstring(self)t) finally: self.redraw = False
- do_dashstyle(line)¶
Set the style of dash or dot dash lines. The python list is a list of integers, alternating how many pixels to turn on and off, for example:
[2, 2] : Two pixels on, two off (will result in a dot pattern).
[4, 2, 2, 2] : 4 on, 2 off, 2 on, 2 off (results in a dash-dot pattern).
[4, 2, 2, 2, 4, 2] : Gives a dash-dot-dash pattern.
[4, 2, 2, 2, 2, 2] : Gives a dash-dot-dot pattern.
See matplotlib ‘set_dashes’ command for more information.
[PyDV]: dashstyle <curve-list> <[...]> Ex: [PyDV]: dashstyle a [2, 2] [PyDV]: dashstyle a:b [2, 2] [PyDV]: dashstyle c d [2, 2]
- do_dataid(line)¶
Show or hide curve identifiers on plot.
[PyDV]: dataid <on | off> Ex: [PyDV]: dataid on [PyDV]: dataid off
- do_debug(line)¶
Turn on debug tracebacks for commands.
[PyDV]: debug on | off Ex: [PyDV]: debug on [PyDV]: debug off
- do_del(line)¶
- do_delannot(line)¶
Delete annotations from list. List of annotations can be seen with listannot.
[PyDV]: delannot <number-list-of-annotations> Ex: [PyDV]: listannot [PyDV]: delannot 1 [PyDV]: delannot 1:2 [PyDV]: delannot 3 4
- do_delete(line)¶
Delete a curve from the graph.
[PyDV]: <delete | del> <curve-list> Ex: [PyDV]: delete a [PyDV]: delete a:b [PyDV]: delete c d
- do_delta(line)¶
Procedure: Generate a Dirac delta distribution such that Int(xmin, xmax, dt*delta(t - x0)) = 1.
[PyDV]: delta <xmin> <x0> <xmax> [<# points>] Ex: [PyDV]: delta -5 0 5 [PyDV]: delta -3 3 5 200
- do_deltax(line)¶
Create new curve that calculates difference between its own X points. Delta X vs # of points - 1.
[PyDV]: deltax <curve> Ex: [PyDV]: deltax a [PyDV]: deltax a:b
- do_deltay(line)¶
Create new curve that calculates difference between its own Y points. Delta Y vs # of points - 1.
[PyDV]: deltay <curve> Ex: [PyDV]: deltay a [PyDV]: deltay a:b
- do_der(line)¶
- do_derivative(line)¶
Take the derivative of curves.
[PyDV]: <derivative | der> <curve-list> Ex: [PyDV]: derivative a [PyDV]: derivative a:b [PyDV]: derivative c d
- do_diffMeasure(line)¶
Compare two curves. For the given curves a fractional difference measure and its average is computed
[PyDV]: diffMeasure <curve1> <curve2> [tolerance] Ex: [PyDV]: diffMeasure a b [PyDV]: diffMeasure a b 0.1
- do_disp(line)¶
Display the y-values in the specified curve(s).
[PyDV]: disp <curve-list> [format <format>] Ex: [PyDV]: disp a [PyDV]: disp a:b [PyDV]: disp c d [PyDV]: disp c d format e [PyDV]: disp c d format .4f
- do_dispx(line)¶
Display the x-values in the specified curve(s).
[PyDV]: dispx <curve-list> [format <format>] Ex: [PyDV]: dispx a [PyDV]: dispx a:b [PyDV]: dispx c d [PyDV]: dispx c d format e [PyDV]: dispx c d format .4f
- do_div(line)¶
- do_divide(line)¶
Take quotient of curves. If the optional value is specified it will divide the y-values of the curves by value.
Note
Be sure that the x points are in increasing order as PyDV uses numpy.interp().
Note
Dividing curves by a number modifies the curve. If you want to create a new curve then copy the original curve first using the copy command.
[PyDV]: <divide | / | div> <curve-list> [value] Ex: [PyDV]: divide a [PyDV]: divide a:b [PyDV]: divide c d [PyDV]: divide c d 7
- do_divide_h(line)¶
Divides curves that have been read from a file but not yet plotted. list-of-menu-numbers are the index values displayed in the first column of the menu command.
[PyDV]: divide_h <list-of-menu-numbers> Ex: [PyDV]: divide_h 1 [PyDV]: divide_h 1:2 [PyDV]: divide_h 3 4
- do_divx(line)¶
Divide x values of curves by a constant.
[PyDV]: divx <curve-list> <value> Ex: [PyDV]: divx a 7 [PyDV]: divx a:b 7 [PyDV]: divx c d 7 [PyDV]: divx c d 7
- do_divy(line)¶
Divide y values of curves by a constant.
[PyDV]: divy <curve-list> <value> Ex: [PyDV]: divy a 7 [PyDV]: divy a:b 7 [PyDV]: divy c d 7 [PyDV]: divy c d 7
- do_dom(line)¶
- do_domain(line)¶
Set the domain for plotting. Using de (for default) will let the curves determine the domain.
[PyDV]: <domain | dom> <x-min> <x-max> Ex: [PyDV]: domain 3 7 [PyDV]: domain de
- do_drawstyle(line)¶
Set draw style of given curves.
[PyDV]: drawstyle <curve-list> <style: default | steps | steps-pre | steps-post | steps-mid> Ex: [PyDV]: drawstyle a steps [PyDV]: drawstyle a:b steps-pre [PyDV]: drawstyle c d steps-post
- do_drop(line)¶
Start the Python Interactive Console.
[PyDV]: drop Ex: [PyDV]: drop
Afterwards:
>>> import matplotlib.pyplot as plt >>> plt.ion() >>> my_fig = plt.gcf() # get figure object >>> my_axis = plt.gca() # get axis object >>> my_axis.plot([1, 2], [5, 6]) >>> Ctrl+D # to go back into pydv
Back in PyDV:
[PyDV]: quit # only if you want to quit pydv
- do_dupx(line)¶
Duplicate x-values so that y=x for each of the specified curves.
[PyDV]: dupx <curve-list> Ex: [PyDV]: dupx a [PyDV]: dupx a:b [PyDV]: dupx c d
- do_dx(line)¶
Shift x values of curves by a constant.
[PyDV]: dx <curve-list> <value> Ex: [PyDV]: dx a 3 [PyDV]: dx a:b 3 [PyDV]: dx c d 3
- do_dy(line)¶
Shift y values of curves by a constant.
[PyDV]: dy <curve-list> <value> Ex: [PyDV]: dy a 3 [PyDV]: dy a:b 3 [PyDV]: dy c d 3
- do_era(line)¶
- do_erase(line)¶
Erase all curves on the screen but leave the limits untouched.
[PyDV]: <erase | era> Ex: [PyDV]: erase
- do_errorbar(line)¶
Plot error bars on the given curve.
[PyDV]: errorbar <curve> <y-error-curve> <y+error-curve> [x-error-curve x+error-curve] [point-skip] Ex: [PyDV]: errorbar a 2 3 [PyDV]: errorbar a 2 3 4 5 [PyDV]: errorbar a 2 3 4 5 2
- do_errorrange(line)¶
Plot shaded error region on given curve. Note: y-error-curve and y+error-curve are curves and not scalars
[PyDV]: errorrange <curve> <y-error-curve> <y+error-curve> Ex: [PyDV]: errorrannge a b c
- do_eval(line)¶
Evaluate mathematical operations on curves.
[PyDV]: eval <curve-operations> Ex: [PyDV]: eval a+b
- do_exp(line)¶
Exponentiate y values of curves, e^y.
[PyDV]: exp <curve-list> Ex: [PyDV]: exp a [PyDV]: exp a:b [PyDV]: exp c d
- do_expx(line)¶
Exponentiate x values of curves, e^x.
[PyDV]: expx <curve-list> Ex: [PyDV]: expx a [PyDV]: expx a:b [PyDV]: expx c d
- do_fft(line)¶
Compute the one-dimensional discrete Fourier Transform for the curves.
[PyDV]: fft <curve-list> Ex: [PyDV]: fft a [PyDV]: fft a:b [PyDV]: fft c d
- do_filenamewidth(line)¶
Change the width of the fname column of the menu and list output. If no width is given, the current column width will be displayed.
[PyDV]: filenamewidth <integer> Ex: [PyDV]: filenamewidth [PyDV]: filenamewidth 100
- do_filter(line)¶
Filter out points in the x and y axis.
[PyDV]: filter <curve-list> <x-low-lim> <x-high-lim> <y-low-lim> <y-high-lim> Ex: [PyDV]: filter a 1 2 3 4 [PyDV]: filter a:b -3 0 -5 10 [PyDV]: filter c d 0 13 -7 15
- do_fit(line)¶
Make new curve that is polynomial fit to argument. n=1 by default, logy means take log(y-values) before fitting, logx means take log(x-values) before fitting.
[PyDV]: fit <curve> [n] [logx] [logy] Ex: [PyDV]: fit a [PyDV]: fit a 2 [PyDV]: fit a 2 logx [PyDV]: fit a 2 logy
- do_fontcolor(line)¶
Change the font color of given plot component.
[PyDV]: fontcolor [<component: xlabel | ylabel | title | xaxis | yaxis>] <color> Ex: [PyDV]: fontcolor xlabel blue [PyDV]: fontcolor ylabel blue [PyDV]: fontcolor title blue [PyDV]: fontcolor xaxis blue [PyDV]: fontcolor yaxis blue
- do_fontsize(line)¶
Change the font size of given component, or overall scaling factor.
[PyDV]: fontsize [<component: title | xlabel | ylabel | key | tick | curve | annotation>] <numerical-size | small | medium | large | default> Ex: [PyDV]: fontsize title 12 [PyDV]: fontsize xlabel small [PyDV]: fontsize ylabel medium [PyDV]: fontsize key large [PyDV]: fontsize tick default [PyDV]: fontsize curve 12 [PyDV]: fontsize annotation small
- do_fontstyle(line)¶
Set the fontstyle family.
[PyDV]: fontstyle <serif | sans-serif | monospace> Ex: [PyDV]: fontstyle serif [PyDV]: fontstyle sans-serif [PyDV]: fontstyle monospace
- do_gaussian(line)¶
Generate a gaussian function.
[PyDV]: gaussian <amplitude> <width> <center> [<# points> [<# half-widths>]] Ex: [PyDV]: gaussian 5 2 0 [PyDV]: gaussian 5 2 0 100 [PyDV]: gaussian 5 2 0 100 2
- do_geom(line)¶
- do_geometry(line)¶
Change the PyDV window size and location in pixels.
[PyDV]: geometry <xsize> <ysize> <xlocation> <ylocation> Ex: [PyDV]: geometry 500 500 250 250
- do_getattributes(line)¶
Return a curve’s attributes, such as: color, style, width, etc.
[PyDV]: getattributes <curve-list> Ex: [PyDV]: getattributes a [PyDV]: getattributes a:b [PyDV]: getattributes c d
- do_getdomain(line)¶
Return domain of curves.
[PyDV]: getdomain <curve-list> Ex: [PyDV]: getdomain a [PyDV]: getdomain a:b [PyDV]: getdomain c d
- do_getlabel(line)¶
Return the given curve’s label.
[PyDV]: getlabel <curve-list> Ex: [PyDV]: getlabel a [PyDV]: getlabel a:b [PyDV]: getlabel c d
- do_getnumpoints(line)¶
Display the number of points for the given curve.
[PyDV]: getnumpoints <curve-list> Ex: [PyDV]: getnumpoints a [PyDV]: getnumpoints a:b [PyDV]: getnumpoints c d
- do_getrange(line)¶
Return range of curves.
[PyDV]: getrange <curve-list> Ex: [PyDV]: getrange a [PyDV]: getrange a:b [PyDV]: getrange c d
- do_getx(line)¶
Return the x values for a given y.
[PyDV]: getx <curve-list> <y-value> Ex: [PyDV]: getx a 1.2 [PyDV]: getx a:b 1.2 [PyDV]: getx c d 1.2
- do_gety(line)¶
Return the y values for a given x.
[PyDV]: gety <curve-list> <x-value> Ex: [PyDV]: gety a 3.3 [PyDV]: gety a:b 3.3 [PyDV]: gety c d 3.3
- do_getymax(line)¶
Return xy-parings of the x values with the corresponding maximum y-value for the curve within the specified domain. If no domain is given, then the full domain range is used.
[PyDV]: getymax <curve> [<xmin> <xmax>] Ex: [PyDV]: getymax a [PyDV]: getymax a 2 7 [PyDV]: getymax a:b [PyDV]: getymax a:b 2 7 [PyDV]: getymax c d [PyDV]: getymax c d 2 7
- do_getymin(line)¶
Return xy-parings of the x values with the corresponding minimum y-value for the curve within the specified domain. If no domain is given, then the full domain range is used.
[PyDV]: getymin <curve> [<xmin> <xmax>] Ex: [PyDV]: getymin a [PyDV]: getymin a 2 7 [PyDV]: getymin a:b [PyDV]: getymin a:b 2 7 [PyDV]: getymin c d [PyDV]: getymin c d 2 7
- do_grid(line)¶
Show or hide the grid on the graph.
[PyDV]: grid <on | off> Ex: [PyDV]: grid on [PyDV]: grid off
- do_gridcolor(line)¶
Set the color of the grid. White is default.
[PyDV]: gridcolor <color> Ex: [PyDV]: gridcolor blue
- do_gridstyle(line)¶
Set the line style for the grid.
[PyDV]: gridstyle <style: solid | dash | dot | dashdot> Ex: [PyDV]: gridstyle solid [PyDV]: gridstyle dash [PyDV]: gridstyle dot [PyDV]: gridstyle dashdot
- do_gridwidth(line)¶
Set the grid line width in points.
[PyDV]: gridwidth <width> Ex: [PyDV]: gridwidth 5
- do_group(line)¶
Group curves based on name and file if curve names are the same. Max number of same name curves is 14. Can also update title to curve name and change labels to filenames if all curves share the same name. If title is passed, one can adjust the filename label with number of slashes as well. If off is passed, will reset curves back to normal and stop automatic grouping. Note: title also looks at hidden curves thus need to delete curves (e.g. del a).
[PyDV]: group <title <slashes #> > <off> Ex: [PyDV]: group [PyDV]: group title [PyDV]: group title slashes 2 [PyDV]: group off
- do_guilims(line)¶
Set whether or not to use the GUI min/max values for the X and Y limits. Default is off.
[PyDV]: guilims <on | off> Ex: [PyDV]: guilims on [PyDV]: guilims off
- do_handlelength(line)¶
Adjust the length of the line(s) in the legend.
[PyDV]: handlelength <length> Ex: [PyDV]: handlelength 10
- do_help(arg)¶
Return information about the specified command, variable, or command category. If no argument is supplied, return a list of available commands.
[PyDV]: help [command] Ex: [PyDV]: help list
- do_hide(line)¶
Hide a curve from the graph.
[PyDV]: hide <curve-list> Ex: [PyDV]: hide a [PyDV]: hide a:b [PyDV]: hide c d
- do_hypot(line)¶
Calculate harmonic average of two curves, sqrt(a^2+b^2).
[PyDV]: hypot <curve1> <curve2> Ex: [PyDV]: hypot a b
- do_image(line)¶
Save the current figure to an image file. All parameters are optional. The default value for filename=plot, the default value for filetype=pdf and the default value for transparent=False. dpi is the resolution in dots per inch and the default value is the figure’s dpi value. Width and height are in pixels.
[PyDV]: image [filename=plot] [filetype=pdf: png | ps | pdf | svg] [transparent=False: True | False] [dpi] [width] [height] Ex: [PyDV]: image my_plot png [PyDV]: image my_plot png True [PyDV]: image my_plot png True 100 [PyDV]: image my_plot png True 100 1920 1080
- do_int(line)¶
- do_integrate(line)¶
Compute the definite integral of each curve in the list over the specified domain.
[PyDV]: <integrate | int> <curve-list> [low-limit high-limit] Ex: [PyDV]: integrate a [PyDV]: integrate a:b [PyDV]: integrate c d [PyDV]: integrate c d 3 7
- do_j0(line)¶
Take the zeroth order Bessel function of y values of curves
[PyDV]: j0 <curve-list> Ex: [PyDV]: j0 a [PyDV]: j0 a:b [PyDV]: j0 c d
- do_j0x(line)¶
Take the zeroth order Bessel function of x values of curves
[PyDV]: j0x <curve-list> Ex: [PyDV]: j0x a [PyDV]: j0x a:b [PyDV]: j0x c d
- do_j1(line)¶
Take the first order Bessel function of y values of curves
[PyDV]: j1 <curve-list> Ex: [PyDV]: j1 a [PyDV]: j1 a:b [PyDV]: j1 c d
- do_j1x(line)¶
Take the first order Bessel function of x values of curves
[PyDV]: j1x <curve-list> Ex: [PyDV]: j1x a [PyDV]: j1x a:b [PyDV]: j1x c d
- do_jn(line)¶
Take the nth order Bessel function of y values of curves
[PyDV]: jn <curve-list> <n> Ex: [PyDV]: jn a 4 [PyDV]: jn a:b 4 [PyDV]: jn c d 4
- do_jnx(line)¶
Take the nth order Bessel function of x values of curves
[PyDV]: jnx <curve-list> <n> Ex: [PyDV]: jnx a 4 [PyDV]: jnx a:b 4 [PyDV]: jnx c d 4
- do_key(line)¶
- do_kill(line)¶
Delete the specified entries from the menu.
[PyDV]: kill [all | number-list] Ex: [PyDV]: kill all [PyDV]: kill 5:7
- do_label(line)¶
Change the key and list label for a curve. For multiple curves, each label must start with ` (this is the backtick character ` , not the single quote character ‘).
[PyDV]: label <curve> <new-label> Ex: [PyDV]: label a my_new_label [PyDV]: label a:b `my_new_label `my other label [PyDV]: label a:c `mynewlabel `my other label `my thirdlabel
- do_label_done = False¶
- do_labelcurve(line)¶
Add curve letter to the legend label.
[PyDV]: labelcurve <on | off> Ex: [PyDV]: labelcurve on [PyDV]: labelcurve off
- do_labelfilenames(line)¶
Add curve filename to the legend label.
[PyDV]: labelfilenames <on | off> Ex: [PyDV]: labelfilenames on [PyDV]: labelfilenames off
- do_labelrecordids(line)¶
Add curve recordid to the legend label. Command will only work with curves from Sina files with valid record ids.
[PyDV]: labelrecordids <on | off> Ex: [PyDV]: labelrecordids on [PyDV]: labelrecordids off
- do_latex(line)¶
Use LaTeX font rendering.
[PyDV]: latex <on | off> Ex: [PyDV]: latex on [PyDV]: latex off
- do_leg(line)¶
- do_legend(line)¶
Show/Hide the legend with on | off or set legend position with ur, ul, ll, lr, cl, cr, uc, lc. Specify the number of columns to use in the legend. Specify curves to add to or remove from the legend using the hide or show keywords followed by the ids of the curves. Commands after hide/show will not be processed, so make sure these are the last in the command list.
[PyDV]: <legend | leg | key> <on | off> [position] [<number of columns>] [<show/hide curve ids>] Ex: [PyDV]: legend on [PyDV]: legend on ul [PyDV]: legend on ul 2 [PyDV]: legend on ul 2 [PyDV]: legend on ul 2 showid a [PyDV]: legend on ul 2 showid a:b [PyDV]: legend on ul 2 showid c d [PyDV]: legend on ul 2 showid all [PyDV]: legend on ul 2 hideid a [PyDV]: legend on ul 2 hideid a:b [PyDV]: legend on ul 2 hideid c d [PyDV]: legend on ul 2 hideid all
- do_line(line)¶
Generate a line with y = mx + b and an optional number of points.
[PyDV]: line <m> <b> <xmin> <xmax> [# pts] Ex: [PyDV]: line 3 7 -1 20 [PyDV]: line 3 7 -1 20 200
- do_linemarker(line)¶
Set the marker symbol and marker size for the curves
Note
When setting this value through the interface or the curve object directly, use ONLY matplotlib supported marker types. Matplotlib marker types are also supported here as well. See matplotlib documentation on markers for further information.
[PyDV]: linemarker <curve-list> <marker-style: + | . | circle | square | diamond> [<marker-size>] Ex: [PyDV]: linemarker a + [PyDV]: linemarker a:b . [PyDV]: linemarker c d circle [PyDV]: linemarker c d square 5
- do_linespoints(line)¶
Show given curves as points and a line rather than continuous line.
[PyDV]: linespoints <curve-list> on | off Ex: [PyDV]: linespoints a on [PyDV]: linespoints a:b on [PyDV]: linespoints c d off
- do_list(line)¶
List the curves that are plotted. A regular expression may be supplied for matching against the curve label to be listed.
Regular expressions are based on the Python regex syntax, not the UNIX syntax. In particular, ‘*’ is not the wildcard you might be expecting.
For an explanation of the regex syntax, type ‘help regex’.
[PyDV]: <list | lst> <label-pattern> Ex: [PyDV]: list [PyDV]: list my.*curves
- do_listannot(line)¶
List current annotations.
[PyDV]: listannot
- do_listr(line)¶
List the curves that are plotted in the range from start to stop. If stop is not specified, it will be set to the end of the curve list.
[PyDV]: listr <start> [stop] Ex: [PyDV]: listr 1 [PyDV]: listr 1 10
- do_ln(line)¶
- do_lnstyle(line)¶
Set the line style of the specified curves.
[PyDV]: lnstyle <curve-list> <style: solid | dash | dot | dotdash> Ex: [PyDV]: lnstyle a solid [PyDV]: lnstyle a:b dash [PyDV]: lnstyle c d dot
- do_lnwidth(line)¶
Set the line widths of the specified curves. A line width of 0 will give the thinnest line which the host graphics system supports.
[PyDV]: lnwidth <curve-list> <width> Ex: [PyDV]: lnwidth a 2 [PyDV]: lnwidth a:b 2 [PyDV]: lnwidth c d 2
- do_lnx(line)¶
- do_log(line)¶
Take the natural logarithm of the y values of the curves. If the optional argument keep-neg-vals is set to false, then zero and negative y-values will be discarded. keep-neg-vals is true by default.
[PyDV]: <log | ln> <curve-list> [keep-neg-vals: True | False] Ex: [PyDV]: log a [PyDV]: log a:b [PyDV]: log c d [PyDV]: log c d True
- do_log10(line)¶
Take the base 10 logarithm of the y values of the curves. If the optional argument keep-neg-vals is set to false, then zero and negative y-values will be discarded. keep-neg-vals is true by default.
[PyDV]: log10 <curve-list> [keep-neg-vals: True | False] Ex: [PyDV]: log10 a [PyDV]: log10 a:b [PyDV]: log10 c d [PyDV]: log10 c d True
- do_log10x(line)¶
Take the base 10 logarithm of the x values of the curves. If the optional argument keep-neg-vals is set to false, then zero and negative y-values will be discarded. keep-neg-vals is true by default.
[PyDV]: log10x <curve-list> [keep-neg-vals: True | False] Ex: [PyDV]: log10x a [PyDV]: log10x a:b [PyDV]: log10x c d [PyDV]: log10x c d True
- do_logx(line)¶
Take the natural logarithm of the x values of the curves. If the optional argument keep-neg-vals is set to false, then zero and negative x-values will be discarded. keep-neg-vals is true by default.
[PyDV]: <logx | lnx> <curve-list> [keep-neg-vals: True | False] Ex: [PyDV]: logx a [PyDV]: logx a:b [PyDV]: logx c d [PyDV]: logx c d True
- do_lst(line)¶
- do_lstr(line)¶
- do_makecurve(line)¶
Generate a curve from two tuples of numbers.
[PyDV]: makecurve (<list of x-values>) (<list of y-values>) Ex: [PyDV]: makecurve (1 2 3) (20 30 40)
- do_makeextensive(line)¶
Set the y-values such that y[i] = y[i] * (x[i+1] - x[i]).
[PyDV]: <makeextensive | mkext> <curve-list> Ex: [PyDV]: makeextensive a [PyDV]: makeextensive a:b [PyDV]: makeextensive c d
- do_makeintensive(line)¶
Set the y-values such that y[i] = y[i] / (x[i+1] - x[i]).
[PyDV]: <makeintensive | mkint> <curve-list> Ex: [PyDV]: makeintensive a [PyDV]: makeintensive a:b [PyDV]: makeintensive c d
- do_marker(line)¶
Set the marker symbol and marker size (optionally) for scatter plots. You can also use any of the matplotlib supported marker types as well. See the matplotlib documentation on markers for further information.
[PyDV]: marker <curve-list> <marker-style: + | . | circle | square | diamond> [marker-size] Ex: [PyDV]: marker a + [PyDV]: marker a:b . [PyDV]: marker c d circle [PyDV]: marker c d 10
- do_markeredgecolor(line)¶
Set the markeredge color of curves. Color names can be “blue”, “red”, etc., or “#eb70aa”, a 6 digit set of hexadecimal red-green-blue values #RRGGBB. The entire set of HTML-standard color names is available. Type showcolormap to see the available named colors which will show up in the PyDV plotting area (hit return to go back to your plots).
[PyDV]: markeredgecolor <curve-list> <color-name> Ex: [PyDV]: markeredgecolor a blue [PyDV]: markeredgecolor a:b blue [PyDV]: markeredgecolor c d blue [PyDV]: markeredgecolor a #aabb33 [PyDV]: showcolormap hit return to go back to your plots [PyDV]: markeredgecolor a lime
- do_markerfacecolor(line)¶
Set the markerface color of curves. Color names can be “blue”, “red”, etc., or “#eb70aa”, a 6 digit set of hexadecimal red-green-blue values #RRGGBB. The entire set of HTML-standard color names is available. Type showcolormap to see the available named colors which will show up in the PyDV plotting area (hit return to go back to your plots).
[PyDV]: markerfacecolor <curve-list> <color-name> Ex: [PyDV]: markerfacecolor a blue [PyDV]: markerfacecolor a:b blue [PyDV]: markerfacecolor c d blue [PyDV]: markerfacecolor a #aabb33 [PyDV]: showcolormap hit return to go back to your plots [PyDV]: markerfacecolor a lime
- do_mathinterpparams(line)¶
Set numpy.interp() left, right, and period parameters for internal curve math methods for Curve such as + a b c, - a b c, etc…. Defaults are None which align with numpy.interp() defaults. To reset pass in none to <left> <right> <period>.
[PyDV]: mathinterpparams <curve-list> <left> <right> <period> Ex: [PyDV]: mathinterpparams a 0 0 none [PyDV]: mathinterpparams a:b 0 0 none [PyDV]: mathinterpparams c d none none none
- do_max(line)¶
Makes a new curve with max y values of curves passed in curvelist.
[PyDV]: max <curve-list> Ex: [PyDV]: max a [PyDV]: max a:b [PyDV]: max c d
List the curves available for plotting. A regular expression may be supplied for matching against the curve label to be listed.
Regular expressions are based on the Python regex syntax, not the UNIX syntax. In particular, ‘*’ is not the wildcard you might be expecting.
For an explanation of the regex syntax, type ‘help regex’.
[PyDV]: menu <label-pattern> Ex: [PyDV]: menu [PyDV]: menu my.*curves
Adjust the number of curves displayed when executing the menu command before Enter needs to be pressed. If no length is given, the current menu length will be displayed.
[PyDV]: menulength <integer> Ex: [PyDV]: menulength [PyDV]: menulength 100
List the curves available for plotting in the range from start to stop. If stop is not specified, it will be set to the end of the curve list.
[PyDV]: menur <start> [stop] Ex: [PyDV]: menur 1 [PyDV]: menur 1 10
- do_merge(line)¶
Merge ultra files together.
[PyDV]: merge <newfile> <myfile1> <myfile2> etc... Ex: [PyDV]: merge newfile.ult myfile1.ult myfile2.ult
- do_min(line)¶
Makes a new curve with min y values of curves passed in curvelist.
[PyDV]: min <curve-list> Ex: [PyDV]: min a [PyDV]: min a:b [PyDV]: min c d
- do_minorticks(line)¶
Minor ticks are not visible by default. On will make the minor ticks visible and off will hide the minor ticks.
[PyDV]: minorticks <on | off> Ex: [PyDV]: minorticks on [PyDV]: minorticks off
- do_mkext(line)¶
- do_mkint(line)¶
- do_movefront(line)¶
Move given curves to the front of the plot
[PyDV]: movefront <curve-list> Ex: [PyDV]: movefront a [PyDV]: movefront a:b [PyDV]: movefront c d
- do_mult(line)¶
- do_multiply(line)¶
Take the product of curves. If the optional value is specified it will multiply the y-values of the curves by value.
Note
Be sure that the x points are in increasing order as PyDV uses numpy.interp().
Note
Multiplying curves by a number modifies the curve. If you want to create a new curve then copy the original curve first using the copy command.
[PyDV]: <multiply | * | mult> <curve-list> [value] Ex: [PyDV]: multiply a [PyDV]: multiply a:b [PyDV]: multiply c d [PyDV]: multiply c d 7
- do_multiply_h(line)¶
Multiplies curves that have been read from a file but not yet plotted. list-of-menu-numbers are the index values displayed in the first column of the menu command.
[PyDV]: multiply_h <list-of-menu-numbers> Ex: [PyDV]: multiply_h 1 [PyDV]: multiply_h 1:2 [PyDV]: multiply_h 3 4
- do_mx(line)¶
Scale the x values of the curves by a fixed value.
[PyDV]: mx <curve-list> <value> Ex: [PyDV]: mx a 2 [PyDV]: mx a:b 2 [PyDV]: mx c d 2
- do_my(line)¶
Multiply the y values of curves by a constant.
[PyDV]: my <curve-list> <value> Ex: [PyDV]: my a 2 [PyDV]: my a:b 2 [PyDV]: my c d 2
- do_namewidth(line)¶
Change the width of the namewidth column of the menu and list output. If no width is given, the current column width will be displayed.
[PyDV]: namewidth <integer> Ex: [PyDV]: namewidth [PyDV]: namewidth 100
- do_nc(line)¶
- do_newcurve(line)¶
Creates a new curve from an expression containing curves that have the same domain. For convenience, the numpy and scipy module have been imported into the namespace. Shortcut: nc
The x-values will be the x-values of the last curve used in the expression due to how PyDV finds curves in a loop.
The y-values will be the evaluated expression after newcurve.
Note
If you want a more advanced expression or more control over what happens, see the command custom.
Warning
Currently, newcurve is hard-wired to only handle single-letter labels. Curve names used in the expression cannot be the @N type we use after we run out of letters. Sorry (April 2015).
A common error is to forget the .x or .y on the curve label name.
All the arrays in your expression have to span the same domain! Currently (4/2015), newcurve will generate a curve from different domains (but with the same number of points) with no error message, and that curve will almost certainly not be what you intended.
[PyDV]: newcurve <numpy and/or scipy expression> Ex: [PyDV]: newcurve scipy.ndimage.gaussian_filter(numpy.sin(a.x*2*numpy.pi)/(b.x**2), sigma=5)
- do_norm(line)¶
Makes a new curve that is the norm of two args. Also prints the value of the integral to command line. The p-norm is (integral( (curve1 - curve2)**p )**(1/p) over the interval [xmin, xmax], where p = order.
[PyDV]: norm <curve> <curve> <p> <xmin> <xmax> Ex: [PyDV]: norm a b 2 10 15
- do_normalize(line)¶
Normalize a curve.
[PyDV]: normalize <curve> Ex: [PyDV]: normalize a
- do_pl(line)¶
- do_plot(line)¶
Show or hide the line plots.
[PyDV]: plot <on | off> Ex: [PyDV]: plot on [PyDV]: plot off
- do_plotlayout(line)¶
Adjust the plot layout parameters. Where left is the position of the left edge of the plot as a fraction of the figure width, right is the position of the right edge of the plot, as a fraction of the figure width, top is the position of the top edge of the plot, as a fraction of the figure height and bottom is the position of the bottom edge of the plot, as a fraction of the figure height. Alternatively, de will revert to the default plot layout values.
If no arguments are given, the plot’s current layout settings will be displayed.
[PyDV]: plotlayout [<left> <right> <top> <bottom> || de] Ex: [PyDV]: plotlayout left [PyDV]: plotlayout right [PyDV]: plotlayout top [PyDV]: plotlayout bottom [PyDV]: plotlayout de
- do_pow(line)¶
- do_powa(line)¶
Raise a fixed value, a, to the power of the y values of the curves.
[PyDV]: powa <curve-list> <a> Ex: [PyDV]: powa a 2 [PyDV]: powa a:b 2 [PyDV]: powa c d 2
- do_powax(line)¶
Raise a fixed value, a, to the power of the x values of the curves.
[PyDV]: powax <curve-list> <a> Ex: [PyDV]: powax a 2 [PyDV]: powax a:b 2 [PyDV]: powax c d 2
- do_power(line)¶
- do_powerx(line)¶
- do_powr(line)¶
Raise the y values of the curves to a fixed power p.
[PyDV]: powr <curve-list> <p> Ex: [PyDV]: powr a 2 [PyDV]: powr a:b 2 [PyDV]: powr c d 2
- do_powrx(line)¶
Raise the x values of the curves to a fixed power p.
[PyDV]: powrx <curve-list> <p> Ex: [PyDV]: powrx a 2 [PyDV]: powrx a:b 2 [PyDV]: powrx c d 2
- do_powx(line)¶
- do_q(line)¶
- do_quit(line)¶
Quit PyDV.
[PyDV]: <quit | q> Ex: [PyDV]: q
- do_ran(line)¶
- do_random(line)¶
Generate random y values between -1 and 1 for the specified curves.
[PyDV]: random <curve-list> Ex: [PyDV]: random a [PyDV]: random a:b [PyDV]: random c d
- do_range(line)¶
Set the range for plotting. Using de (for default) will let the curves determine the range.
[PyDV]: <range | ran> <y-min> <y-max> | de Ex: [PyDV]: range 3 7 [PyDV]: range de
- do_rd(line)¶
- do_rdcsv(line)¶
- do_rdsina(line)¶
- do_read(line)¶
Read curves from the specified ASCII file and optionally filter by regex. The next available prefix (see the prefix command) is automatically assigned the menu index of the first curve in each data file read. For column oriented (.gnu) files optionally specify the x-column number before the file name.
[PyDV]: <read | rd> [(regex) matches] [x-col] <filename> Ex: [PyDV]: read my_file.ult [PyDV]: read my.*curves my_file.ult [PyDV]: read my.*curves 1 my_file.ult
- do_readcsv(line)¶
Read CSV data file. The next available prefix (see the prefix command) is automatically assigned the menu index of the first curve in each data file read. For column oriented (.gnu) files optionally specify the x-column number before the file name. If the columns are in x and y pairs with savecsv command, the [x-col] must be specified as paired.
[PyDV]: <readcsv | rdcsv> <filename.csv> [x-col] [paired] Ex: [PyDV]: readcsv my_file.csv [PyDV]: readcsv my_file.csv 2 [PyDV]: readcsv my_file.csv paired
- do_readsina(line)¶
Read all curves from Sina data file. PyDV assumes there is only one record in the Sina file, and if there are more than one then PyDV only reads the first. PyDV also assumes there is only one independent variable per curve_set; if there are more than one then PyDV may exhibit undefined behavior. The next available prefix (see the prefix command) is automatically assigned the menu index of the first curve in each data file read.
[PyDV]: <readsina | rdsina> <filename.json> Ex: [PyDV]: readsina my_file.json
- do_recip(line)¶
Take the reciprocal of the y values of the curves.
[PyDV]: recip <curve-list> Ex: [PyDV]: recip a [PyDV]: recip a:b [PyDV]: recip c d
- do_recipx(line)¶
Take the reciprocal of the x values of the curves.
[PyDV]: recipx <curve-list> Ex: [PyDV]: recipx a [PyDV]: recipx a:b [PyDV]: recipx c d
- do_recolor(line)¶
Reset the color of the line plots.
[PyDV]: recolor
- do_recordidwidth(line)¶
Change the width of the record_id column of the menu and list output. If no width is given, the current column width will be displayed.
[PyDV]: recordidwidth <integer> Ex: [PyDV]: recordidwidth [PyDV]: recordidwidth 100
- do_redo(line)¶
Redo the last undo curve operation.
[PyDV]: redo
- do_reid(line)¶
Relabel all the curves into continuous alphabetical order.
[PyDV]: reid
- do_rev(line)¶
Swap x and y values for the specified curves. You may want to sort after this one.
[PyDV]: rev <curve-list> Ex: [PyDV]: rev a [PyDV]: rev a:b [PyDV]: rev c d
- do_run(line)¶
Execute a list of commands from a file.
[PyDV]: run <filename> Ex: [PyDV]: run my_file
- do_save(line)¶
Saves plotted curves to a file in ULTRA format. Can also save x and y labels which can be read back in.
[PyDV]: save <filename> <curve-list> [savelabels] Ex: [PyDV]: save my_saved_file.ult a [PyDV]: save my_saved_file.ult b d [PyDV]: save my_saved_file.ult b:d [PyDV]: save my_saved_file.ult b:d savelabels
- do_savecsv(line)¶
Saves plotted curves to file in comma separated values (CSV) format. Assumes all curves have the same x basis.
[PyDV]: savecsv <filename> <curve-list> Ex: [PyDV]: savecsv my_saved_file.csv b [PyDV]: savecsv my_saved_file.csv b d [PyDV]: savecsv my_saved_file.csv b:d
- do_scatter(line)¶
Show given curves as points rather than continuous line.
[PyDV]: scatter <curve-list> <on | off> Ex: [PyDV]: scatter a on [PyDV]: scatter a:b on [PyDV]: scatter c d off
- do_setxcolumn(line)¶
Set x column for reading column formatted data files (.gnu or .csv).
[PyDV]: setxcolumn <x column> Ex: [PyDV]: setxcolumn 1
- do_shell(line)¶
Execute shell commands.
[PyDV]: <shell | system | !> <command> Ex: [PyDV]: shell echo $PATH
- do_show(line)¶
Show the specified curves hidden by the hide command
[PyDV]: show <curve-list> Ex: [PyDV]: show a [PyDV]: show a:b [PyDV]: show c d
- do_showcolormap(line)¶
Show the available named colors. Hit return to go back to your plots.
[PyDV]: showcolormap
- do_showstyles(line)¶
Show available matplotlib styles.
[PyDV]: showstyles
- do_sin(line)¶
Take the sine of the y values of the curve.
[PyDV]: sin <curve-list> Ex: [PyDV]: sin a [PyDV]: sin a:b [PyDV]: sin c d
- do_sinh(line)¶
Take the hyperbolic sine of the y values of the curve
[PyDV]: sinh <curve-list> Ex: [PyDV]: sinh a [PyDV]: sinh a:b [PyDV]: sinh c d
- do_sinhx(line)¶
Take the hyperbolic sine of the x values of the curve
[PyDV]: sinhx <curve-list> Ex: [PyDV]: sinhx a [PyDV]: sinhx a:b [PyDV]: sinhx c d
- do_sinx(line)¶
Take the sine of the x values of the curve.
[PyDV]: sinx <curve-list> Ex: [PyDV]: sinx a [PyDV]: sinx a:b [PyDV]: sinx c d
- do_smooth(line)¶
Smooth the curve to the given degree.
[PyDV]: smooth <curve-list> [smooth-factor] Ex: [PyDV]: sin a [PyDV]: sin a:b [PyDV]: sin c d [PyDV]: sin c d 4
- do_sort(line)¶
Sort the specified curves so that their points are plotted in order of ascending x values.
[PyDV]: sort <curve-list> Ex: [PyDV]: sort a [PyDV]: sort a:b [PyDV]: sort c d
- do_span(line)¶
Generates straight line of slope 1 and y intercept 0 in the specified domain with an optional number of points.
[PyDV]: span <xmin> <xmax> [points] Ex: [PyDV]: span 1 10 [PyDV]: span 1 10 200
- do_sqr(line)¶
Take the square of the y values of the curves.
[PyDV]: sqr <curve-list> Ex: [PyDV]: sqr a [PyDV]: sqr a:b [PyDV]: sqr c d
- do_sqrt(line)¶
Take the square root of the y values of the curves.
[PyDV]: sqrt <curve-list> Ex: [PyDV]: sqrt a [PyDV]: sqrt a:b [PyDV]: sqrt c d
- do_sqrtx(line)¶
Take the square root of the x values of the curves.
[PyDV]: sqrtx <curve-list> Ex: [PyDV]: sqrtx a [PyDV]: sqrtx a:b [PyDV]: sqrtx c d
- do_sqrx(line)¶
Take the square of the x values of the curves.
[PyDV]: sqrx <curve-list> Ex: [PyDV]: sqrx a [PyDV]: sqrx a:b [PyDV]: sqrx c d
- do_square(line)¶
- do_squarex(line)¶
- do_stats(line)¶
Show various statistics about the curve.
[PyDV]: stats <curve-list> Ex: [PyDV]: stats a [PyDV]: stats a:b [PyDV]: stats c d
- do_style(line)¶
Use matplotlib style settings from a style specification. The style name of default (if available) is reserved for reverting back to the default style settings. You can type the command showstyles and see Matplotlib’s Style sheets reference.
[PyDV]: style <style-name> Ex: [PyDV]: style classic
- do_sub(line)¶
- do_subsample(line)¶
Subsample the curves by the optional stride. Default value for stride is 2.
[PyDV]: subsample <curve-list> [stride] Ex: [PyDV]: subsample a 3 [PyDV]: subsample a:b 3 [PyDV]: subsample c d 3
- do_subtract(line)¶
Take the difference of curves. A single curve can be specified, resulting in the negating of its y-values. If the optional value is specified it will subtract the y-values of the curves by value.
Note
Be sure that the x points are in increasing order as PyDV uses numpy.interp().
Note
Subtracting curves by a number modifies the curve. If you want to create a new curve then copy the original curve first using the copy command.
[PyDV]: <subtract | sub | --> <curve-list> [value] Ex: [PyDV]: subtract a [PyDV]: subtract a:b [PyDV]: subtract c d [PyDV]: subtract c d 7
- do_subtract_h(line)¶
Subtracts curves that have been read from a file but not yet plotted. list-of-menu-numbers are the index values displayed in the first column of the menu command.
[PyDV]: subtract_h <list-of-menu-numbers> Ex: [PyDV]: subtract_h 1 [PyDV]: subtract_h 1:2 [PyDV]: subtract_h 3 4
- do_sum(line)¶
Calculate the sum of the x and y values of the curves.
[PyDV]: sum <curve-list> Ex: [PyDV]: sum a [PyDV]: sum a:b [PyDV]: sum c d
- do_system(line)¶
- do_tan(line)¶
Take the tangent of y values of curves.
[PyDV]: tan <curve-list> Ex: [PyDV]: tan a [PyDV]: tan a:b [PyDV]: tan c d
- do_tanh(line)¶
Take the hyperbolic tangent of y values of curves
[PyDV]: tanh <curve-list> Ex: [PyDV]: tanh a [PyDV]: tanh a:b [PyDV]: tanh c d
- do_tanhx(line)¶
Take the hyperbolic tangent of x values of curves
[PyDV]: tanhx <curve-list> Ex: [PyDV]: tanhx a [PyDV]: tanhx a:b [PyDV]: tanhx c d
- do_tanx(line)¶
Take the tangent of x values of curves.
[PyDV]: tanx <curve-list> Ex: [PyDV]: tanx a [PyDV]: tanx a:b [PyDV]: tanx c d
- do_theta(line)¶
Generate a unit step distribution.
[PyDV]: theta <xmin> <x0> <xmax> [# points] Ex: [PyDV]: theta -5 0 5 [PyDV]: theta -3 3 5 200
- do_ticks(line)¶
Set the maximum number of major ticks on the axes.
[PyDV]: ticks <quantity> | de Ex: [PyDV]: ticks 3 [PyDV]: ticks de
- do_tightlayout(line)¶
Turn on plot tight layout. Useful if tick labels are long.
[PyDV]: tightlayout <on | off> Ex: [PyDV]: tightlayout on
- do_title(line)¶
Set a title for the plot
[PyDV]: title <title-name> Ex: [PyDV]: title my_title
- do_undo(line)¶
Undo the last operation on plotted curves.
[PyDV]: undo
- do_update(line)¶
Update the plot after each command if True. Update the plot is ON by default.
[PyDV]: update on | off Ex: [PyDV]: update on [PyDV]: update off
- do_vs(line)¶
Plot the range of the first curve against the range of the second curve.
[PyDV]: vs <curve1> <curve2> Ex: [PyDV]: vs a b
- do_xindex(line)¶
Create curves with y-values vs. integer index values.
[PyDV]: xindex <curve-list> Ex: [PyDV]: xindex a [PyDV]: xindex a:b [PyDV]: xindex c d
- do_xlabel(line)¶
Set a label for the x axis
[PyDV]: xlabel <label-name> Ex: [PyDV]: xlabel my_x_label
- do_xlabelwidth(line)¶
Change the width of the xlabel column of the menu and list output. If no width is given, the current column width will be displayed.
[PyDV]: xlabelwidth <integer> Ex: [PyDV]: xlabelwidth [PyDV]: xlabelwidth 100
- do_xlogscale(line)¶
Show the x axis on a log scale.
[PyDV]: <xlogscale | xls> <on | off> Ex: [PyDV]: xlogscale on [PyDV]: xlogscale off
- do_xls(line)¶
- do_xmax(line)¶
Filter out points in curves whose x-values greater than limit.
[PyDV]: xmax <curve-list> <limit> Ex: [PyDV]: xmax a 3 [PyDV]: xmax a:b 3 [PyDV]: xmax c d 3
- do_xmin(line)¶
Filter out points in curves whose x-values less than limit
[PyDV]: xmin <curve-list> <limit> Ex: [PyDV]: xmin a 3 [PyDV]: xmin a:b 3 [PyDV]: xmin c d 3
- do_xminmax(line)¶
Filter out points; this is the only filter points function that returns a new curve due to how ULTRA behaved.
[PyDV]: <xminmax | xmm> <curve-list> <low-lim> <high-lim> Ex: [PyDV]: xminmax a 1 3 [PyDV]: xminmax a:b 1 3 [PyDV]: xminmax c d 1 3
- do_xmm(line)¶
- do_xtickcolor(line)¶
Set the color of the ticks on the x-axis. Default is to apply to major ticks only.
[PyDV]: xtickcolor <de | color> [which: major | minor | both] Ex: [PyDV]: xtickcolor blue major [PyDV]: xtickcolor blue minor [PyDV]: xtickcolor blue both [PyDV]: xtickcolor de both
- do_xtickformat(line)¶
Set the format of major ticks on the x axis. Default is plain.
[PyDV]: xtickformat <plain | sci | exp | 10**> Ex: [PyDV]: xtickformat plain [PyDV]: xtickformat sci [PyDV]: xtickformat exp [PyDV]: xtickformat 10**
- do_xtickha(line)¶
Set the horizontal alignment of tick labels on the x axis. Default is center.
[PyDV]: xtickha <center | right | left> Ex: [PyDV]: xtickha right
- do_xticklength(line)¶
Set the length (in points) of x ticks on the axis. Default is apply to major ticks only.
[PyDV]: xticklength <number> [which: major | minor | both] Ex: [PyDV]: xticklength 2 major [PyDV]: xticklength 2 minor [PyDV]: xticklength 2 both
- do_xtickrotation(line)¶
Set the rotation (in degrees) of the tick labels on the x axis.
[PyDV]: xtickrotation <degree> Ex: [PyDV]: xtickrotation 45
- do_xticks(line)¶
Set the locations of major ticks on the x-axis
[PyDV]: xticks de | <number> | <list of locations> | <list of locations, list of labels> Ex: [PyDV]: xticks 3 [PyDV]: xticks (1, 2, 3) [PyDV]: xticks (1, 2, 3), ('first label', 'second label', 'third label') [PyDV]: xticks de
- do_xtickva(line)¶
Set the vertical alignment of tick labels on the x axis. Default is top.
[PyDV]: xtickva <center | top | bottom> Ex: [PyDV]: xtickva center
- do_xtickwidth(line)¶
Set the width (in points) of x ticks on the x axis. Default is to apply to major ticks only.
[PyDV]: xtickwidth <number> [which: major | minor | both] Ex: [PyDV]: xtickwidth 2 major [PyDV]: xtickwidth 2 minor [PyDV]: xtickwidth 2 both
- do_y0(line)¶
Take the zeroth order Bessel function of the second kind of the y values of the curves.
[PyDV]: y0 <curve-list> Ex: [PyDV]: y0 a [PyDV]: y0 a:b [PyDV]: y0 c d
- do_y0x(line)¶
Take the zeroth order Bessel function of the second kind of the x values of the curves.
[PyDV]: y0x <curve-list> Ex: [PyDV]: y0x a [PyDV]: y0x a:b [PyDV]: y0x c d
- do_y1(line)¶
Take the first order Bessel function of the second kind of the y values of the curves.
[PyDV]: y1 <curve-list> Ex: [PyDV]: y1 a [PyDV]: y1 a:b [PyDV]: y1 c d
- do_y1x(line)¶
Take the first order Bessel function of the second kind of the x values of the curves.
[PyDV]: y1x <curve-list> Ex: [PyDV]: y1x a [PyDV]: y1x a:b [PyDV]: y1x c d
- do_ylabel(line)¶
Set a label for the y axis.
[PyDV]: ylabel <label-name> Ex: [PyDV]: ylabel my_y_label
- do_ylabelwidth(line)¶
Change the width of the ylabel column of the menu and list output. If no width is given, the current column width will be displayed.
[PyDV]: ylabelwidth <integer> Ex: [PyDV]: ylabelwidth [PyDV]: ylabelwidth 100
- do_ylogscale(line)¶
Set log scale on or off for the y-axis.
[PyDV]: <ylogscale | yls> <on | off> Ex: [PyDV]: ylogscale on [PyDV]: ylogscale off
- do_yls(line)¶
- do_ymax(line)¶
Filter out points in curves whose y-values greater than limit
[PyDV]: ymax <curve-list> <limit> Ex: [PyDV]: ymax a 3 [PyDV]: ymax a:b 3 [PyDV]: ymax c d 3
- do_ymin(line)¶
Filter out points in curves whose y-values less than limit
[PyDV]: ymin <curve-list> <limit> Ex: [PyDV]: ymin a 3 [PyDV]: ymin a:b 3 [PyDV]: ymin c d 3
- do_yminmax(line)¶
Trim the selected curves.
[PyDV]: <yminmax | ymm> <curve-list> <low-limit> <high-lim> Ex: [PyDV]: yminmax a 3 7 [PyDV]: yminmax a:b 3 7 [PyDV]: yminmax c d 3 7
- do_ymm(line)¶
- do_yn(line)¶
Take the nth order Bessel function of the second kind of y values of curves.
[PyDV]: yn <curve-list> <n> Ex: [PyDV]: yn a 3 [PyDV]: yn a:b 3 [PyDV]: yn c d 3
- do_ynx(line)¶
Take the nth order Bessel function of the second kind of x values of curves.
[PyDV]: ynx <curve-list> <n> Ex: [PyDV]: ynx a 3 [PyDV]: ynx a:b 3 [PyDV]: ynx c d 3
- do_ytickcolor(line)¶
Set the color of the ticks on the y-axis. Default is to apply to major ticks only.
[PyDV]: ytickcolor <de | color> [which: major | minor | both] Ex: [PyDV]: ytickcolor blue major [PyDV]: ytickcolor blue minor [PyDV]: ytickcolor blue both [PyDV]: ytickcolor de both
- do_ytickformat(line)¶
Set the format of major ticks on the y axis. Default is plain.
[PyDV]: ytickformat <plain | sci | exp | 10**> Ex: [PyDV]: ytickformat plain [PyDV]: ytickformat sci [PyDV]: ytickformat exp [PyDV]: ytickformat 10**
- do_ytickha(line)¶
Set the horizontal alignment of tick labels on the y axis. Default is right.
[PyDV]: ytickha <center | right | left> Ex: [PyDV]: ytickha center
- do_yticklength(line)¶
Set the length (in points) of y ticks on the y axis. Default is to apply to major ticks only.
[PyDV]: yticklength <number> [which: major | minor | both] Ex: [PyDV]: yticklength 2 major [PyDV]: yticklength 2 minor [PyDV]: yticklength 2 both
- do_ytickrotation(line)¶
Set the rotation (in degrees) of the tick labels on the y axis.
[PyDV]: ytickrotation <degree> Ex: [PyDV]: ytickrotation 45
- do_yticks(line)¶
Set the locations of major ticks on the y axis.
[PyDV]: yticks de | <number> | <list of locations> | <list of locations, list of labels> Ex: [PyDV]: yticks 3 [PyDV]: yticks (1, 2, 3) [PyDV]: yticks (1, 2, 3), ('first label', 'second label', 'third label') [PyDV]: yticks de
- do_ytickva(line)¶
Set the vertical alignment of tick labels on the y axis. Default is center.
[PyDV]: ytickva <center | top | bottom> Ex: [PyDV]: ytickva top
- do_ytickwidth(line)¶
Set the width (in points) of y ticks on the y axis. Default is to apply to major ticks only.
[PyDV]: ytickwidth <number> [which: major | minor | both] Ex: [PyDV]: ytickwidth 2 major [PyDV]: ytickwidth 2 minor [PyDV]: ytickwidth 2 both
- emptyline()¶
Override cmd empty line function to not repeat last command
- figcolor = None¶
- filelist = []¶
- filename = ''¶
- filename_set_from_curve = True¶
- filenamewidth = 30¶
- find_xrange()¶
Find the proper x-range
- find_yrange()¶
Find the proper y-range
- func_curve(line, flag, do_x=0, arg=0)¶
Operate on given curves by a function
- geometry = 'de'¶
- getclosest(array, value)¶
Find closest value in numpy array
- getcurvename()¶
Find the next available curve name for the plot
- gridcolor = 'white'¶
- gridstyle = 'solid'¶
- gridwidth = 1.0¶
- group = 0¶
- guilims = False¶
- handlelength = None¶
- help_regex()¶
- history = []¶
- histptr = -1¶
- initrun = None¶
- key_loc = 1¶
- key_ncol = 1¶
- keycolor = 'black'¶
- keyfont = 'small'¶
- linewidth = None¶
- load(fname, gnu=False, pattern=None, matches=None)¶
Load an ultra file and add parsed curves to the curvelist
- load_csv(fname, col)¶
Load a csv (commas separated values) text data file, add parsed curves to the curvelist
- load_sina(fname)¶
Load a Sina JSON data file, add parsed curves to the curvelist
- loadrc()¶
Read in a resource definition file
- main()¶
- modcurve(line, flag, arg)¶
Operate on given curves by constant value depending on given operation flag
- namewidth = 40¶
- oldlist = []¶
- plotcolor = None¶
- plotedit = False¶
- plotfirst = []¶
- plotlist = []¶
- plotter = None¶
- postcmd(stop, line)¶
Save current state for undo/redo
- precmd(line)¶
Check for special character/operator commands
- prompt = '[PyDV]: '¶
- record_id = ''¶
- record_id_set_from_curve = True¶
- recordidwidth = 10¶
- redraw = True¶
- reset_xticks_labels()¶
Reset xtick labels whenever there is a new curve added/hidden/deleted
- ruler = '='¶
- set_filename(filename, from_curve=False)¶
- set_record_id(record_id, from_curve=False)¶
- set_title(title, from_curve=False)¶
- set_xlabel(label, from_curve=False)¶
- set_ylabel(label, from_curve=False)¶
- showaxis = 'on'¶
- showcurveinlegend = False¶
- showfilenameinlegend = False¶
- showgrid = True¶
- showkey = True¶
- showletters = True¶
- showminorticks = False¶
- showplot = 'on'¶
- showrecordidinlegend = False¶
- slashes = 100¶
- tickFormat(axis, logscale, ticks, tickformat)¶
- tightlayout = 0¶
- title = ''¶
- title_set_from_curve = True¶
- titlecolor = None¶
- titlefont = 'large'¶
- undoc_header = 'Command Shortcuts:'¶
- update = True¶
- property updateplot¶
Iterates through plotlist and displays curves on graph
- updatestyle = False¶
- usertexts = []¶
- xCol = 0¶
- xlabel = ''¶
- xlabel_set_from_curve = True¶
- xlabelcolor = None¶
- xlabelfont = 'medium'¶
- xlabelstyle = 'normal'¶
- xlabelweight = 'normal'¶
- xlabelwidth = 10¶
- xlim = None¶
- xlogscale = False¶
- xmajortickcolor = 'black'¶
- xminortickcolor = 'black'¶
- xminorticklength = 2¶
- xminortickwidth = 0.5¶
- xtick_labels = {}¶
- xtickcolor = None¶
- xtickformat = 'de'¶
- xtickha = 'center'¶
- xticklength = 4¶
- xtickrotation = 0¶
- xticks = 'de'¶
- xtickva = 'top'¶
- xtickwidth = 1¶
- ylabel = ''¶
- ylabel_set_from_curve = True¶
- ylabelcolor = None¶
- ylabelfont = 'medium'¶
- ylabelstyle = 'normal'¶
- ylabelweight = 'normal'¶
- ylabelwidth = 10¶
- ylim = None¶
- ylogscale = False¶
- ymajortickcolor = 'black'¶
- yminortickcolor = 'black'¶
- yminorticklength = 2¶
- yminortickwidth = 0.5¶
- ytickcolor = None¶
- ytickformat = 'de'¶
- ytickha = 'right'¶
- yticklength = 4¶
- ytickrotation = 0¶
- yticks = 'de'¶
- ytickva = 'center'¶
- ytickwidth = 1¶
- class pydv.pdv.LogEnum(value)¶
Bases:
EnumAn enumeration.
- LOG = 1¶
- LOG10 = 3¶
- LOG10X = 4¶
- LOGX = 2¶
- pydv.pdv.main()¶
pdvplot module¶
- class pydv.pdvplot.Plotter(pydvcmd)¶
Bases:
QMainWindow- canvas = None¶
- closeEvent(self, a0: QCloseEvent | None)¶
- defaultPlotLayout = None¶
- fig = None¶
- figcolor = 'white'¶
- plotChanged = False¶
- showCurvelistDialog()¶
Shows a dialog with the output of the list command in a table.
- showMenuDialog()¶
Shows a dialog with the output of the menu command in a table.
- style = 'ggplot'¶
- updateDialogs()¶
Updates the list and menu dialogs if visible.
- updatePlotGeometry(geometry='de')¶
Updates the size and location of the window. Using an action to trigger the update to ensure that the resizing is happening on the main GUI thread.
pdvutil module¶
- exception pydv.pdvutil.CurveIndexError¶
Bases:
ValueError
- pydv.pdvutil.getCurveIndex(plotname, plotlist)¶
Returns integer index to curve in plotlist from plotname
- pydv.pdvutil.get_actual_index(origref, val)¶
- pydv.pdvutil.getletterargs(line)¶
Get a full list of arguments from compact list or mixed notation (ex a:d)
- pydv.pdvutil.getnumberargs(line, filelist)¶
Get a full list of arguments from compact list or mixed notation (ex 4:11)
- pydv.pdvutil.parsemath(line, plotlist, commander, xdomain)¶
Parses and calculates mathematical input for curves, then updates plot
- pydv.pdvutil.print_own_docstring(self)¶
Prints the docstring of the calling method.
- pydv.pdvutil.truncate(string, size, justify='left')¶
Truncate a string to given length