Skip to main content

A simple tool for serializing scientific diagram to (FAIR) data.

Project description

Overview

[[TOC]]

Installation

Currently, Plot Serializer can only be installed from a local repository.

To install it, first clone this repository to a directory of your choice by navigating to the directory and executing

git clone git@git.rwth-aachen.de:fst-tuda/projects/rdm/plot-serializer.git

Activate the pip environment into which you would like to install Plot Serializer. If you need to create a new pip environment, follow the section Creating virtual environment below.

With the pip environment activated, install Plot Serializer using pip, giving the path to the cloned repository:

pip install path/to/directory/plot-serializer

Documentation

View Plot Serializer's documentation on Read the Docs

Contributing

Clone this repository with

git clone git@git.rwth-aachen.de:fst-tuda/projects/rdm/plot-serializer.git

Creating the virtual environment

On Windows, run

py -m venv env

The second argument is the location to create the virtual environment. Generally, you can just create this in your project and call it env.

venv will create a virtual Python installation in the env folder.

Before you can start installing or using packages in your virtual environment you’ll need to activate it. Activating a virtual environment will put the virtual environment-specific python and pip executables into your shell’s PATH.

.\env\Scripts\activate

You can confirm you’re in the virtual environment by checking the location of your Python interpreter:

where python

Tell pip to install all of the packages in the requirements.txt file using the -r flag:

py -m pip install -r requirements.txt

Update the requirements.txt file when you install new packages.

For more detailed instructions, check https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/.

Linting

This project uses the flake8 linter and the black autoformatter.

Documentation

Documentation is an essential part of writing code.

:warning: All public functions, methods, classes and modules must be properly documented with docstrings.

This project uses google-style docstrings. An example for a good docstring:

def find_largest_distance(point, polygon):
    """Finds the largest distance between a point and the edges of a polygon.

    Args:
        point (shapely.geometry.Point): shapely point object
        polygon (shapely.geometry.Polygon): shapely polygon object

    Returns:
        float: the largest distance between a point and the edges of a polygon
    """
    distance_list = np.array([])
    for poly_point in list(zip(*polygon.exterior.coords.xy)):
        distance = point.distance(Point(poly_point))
        distance_list = np.append(distance_list, distance)
    max_distance = max(distance_list)
    return max_distance

because:

  • short and easy to understand description
  • starts with a verb in third person
  • type of the args are given
  • args and returns are described sufficiently

Where necessary, add additional information using comments.

Naming Convention

Follow Guido's recommendations (taken from Google Python Styleguide):

Type Public Internal
Packages lower_with_under
Modules lower_with_under _lower_with_under
Classes CapWords _CapWords
Exceptions CapWords
Functions lower_with_under() _lower_with_under()
Global/Class Constants CAPS_WITH_UNDER _CAPS_WITH_UNDER
Global/Class Variables lower_with_under _lower_with_under
Instance Variables lower_with_under _lower_with_under (protected)
Method Names lower_with_under() _lower_with_under() (protected)
Function/Method Parameters lower_with_under
Local Variables lower_with_under

For better readability, use meaningful, expressive names instead of hard-to-understand short names. Don’t drop letters from your source code. Although dropped letters in names like memcpy (memory copy) and strcmp (string compare) were popular in the C programming language before the 1990s, they’re an unreadable style of naming that you shouldn’t use today. If a name isn’t easily pronounceable, it isn’t easily understood.

Additionally, feel free to use short phrases that can make your code read like plain English. For example, number_of_trials is more readable than simply number_trials.

More on naming.

Use a spell checker.

Code Structure

The maximum line length is 120 characters.

Whitespaces should be automatically deleted; the autoformatter should take care of this.

Improve readability by limiting the number of nested statements.

Preferrably write short functions, and pure functions that can be tested.

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

plot_serializer-0.2.0.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

plot_serializer-0.2.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file plot_serializer-0.2.0.tar.gz.

File metadata

  • Download URL: plot_serializer-0.2.0.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for plot_serializer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3ba06893d69d60b834e3257a252468cc30e1aa48be136aac9bea6425c530d9db
MD5 910fdc963541329ce66489c1d195a54d
BLAKE2b-256 a5eef165851b2be8a923a83ea116d095986c85c623057ebdd3e4338472f0c9fb

See more details on using hashes here.

File details

Details for the file plot_serializer-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for plot_serializer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd564d8e27776ec97fa1b1e5ed527e1a2f6c7c5efd32540ab743471123aab8a3
MD5 2da8fc83d2706fe3944f89e091cdbea3
BLAKE2b-256 6b6aa799c3d3ec7b9b4a765e4a4b64f3adc2d86d6d442e928a5a0e002f8af2f2

See more details on using hashes here.

Supported by

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