Coder Social home page Coder Social logo

pydv's Introduction

PyDV

A 1D graphics and data analysis tool, heavily based on the ULTRA plotting tool.

PyDV Importable Interface Module

You can now call most of PyDV's functionality from within a Python script. Below is an example of how to do this.

    import sys
    sys.path.append("/usr/gapps/pydv/current")
    import pydvpy as pydvif

    curves = list()
    curves.append(pydvif.span(1,10,6))
    pydvif.save('myFile.txt', curves)

Documentation

PyDV Users Manual Documentation Status

License

PyDV is distributed under the terms of the BSD-3 License

All new contributions must be made under the BSD-3 License

See LICENSE for details.

LLNL-CODE-507071

pydv's People

Contributors

darylgrunau avatar dependabot[bot] avatar griffin28 avatar obitorasu avatar rusu24edward avatar sbeljurf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pydv's Issues

Add guilims option in the .pdvrc file

Hi Kevin,

I was wondering if you have considered keeping the current view fixed when new curves are added to a plot. Would this be difficult to do?

An example is I have plotted curve A, and have zoomed in using the magnifier tool to a certain region of the plot. Now, I want to see what curve B looks like in the current view. If I plot curve B, the range/domain is completely reset.

I’m not sure if anyone has strong feelings about the current behavior. I feel that it’s easy to issue “ran de” and “dom de” commands to reset the view (or maybe there’s a single command), but it’s more tedious to get back to the same view you had before you plotted the additional curves.

Thanks,
Eric

Allow multiple labels to be deleted at once

Request from Mike Lambert:

Allow multiple labels in the legend to be deleted in a more efficient way. Currently you have to delete one label at a time and for situations where you have a lot of labels in the legend this can be very time consuming.

table-curve command

Procedure: Build a curve from data in the current table. Tables are regarded simply as contiguous blocks of numbers and you may specify how the x and y values are to be gathered from the table. Tables are read row-wise and the offsets are reckoned accordingly. The number of points must be specified. The zero based offset from the beginning of the table and the stride to be used in gathering the values may be given. The default offset and stride for the y values are zero and one, respectively. If no offset for the x values is specified, the y values are plotted versus index.
Usage: table-curve num-points [y-offset [y-stride [x-offset [x-stride]]]]

fill command not implemented

Procedure: Fill the area under curves with the specified color.
Usage: fill curve-list color-number
Default: off

Support a curve with a single value

Request from Scott McKinley:

...if you could support a curve of a single value. It seems overkill, but sometimes we get plots that may vary in length and it would be nice if a single point plot were an option.

Allow control of grid color, style, and size

Hi Kevin,

In Windows my figure border and grid lines are white. I was hoping you can make them black. It would be nice to vary the thickness of the borderline and grid lines as well. Using a “dotted” linestyle for the grid lines would be nice as well.

Thanks!
Chester Eng

piece-wise constant integration bug

Hi Kevin,

when you are plotting point-wise data in pdv and do an integral, I'm
guessing it is calculating the exact area under the line segments using
the trapezoid rule.

when we are plotting piece-wise constant data (histogram data), pdv
should calculate the exact area under it using piece-wise constant
integration instead of interpreting the data as point-wise data.

here is a test file----------

pointwise
0 0
1 1
2 2

histogram
0 1
1 2
2


If I open the file, then do

cur 1 2

int a b

the integral of the pointwise data looks correct, but the integral of
the histogram looks wrong.

the integral of a histogram should become pointwise linear data.

the area of the pointwise data is 2, pdv got it right!

the area of the histogram data is 3, pdv got 2.5

Can you please fix this?

Thanks.

-Matt

Create getymax/getymin commands

Create a command getymax/getymin that gets the max or min y-value over a specified domain (e.g. getymax A 0.1 4.2)

Usage: getymax
getymin

Requested by: Eric Shi

jn and jnx commands need updating

