Skip to main content

LISA Python Constants provides values sanctioned by the LISA Consortium for physical constants and mission parameters.

Project description

LISA Constants

LISA Constants is a Python package providing values sanctioned by the LISA Consortium for physical constants and mission parameters. LISA Constants is intended to be consistently used by other pieces of software related to the simulation of the instrument, of gravitational wave signals, and others.

We provide support for Python projects (as a package), C projects (as a header file), and C++ projects (as a header file). See below how to use the package.

The list of available constants for the latest release is available at https://lisa-simulation.pages.in2p3.fr/constants.

Usage

Install the latest version of lisaconstants using pip,

pip install git+https://gitlab.in2p3.fr/lisa-simulation/constants.git

or a given version using

pip install git+https://gitlab.in2p3.fr/lisa-simulation/constants.git@v1.1

This will automatically generate the C/C++ header files, and install them in your include directory.

Python

Simply import lisaconstants to access the constants,

from lisaconstants import c
light_minute = 60 * c
travel_time = 2.5E8 / c

C

Include lisaconstants.h (automatically placed in your current Python installation's include directory). Constants are prefixed with "LISA_" to prevent name collisions.

#include "venv/include/lisaconstants.h"
double lightMinute = 60 * LISA_c;
double travelTime = 2.5E8 / LISA_c;

C++

Include lisaconstants.hpp (automatically placed in your current Python installation's include directory). Constants are defined in the LisaConstants namespace to prevent name collisions.

#include "venv/include/lisaconstants.h"
double lightMinute = 60 * LisaConstants::c;
double travelTime = 2.5E8 / LisaConstants::c;

Add LISA Constants to your project

As a setup.py requirement

If your project is built as a Python package, we strongly recommend to add lisaconstants as a dependency in your setup.py file.

setup(
  name='mypackage',
  # ...
  install_requires=[
    'lisaconstants'
  ],
)

As a pip requirement

Add lisaconstants to requirement.txt, which can be checked in on your repository,

# add in requirements.tzt
git+https://gitlab.in2p3.fr/lisa-simulation/constants.git@v1.1#egg=lisaconstants

Users will be able to install your dependencies using

pip install -r requirements.txt

Silence static linter warnings

LISA Constants dynamically generates the constants when the module is imported. Static linters (syntax analyzers), such as Pylint, do not import the module and therefore incorrectly issue warnings for each constant imported from LISA Constants. To silence these warnings, create a file ".pylintrc" if it does not exist, and add the following commands

[TYPECHECK]

ignored-modules=lisaconstants

Contributing

Report an issue

We use the issue-tracking management system associated with the project provided by Gitlab. If you want to report a bug or request a feature, open an issue at https://gitlab.in2p3.fr/lisa-simulation/constants/-/issues. You may also thumb-up or comment on existing issues.

Development environment

We strongly recommend to use Python virtual environments.

To setup the development environment, use the following commands:

git clone git@gitlab.in2p3.fr:lisa-simulation/constants.git
cd python-constants
python -m venv .
source ./bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

Workflow

The project's development workflow is based on the issue-tracking system provided by Gitlab, as well as peer-reviewed merge requests. This ensures high-quality standards.

Issues are solved by creating branches and opening merge requests. Only the assignee of the related issue and merge request can push commits on the branch. Once all the changes have been pushed, the "draft" specifier on the merge request is removed, and the merge request is assigned to a reviewer. He can push new changes to the branch, or request changes to the original author by re-assigning the merge request to them. When the merge request is accepted, the branch is merged onto master, deleted, and the associated issue is closed.

Pylint and unittest

We enforce PEP 8 (Style Guide for Python Code) with Pylint syntax checking, and correction of the code using the pytest] testing framework. Both are implemented in the continuous integration system.

You can run them locally

pylint **/*.py
python -m pytest

Contact

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

lisaconstants-1.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

lisaconstants-1.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file lisaconstants-1.1.tar.gz.

File metadata

  • Download URL: lisaconstants-1.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for lisaconstants-1.1.tar.gz
Algorithm Hash digest
SHA256 5110d6a810920a854745841c330ede14e2228ac51edd5918d5d5f1c2f88cb89b
MD5 4dc77e57ff8a54a7c43fb080b112a7d1
BLAKE2b-256 deb2f58f58557343b99c676d8b21b941853caac29e939aac6eec1cdb220214a7

See more details on using hashes here.

File details

Details for the file lisaconstants-1.1-py3-none-any.whl.

File metadata

  • Download URL: lisaconstants-1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for lisaconstants-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7fef3e07c96524b1c10b817d31259c89c8353f627711b393530b4d7a588d343
MD5 91bb2804a345d829d79f662db425f1f5
BLAKE2b-256 f7af7d2d5c89d53d522276ce474c217c6751375a9badeef62f436ca6bdadf50a

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