Skip to main content

The plotID toolkit supports researchers in tracking and storing relevant data in plots. Plots are labelled with an ID and the corresponding data is stored.

Project description

plotID for Python

The plotID logo

This is the python plotID project.
plotID is a program connected to Research Data Management (RDM). It has two main functionalities:

  1. Tag your plot with an identifier.
  2. Export the resulting file to a specified directory along the corresponding research data, the plot is based on. Additionally, the script that created the plot will also be copied to the directory.

Note: To run plotID python version ≥ 3.10 is required.

Installation

Currently there are two options to run plotID. Either install it via pip from the Python Package Index (PyPi) or install plotID from the source code.
Installation is the same for Windows and Unix systems, except for the optional first set of setting up a virtual environment.

  1. [Optional] Create a virtual environment and activate it:
pip install venv
mkdir venv
python3 -m venv venv

source venv/bin/activate  # Unix
venv\Scripts\activate.bat # Windows Command Prompt
venv\Scripts\Activate.ps1 # Windows PowerShell

From PyPi with pip

  1. Install plotID
    pip install plotid
    If you also want to run the unittests use plotid[test] instead of plotid.

From source

  1. Download the source code from Gitlab:
    git clone https://git.rwth-aachen.de/plotid/plotid_python.git
    cd plotid_python
  2. Install dependencies
    pip install -r requirements.txt
  3. Install plotID
    pip install .

Usage

plotID has two main functionalities:

  1. Tag your plot with an identifier.
  2. Export the resulting file to a specified directory along the corresponding research data, the plot is based on. Additionally, the script that created the plot will also be copied to the directory.

tagplot()

Tag your figure/plot with an ID. It is possible to tag multiple figures at once.
tagplot(figures, plot_engine)
The variable "figures" can be a single figure or a list of multiple figures.
The argument "plot_engine" defines which plot engine was used to create the figures. It also determines which plot engine plotID uses to place the ID on the plot. Currently supported plot engines are:

  • matplotlib, which processes figures created by matplotlib.
  • image, which processes pictures files with common extensions (jpg, png, etc.).

tagplot returns a PlotIDTransfer object that contains the tagged figures and the corresponding IDs as strings.

Optional parameters can be used to customize the tag process.

  • figure_ids: list of str, optional IDs that will be printed on the plot. If empty, IDs will be generated for each plot. If this option is used, an ID for each plot has to be specified. Default: [].
  • prefix : str, optional Will be added as prefix to the ID.
  • id_method : str, optional id_method for creating the ID. Create an ID by Unix time is referenced as "time", create a random ID with id_method="random". The default is "time".
  • location : string, optional Location for ID to be displayed on the plot. Default is "east".
  • qrcode : boolean, optional Experimental support for encoding the ID in a QR Code.
  • id_on_plot : boolean, optional Print ID on the plot. Default: True.

Example:

FIG1 = plt.figure()  
FIG2 = plt.figure()   
FIGS_AS_LIST = [FIG1, FIG2]  
FIGS_AND_IDS = tagplot(FIGS_AS_LIST, "matplotlib", prefix="XY23_", id_method="random", location="west")

publish()

Save plot, data and measuring script. Modules that are imported in the script which calls plotID are exported to the file "required_imports.txt". These can later be installed via pip with the command pip install -r /path/to/required_imports.txt. It is possible to export multiple figures at once. publish(figs_and_ids, src_datapath, dst_path)

  • figs_and_ids must be a PlotIDTransfer object. Therefore, it can be directly passed from tagplot() to publish().
  • src_datapath specifies the path to (raw) data that should be published. It can be a string or a list of strings that specifies all files and directories which will be published.
  • dst_path is the path to the destination directory, where all the data should be copied/exported to.
  • plot_names will be the file names for the exported plots. If you give only one plot name but several figures, plotID will name the exported plots with an appended number, e.g. example_fig1.png, example_fig2.png, ...

Optional parameters can be used to customize the publish process.

  • data_storage: str, optional
    Method how the data should be stored. Available options:
    • centralized: The raw data will copied only once. All other plots will reference this data via sym link.
    • individual: The complete raw data will be copied to a folder for every plot, respectively.
  • plot_names : str or list of str, optional Name for the exported plot. If not provided, the corresponding IDs will be used. Example: publish(figs_and_ids, "/home/user/Documents/research_data", "/home/user/Documents/exported_data", plot_names=["EnergyOverTime-Plot", "TimeOverEnergy-Plot")

Build

If you want to build plotID yourself, follow these steps:

  1. Download the source code from Gitlab:
    git clone https://git.rwth-aachen.de/plotid/plotid_python.git
    cd plotid_python
  2. [Optional] Create a virtual environment (see Installation).
  3. [Optional] Run unittests and coverage:
    python3 tests/runner_tests.py
  4. Build the package python3 -m build

Contributing

Contributions to plotID are very welcome. If you encounter any issues with plotID please report them in our issue tracker. Code contributions via merge request are also highly appreciated. Please have a look at CONTRIBUTING first.

To install all optional dependencies use pip install .[test,docs] or pip install plotid[test,docs] respectively.

Documentation

If you have more questions about plotID, please have a look at the documentation.
Also have a look at the examples that are shipped with plotID.

Acknowledgements

This software is being developed at the Chair of Fluid Systems (FST), TU Darmstadt within the project NFDI4Ing.

The authors would like to thank the Federal Government and the Heads of Government of the Länder, as well as the Joint Science Conference (GWK), for their funding and support within the framework of the NFDI4Ing consortium. Funded by the German Research Foundation (DFG) - project number 442146713.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plotID-0.3.1.tar.gz (186.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plotID-0.3.1-py3-none-any.whl (192.1 kB view details)

Uploaded Python 3

File details

Details for the file plotID-0.3.1.tar.gz.

File metadata

  • Download URL: plotID-0.3.1.tar.gz
  • Upload date:
  • Size: 186.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for plotID-0.3.1.tar.gz
Algorithm Hash digest
SHA256 c76c72bf902bae7ce7c8a7c58e993adb27b9a80f96b064a271df2d2e9248cb75
MD5 98c725c43be31602489f1d59e7f9c879
BLAKE2b-256 1275470696cb310c9c180be3aa05d38b0f51ed5b377906ab8328e2f088ecfd64

See more details on using hashes here.

File details

Details for the file plotID-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: plotID-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 192.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for plotID-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae21e75323be52fd3c1a0736eec42ca2f291be7fd7581f5c270f94f2cd101e74
MD5 3897a03e8b30c184f390eadc8e627ce8
BLAKE2b-256 e5f062957514468d791f1664f94356de8f54b58d00f9e5b16242f729b8f23542

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page