jn command needs to remove the argument before sending to the func_curve method.
jnx needs to update help method.
(see 3.0 version)

Persist UI zoom settings

From Mike Owen:

One thing I’ve noticed recently though – if I move the legend to a new position on the plot (with “key ”), it resets the view – is that intended? In other words if I’ve zoomed in on an interesting region and then want to move the legend, the plot resets to the original unzoomed view.

read-table command not implemented

Macro: Read the nth table that begins at or after the indicated line in the specified ASCII disk file. Display the mth line of text before the table if m > 0 or display the |m|th line of text after the table if m < 0.
Usage: read-table file-name [n [m [line]]]

History file collisions

History file (.pdvhistory) collisions with multiple pydv applications running.

  • Append pid to history file?

Throw away negative values when taking the log

Requested by Eric Shi:

Can you take a look at throwing away the negative values when taking a log? That is, curve produced by the log operation on another curve will not have x values if the original curve had a negative value at that particular x value.

Automatically label the horizontal/vertical plot axes

From Matt O'Brien:

Is there a way for PyDV to automatically label the horizontal and vertical axes of a plot by extracting the information from the curve label or we could add additional meta-data to the curve header to automate this. Basically I would like to have "presentation quality" plots with as little "human intervention" as possible.

Make convolve command like ULTRA

Get the convolution commands to work like ULTRA. There appears to be some major differences between the ULTRA and numpy's implementation.

rev command not implemented

Procedure: Swap x and y values for the specified curves. You may want to sort after this one.
Usage: rev curve-list

Add minor ticks to PyDV

Kevin,

 Is there any control over minor ticks in pdv?  Specifically, I am making a plot that has major ticks/labels on the x axis every five units, i.e. 0, 5, 10, …  Pdv is not adding any minor ticks on the x axis by default.  I would like the minor ticks to be every one unit, i.e. 1, 2, 3, etc.

 Is there a way to do that?

Thanks,
Patrick Brantley

Set border sizes via command

Kevin

One of the features of PyDV that I like is the publication quality plots it produces. The fact that you can use the guilims to crop a plot to just the right size is great. However, it would be useful to be able to set the border sizes via a command (a la the subplot function in MatPlotLib) instead of messing with the GUI. Does this feature exist? Thanks again. Ciao…

Upgrade to cmd2

The latest documentation for cmd2 can be read online here: https://cmd2.readthedocs.io/
Main features:
Searchable command history (history command and +r)
Text file scripting of your application with load (@) and _relative_load (@@)
Python scripting of your application with pyscript
Run shell commands with !
Pipe command output to shell commands with |
Redirect command output to file with >, >>; input from file with <
Bare >, >> with no filename send output to paste buffer (clipboard)
py enters interactive Python console (opt-in ipy for IPython console)
Multi-line commands
Special-character command shortcuts (beyond cmd’s ? and !)
Settable environment parameters
Parsing commands with arguments using argparse, including support for sub-commands
Unicode character support (Python 3 only)
Good tab-completion of commands, sub-commands, file system paths, and shell commands
Python 2.7 and 3.4+ support
Linux, macOS and Windows support
Trivial to provide built-in help for all commands
Built-in regression testing framework for your applications (transcript-based testing)
Transcripts for use with built-in regression can be automatically generated from history -t
Usable without modification anywhere cmd is used; simply import cmd2.Cmd in place of cmd.Cmd.

sort command not implemented

Procedure: Sort the specified curves so that their points are plotted in order of ascending x values.
Usage: sort curve-list

Implement convolb command

Procedure: Compute the convolution of the two curves, i.e.
This slower method uses direct integration and minimal interpolations. The curve-g is normalized to unit area before doing the convolution.
Usage: convolb curve-f curve-g

Add command the turns plot border on/off

Add command that turns plot border on/off. Probably good to also allow the color and size of the border to be changed too. Related to #24

