Skip to main content

Minimal Python implementation of the LOFAR ParameterSet

Project description

LOFAR Python ParameterSet

Build status Test coverage

Overview

This package contains a pure-python drop-in replacement for the python wrapper around the original LOFAR ParameterSet that is written in C++. It supports only the basic features of the original.

The following, more fancy, features are not supported:

  • Vector expansion, e.g., foo=['bar'*4] and foo=[1..5]
  • Most value interpretations, including booleans
  • Multi-line values
  • String escaping beyond either " or ' in the string
  • Modellng of ParameterValue as a separate class
  • Case-insensitivity
  • Tracking unused keys

Installation

Installation can be done in a number of ways. In order of preference (read: ease of use):

  1. Install the latest release from PyPI:

    pip install lofar-parameterset
    
  2. Install directly from the Git repository. This option is useful if you want to use one or more features that have not yet been released:

    pip install --upgrade pip
    pip install git+https://git.astron.nl/lofar2.0/lofar_pyparameterset.git[@<branch|tag|hash>]
    

    If the optional @<branch|tag|hash> is omitted, HEAD of the master branch will used.

  3. Clone the git repository, and install from your working copy. This option is mostly used by developers who want to make local changes:

    pip install --upgrade pip
    git clone https://git.astron.nl/lofar2.0/lofar_pyparameterset.git
    cd lofar_pyparameterset
    git checkout [<branch|tag|hash>]  #optionally
    pip install .
    

Usage

Here is a example of how one could read attenuation settings from a parset file:

from lofar_parameterset.parameterset import parameterset
with open("settings.parset") as f:
    parset = parameterset(parameterset.fromString(f.read()))
attenuations = parset.getDoubleVector("attenuations")

Development

Development environment

To setup and activte the develop environment run source ./setup.sh from within the source directory.

If PyCharm is used, this only needs to be done once. Afterward the Python virtual env can be setup within PyCharm.

Contributing

To contribute, please create a feature branch and a "Draft" merge request. Upon completion, the merge request should be marked as ready and a reviewer should be assigned.

Verify your changes locally and be sure to add tests. Verifying local changes is done through tox.

pip install tox

With tox the same jobs as run on the CI/CD pipeline can be ran. These include unit tests and linting.

tox

To automatically apply most suggested linting changes execute:

tox -e format

The configuration for linting and tox can be found in pyproject.toml

License and copyright

This project is licensed under the GNU General Public License v3.0 or later.

Copyright © 2024 - 2025, ASTRON (Netherlands Institute for Radio Astronomy)

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

lofar_parameterset-0.0.4.tar.gz (28.0 kB view details)

Uploaded Source

Built Distribution

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

lofar_parameterset-0.0.4-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file lofar_parameterset-0.0.4.tar.gz.

File metadata

  • Download URL: lofar_parameterset-0.0.4.tar.gz
  • Upload date:
  • Size: 28.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lofar_parameterset-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9730f498346de35584878c95f805158b8d73a99a2f5e445ba67458db80381be4
MD5 5965fd431e8510bafd50f544e2bb45c7
BLAKE2b-256 091c201429f2d6faf43385765b3a704f22782db603db5b7db89b946931b3066d

See more details on using hashes here.

File details

Details for the file lofar_parameterset-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for lofar_parameterset-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 579558ee8d8fe64232023d1ee5bae009d7f1dd425393ee9413f8fcb4aca90717
MD5 277d60a0726879165eb48dd68e45c890
BLAKE2b-256 9193f0f0ab8cf0a40fbe713f49a315aa85e642879ca96910eeed8f6bc82f1815

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