About maser-tools
maser-tools is part of the MASER Python libraries, with maser4py, maser-data and maser-plot. It offers programs to support radio data format (e.g., CDF) and time (e.g. leap seconds and time conversion handling):
-
maser.tools.cdf.serializer: conversions between master binary CDF (.cdf), skeleton table (.skt) and Excel (.xlsx) files, as follows:Excel (.xlsx) <--> binary CDF (.cdf) <--> skeleton table (.skt) -
maser.tools.cdf.cdfcompare: comparison of two CDF files -
maser.tools.cdf.validator: validation of a CDF file against a model (e.g. ISTP) -
maser.tools.time: leap seconds and time conversions (UTC, TT2000, Julian days)
Read main documentation for details.
Installation
To install the package, run the following command:
pip install maser-tools
or, with uv:
uv add maser-tools # in a uv project
uv tool install maser-tools # to only use the maser-tools command
Requirements
- Python 3.10 or later
- The CDF files are read and written with spacepy.pycdf, which relies on the NASA CDF library (see spacepy installation if it is not found).
- The conversions between binary CDF and skeleton table call the
skeletoncdfandskeletontableprograms of the NASA CDF software. They are searched in the$CDF_BINdirectory, then in the$PATH.
Usage
Command line interface
The programs can be run from a terminal with the maser-tools command
(or python -m maser.tools):
maser-tools --help
maser-tools skeletoncdf --help
Available sub-commands are:
| Sub-command | Description |
|---|---|
skeletoncdf |
Convert skeleton table (.skt) or Excel (.xlsx) files into binary CDF |
skeletontable |
Convert binary CDF files into skeleton tables (and Excel files) |
leapsec |
Leap seconds handling tool |
cdf_compare |
Compare two CDF files |
cdf_validator |
Validate a CDF file |
For instance, to make a master CDF from an Excel file, then save it back as
a skeleton table and an Excel file in the build folder:
maser-tools skeletoncdf -o build my_master.xlsx
maser-tools skeletontable --to-xlsx -o build/skt build/my_master.cdf
An example of Excel file is provided in
src/maser/tools/support/cdf/converter_example.xlsx.
Python
from maser.tools.cdf.serializer import xlsx2cdf, cdf2xlsx
cdf_file = xlsx2cdf("my_master.xlsx", output_dir="build", overwrite=True)
xlsx_file = cdf2xlsx("build/my_master.cdf", output_dir="build", overwrite=True)
Development
To contribute to the development of the package, clone the repository:
git clone https://gitlab.obspm.fr/maser/maser-tools.git
cd maser-tools
The project is managed with uv.
Its requirements are detailed in the pyproject.toml file, and pinned in the uv.lock file.
Installing a local copy of maser-tools
Run the following command to create the virtual environment (.venv) and install
the package (in editable mode) with its development dependencies:
uv sync
Then run the programs from this environment with uv run, e.g.:
uv run maser-tools --help
The binary files (e.g. Excel files) are stored with Git LFS:
run git lfs install once before cloning the repository.
Code quality
The code is linted and formatted with ruff, through pre-commit hooks. Install them once with:
uv run pre-commit install
They can also be run on all the files with:
uv run pre-commit run --all-files
Tests
Run the tests with:
uv run pytest
The tests calling the skeletoncdf and skeletontable programs are skipped when they
are not found.
Publish maser-tools on PyPI
Build the source and wheel distributions in the dist folder:
uv build
And then publish them on PyPI (see uv publish):
uv publish
Metadata
Release files for maser-tools 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| maser_tools-0.3.2.tar.gz | 63.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| maser_tools-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 138.8 kB
Release files / maser_tools-0.3.2.tar.gz
| Download URL | maser_tools-0.3.2.tar.gz |
|---|---|
| Size | 63.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f0ef85c599703c680f967bc3380ea16ebef300439a8aebd825e9664a7ad6d89
|
|
BLAKE2b-256 checksum How to use checksums |
6ae1e7cb3a01a7482cff418cbd5cf581840cf3eeb22c6bab04f3975ea10bc732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maser_tools-0.3.2-py3-none-any.whl
| Download URL | maser_tools-0.3.2-py3-none-any.whl |
|---|---|
| Size | 75.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52590695b6e3d3558429cc76cfab8073dd6d1f9fb86021c86d604862a55d9dcc
|
|
BLAKE2b-256 checksum How to use checksums |
ba01a3593637e82c632e71fbb2293887233bd7a4e0d02a0f0c13b1163130e7ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|