ax.spines['bottom'].set_color('0.5')
ax.spines['top'].set_color(None)
ax.spines['right'].set_color('0.5')
ax.spines['left'].set_color(None)
ax.patch.set_facecolor('0.1')
plt.grid(b=True, which='major', color='0.2', linestyle='-')
plt.grid(b=True, which='minor', color='0.2', linestyle='-')
ax.tick_params(axis='x', colors='0.7', which='both')
ax.tick_params(axis='y', colors='0.7', which='both')
ax.yaxis.label.set_color('0.9')
ax.xaxis.label.set_color('0.9')
ax.margins(0.5)
fig.patch.set_facecolor('0.15')

Command history improvements

From Tom Brunner:

Command history: If you could say “history” and see a list of your history, that could be cool. It might be interesting to say “saveHistory [m:n] filename.” to save a set of commands to a named file.

The upgrade to cmd2 will resolve this (see #37 )

fit command bug

Here is a simple demonstration that tries to fit a quadratic:

key ul

straight line

span .1 1

quadratic

newcurve a.y*a.y

label b quadratic we want to fit

try to fit b - should get slope = 2 intercept = 0

fit b 1 logx logy

color c black
lnstyle c dash

ran de

If I use the old version /usr/gapps/pdv/bin/pdv, the correct new curve gets plotted, and PDV gets the correct values:

[PDV]: fit b 1 logx logy
fitting curve: b 1 logx logy
slope = 2.0 intercept = 8.88178419700125e-17

If I use /usr/gapps/pydv/pdv, I get an error message about nans:

[PyDV]: fit b 1 logx logy
fitting curve: b 1 logx logy
/usr/gapps/pydv/2.4.2.1/pydvpy.py:3115: RuntimeWarning: invalid value encountered in log10
y = np.log10(x)
slope = nan intercept = nan

Thanks,

        Nick

Look at accelerating numerically-focused methods with Numba.

Numba is a just-in-time, type-specializing, function compiler for accelerating numerically-focused Python. That's a long list, so let's break down those terms:

  • function compiler: Numba compiles Python functions, not entire applications, and not parts of functions. Numba does not replace your Python interpreter, but is just another Python module that can turn a function into a (usually) faster function.

  • type-specializing: Numba speeds up your function by generating a specialized implementation for the specific data types you are using. Python functions are designed to operate on generic data types, which makes them very flexible, but also very slow. In practice, you only will call a function with a small number of argument types, so Numba will generate a fast implementation for each set of types.

  • just-in-time: Numba translates functions when they are first called. This ensures the compiler knows what argument types you will be using. This also allows Numba to be used interactively in a Jupyter notebook just as easily as a traditional application

  • numerically-focused: Currently, Numba is focused on numerical data types, like int, float, and complex. There is very limited string processing support, and many string use cases are not going to work well on the GPU. To get best results with Numba, you will likely be using NumPy arrays.

Create a mechanism to display the available objects when in interactive Python mode

Allowing the user to display the list of available PyDV objects will make it easier to create custom "PyDV Macros" like below (courtesy of Rob Managan):

[PyDV]: cur a.4 b.4
[PyDV]: drop
Starting Python Console...
Ctrl-D to return to PyDV
Python 2.7.10 (default, May 26 2015, 14:17:46)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> def testFunc(line):
... print " this is a test, here is rest of line '", line, "'"
...
>>> self.do_test = testFunc
>>>
Python Data Visualizer 2.3 - 11.20.2017
Type "help" for more information.
[PyDV]: test hhh rest of input line jjj
this is a test, here is rest of line ' hhh rest of input line jjj '
[PyDV]:

histogram command not implemented

Procedure: Plot the specified curves as histograms. left, right, and center determine how to obtain the central bin values for the histograms.
Usage: histogram curve-list off | left | right | center

set-id command

Procedure: Change the data-id of the specified curve.
Usage: set-id curve a | b | ... | z

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.