ebranlard / pyDatView

A crossplatform GUI to plot tabulated data from files (e.g. CSV, Excel, OpenFAST, HAWC2, Flex...), or python pandas dataframes
MIT License
107 stars 41 forks source link

Build status Donate just a small amount, buy me a coffee

pyDatView

A crossplatform GUI to display tabulated data from files or python pandas dataframes. It's compatible Windows, Linux and MacOS, with python 3. Some of its features are: multiples plots, FFT plots, probability plots, export of figures... The file formats supported, are: CSV files and other formats present in the weio library. Additional file formats can easily be added.

Scatter

QuickStart

For Windows users, an installer executable is available here (look for the latest pyDatView*.exe)

Linux users can use the command lines below, but first they'll need to install the package python-wxgtk* (e.g. python-gtk3.0) from their distribution:

git clone https://github.com/ebranlard/pyDatView
cd pyDatView
python -m pip install --user -r requirements.txt
make                                            # will run python pyDatView.py
echo "alias pydat='make -C `pwd`'" >> ~/.bashrc

MacOS users can use a brew, anaconda or virtualenv version of python and pip, but the final version of python that calls the script needs to have access to the screen (for instance using pythonw) (see details for MacOS). We recommend using conda, in the base environment, for which the following commands should work:

conda install -c conda-forge wxpython            # install wxpython
git clone https://github.com/ebranlard/pyDatView -b dev
cd pyDatView
python -m pip install --user -r requirements.txt
make                         # will run ./pythonmac pyDatView.py 
# OR try
#pythonw pyDatView.py        # NOTE: using pythonw not python
echo "alias pydat='make -C `pwd`'" >> ~/.bashrc   # add an alias for quicklaunch

If this fails using the Mac terminal, try the zsh terminal from VSCode or iterm2. More information about the download, requirements and installation is provided further down this page

Usage

Launching the GUI

Windows users that used a setup.exe file should be able to look for pyDatView in the Windows menu, then launch it, and pin the program to the taskbar for easier access.

If you cloned this repository, the main script at the root (pyDatView.py) is executable and will open the GUI directly. A command line interface is provided, e.g.:

python pyDatView.py file.csv  # or pythonw pyDatView.py file.csv

The python package can also be used directly from python/jupyter to display one or multiple dataframe(s) (called df1 and df2 in the example below) or show the data present in one or several file(s). The interface is forgiving for the first argument, and can accept a list or a single value:

import pydatview 
pydatview.show(dataframes=[df1,df2], names=['data1','data2'])
# OR
pydatview.show([df1,df2], names=['data1','data2'])
# OR
pydatview.show(df1)
# OR
pydatview.show(filenames=['file.csv','file2.csv'])
# OR
pydatview.show(['file.csv','file2.csv'])
# OR
pydatview.show('file.csv')

Quicklaunch/Shortcut

Windows

Linux

You can add an alias to your bashrc as follows. Navigate to the root of the pyDatView repository, and type:

    echo "alias pydat='python `pwd`/pyDatView.py'" >> ~/.bashrc

Next time you open a terminal, you can type pydat to launch pyDatView. Adapt to another terminal like .shrc

MacOS

The procedure is the same as for linux, the small issue is that you need to find the "proper" python to call. When you run ./pythonmac from the root of the directory, the script tries to find the right version for you and finishes by showing a line of the form: [INFO] Using: /PATH/TO/PYTHON. This line gives you the path to python. Add pydat as an alias by running the line below (after adapting the PATH/TO/PYTHON):

    echo "alias pydat='PATH/TO/PYTHON  `pwd`/pyDatView.py'" >> ~/.zshrc

Next time you open a terminal, you can type pydat to launch pyDatView.

File association

Windows

To associate a given file type with pyDatView, follow the following steps:

  1. Locate pyDatView.exe. If you installed using setup.exe or the portable zip, you'll find pyDatView.exe at the root of the installation folder (default is C:\Users\%USERNAME%\AppData\Local\pyDatView\). If you cannot find the exe, download it from the repository. If you cloned the repository, you'll find the executable in the subfolder _tools\ of the repository.

  2. Verify that the exe works. Double click on the executable to verify that it lauches pyDatView. If it doesnt, run it from a terminal and look at the outputs.

  3. Add the file association. Right click on a file you want to associate pyDatView with. Select "Open With" > "More Apps" > scroll to "Look for another App on my PC" > Navigate to the location of pyDatView.exe mentioned above. If this works, repeat the operation and check the box "Always use this App for his filetype".

Workflow

Documentation is scarce for now, but here are some tips for using the program:

Features

Main features:

Different kind of plots:

Plot options:

Data manipulation options:

