This release is a pre-release and may not be stable for production use.
msutils
Tools for manipulating CASA Measurement Sets (MS), for radio-astronomy pipelines.
Features
- Summarise an MS — fields, spectral windows, antennas, scans, correlations — to a dict / JSON.
- Add, copy, and sum/subtract visibility columns, chunked by spectral window.
- Add Gaussian noise to a column (from a stddev, or computed from an SEFD).
- Verify / fix antenna Y-position sign conventions.
- Flag statistics per antenna / scan / field / correlation, with a matplotlib summary plot (
flagstatsextra). - Per-channel visibility weight estimation from an SEFD profile (
plotsextra). - A
msutilscommand-line tool wrapping the above.
Install
Requires Python >= 3.8. python-casacore is pulled in automatically (its wheels bundle the casacore libraries).
pip install msutils # core column operations + CLI
pip install "msutils[flagstats]" # + flag statistics & plots (dask-ms, matplotlib)
pip install "msutils[plots]" # + weight estimation (matplotlib, scipy)
pip install "msutils[all]" # everything
Python API
The core operations are exposed directly on the package:
import msutils
# Metadata summary (returns a JSON-serialisable dict)
info = msutils.summary("obs.ms")
# Column operations
msutils.addcol("obs.ms", "MODEL_DATA", clone="DATA")
msutils.copycol("obs.ms", "DATA", "CORRECTED_DATA")
msutils.sumcols("obs.ms", cols=["DATA", "MODEL_DATA"], outcol="CORRECTED_DATA")
# Add noise (computed from an SEFD, or a fixed stddev)
msutils.addnoise("obs.ms", column="MODEL_DATA", sefd=551)
Flag statistics and weight estimation live in optional submodules:
from msutils import flagstats # needs msutils[flagstats]
flagstats.plot_statistics("obs.ms", plotfile="flags.png", outfile="flags.json")
from msutils.weights import MSNoise # needs msutils[plots]
Command line
msutils summary obs.ms --json summary.json
msutils addcol obs.ms MODEL_DATA --clone DATA
msutils copycol obs.ms DATA CORRECTED_DATA
msutils sumcols obs.ms DATA MODEL_DATA --out CORRECTED_DATA
msutils addnoise obs.ms --column MODEL_DATA --sefd 551
msutils flagstats obs.ms --plot flags.png --json flags.json # needs msutils[flagstats]
Run msutils --help or msutils <command> --help for all options.
Migrating from 1.x / MSUtils
- The import package is now lowercase
msutils(the capitalisedMSUtilsstill works, with a deprecation warning). - The core functions are on the package root — use
msutils.summary(...)instead offrom msutils import msutils. - Modules renamed:
flag_stats→flagstats,ClassESW→weights(old names still importable, deprecated). imp_plotter(gain/calibration-table plotting) was removed — use ragavi (ragavi-gains) instead.- The defunct
prep()and its external-binary dependencies were removed.
License
GNU GPL v2 or later. See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file msutils-2.0.0b1.tar.gz.
File metadata
- Download URL: msutils-2.0.0b1.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
090180200620a6a036e905e3b4eb9945ef5ce6e4e41a235cd73ce0fc9929eec0
|
|
| MD5 |
7da12ce9e7cf7a8487a32817ad7fb9ff
|
|
| BLAKE2b-256 |
0b2efbec43a6ea9de858b3d498fae56c83b39903f93c7c307a4c6c2ad98c29f4
|
File details
Details for the file msutils-2.0.0b1-py3-none-any.whl.
File metadata
- Download URL: msutils-2.0.0b1-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d21f13e293452d4eaa34929c62504b52c8fc538671d7bb59b9277e33677193c
|
|
| MD5 |
6780360764927002f9755cfd48670000
|
|
| BLAKE2b-256 |
648c8452c26c17b528d781ff3cd07d1f748550b8d6c87c5af05fda4f1ac460d8
|