Screenshots

Scatter plot (by selecting Scatter) and several plots on the same figure:

Scatter

Fast Fourier Transform of the signals (by selecting FFT) and displaying several plots using subfigures (by selecting Subplot).

SubPlotFFT

Probability density function:

PlotPDF

Scaling all plots between 0 and 1 (by selecting MinMax) PlotMinMax

Installation

Windows installation

For Windows users, installer executables are available here (look for the latest pyDatView*.exe)

Linux installation

The script is compatible with python 3 and relies on the following python packages: numpy matplotlib, pandas, wxpython. To download the code and install the dependencies (with pip) run the following:

git clone https://github.com/ebranlard/pyDatView
cd pyDatView
python -m pip install --user -r requirements.txt

If the installation of wxpython fails, you may need to install the package python-wxgtk* (e.g. python-gtk3.0) from your distribution. For Debian/Ubuntu systems, try: sudo apt-get install python-wxgtk3.0. For further troubleshooting you can check the wxPython wiki page.

If the requirements are successfully installed you can run pyDatView by typing:

python pyDatView.py  # or pythonw pyDatView.py 

To easily access it later, you can add an alias to your .bashrc or install the pydatview module:

echo "alias pydat='python `pwd`/pyDatview.py'" >> ~/.bashrc
# or
python setup.py install

MacOS installation

The installation should work with python3, with brew (with or without a virtualenv) or anaconda. First, download the source code:

git clone https://github.com/ebranlard/pyDatView
cd pyDatView

Before installing the requirements, you need to be aware of the two following issues with MacOS:

Different solutions are provided below depending on your preferred way of working. For the latest Mac version, we recommend using anaconda.

Anaconda-python version (outside a virtualenv)

The installation of anaconda sometimes replaces the system python with the anaconda version of python. You can see that by typing which python. Use the following:

python -m pip install --user -r requirements.txt # install requirements
conda install -c conda-forge wxpython            # install wxpython
pythonw pyDatView.py                             # NOTE: using pythonw not python

If the pythonw command above fails, try the few next options, and post an issue. You can try the ./pythonmac provided in this repository

./pythonmac pyDatView.py

If that still doesn't work, you can try using the python.app from anaconda:

/anaconda3/bin/python.app

where /anaconda3/bin/ is the path that would be returned by the command which conda. Note the .app at the end. If you don't have python.app, try installing it with conda install -c anaconda python.app

Note also that several users have been struggling to run pyDatView on the mac Terminal in new macOS systems. If you encounter the same issues, we recommend using the integrated zsh terminal from VSCode or using a more advanced terminal like iterm2 and perform the installation steps there. Also, make sure to stick to the base anaconda environment.

Brew-python version (outside of a virtualenv)

If you have brew installed, and you installed python with brew install python, then the easiest is to use your python3 version:

python3 -m pip install --user -r requirements.txt
python3 pyDatView.py

Brew-python version (inside a virtualenv)

If you are inside a virtualenv, with python 3, use:

pip install -r requirements.txt
./pythonmac pyDatView.py

If the pythonmac commands fails, contact the developer, and in the meantime try to replace it with something like:

$(brew --prefix)/Cellar/python/XXXXX/Frameworks/python.framework/Versions/XXXX/bin/pythonXXX

where the result from brew --prefix is usually /usr/loca/ and the XXX above corresponds to the version of python you are using in your virtual environment.

Note also that several users have been struggling to run pyDatView on the mac Terminal in new macOS systems. If you encounter the same issues, we recommend using the integrated zsh terminal from VSCode or using a more advanced terminal like iterm2 and perform the installation steps there. Also, make sure to stick to the base anaconda environment.

Easy access

To easily access the program later, you can add an alias to your .bashrc or install the pydatview module:

echo "alias pydat='python `pwd`/pyDatview.py'" >> ~/.bashrc
# or
python setup.py install

Adding more file formats

File formats can be added by implementing a subclass of pydatview/io/File.py, for instance pydatview/io/VTKFile.py. Existing examples are found in the folder pydatview/io. Once implemented the fileformat needs to be registered in pydatview/io/__init__.py by adding an import line at the beginning of this script and adding a line in the function fileFormats() of the form formats.append(FileFormat(VTKFile))

If you believe your fileformat will be beneficial to the wind energy community, we recommend to also add your file format to the weio repository. Follow the procedure mentioned in the README of the weio repository (in particualr adding unit tests and minimalistic example files).

Contributing

Any contributions to this project are welcome! If you find this project useful, you can also buy me a coffee (donate a small amount) with the link below:

Donate just a small amount, buy me a coffee

Donate just a small amount, buy me a coffee