Skip to main content

# HERA Quality Metrics

[![](https://github.com/HERA-Team/hera_qm/workflows/Run%20Tests/badge.svg?branch=master)](https://github.com/HERA-Team/hera_qm/actions) [![codecov](https://codecov.io/gh/HERA-Team/hera_qm/branch/master/graph/badge.svg)](https://codecov.io/gh/HERA-Team/hera_qm)

hera_qm is a python package for calculating quality metrics of HERA data. It is integrated in the Real-Time Pipeline (RTP), automatically generating metrics for all HERA data as it is taken. But hera_qm can also be used offline for further analysis.

## Motivation Data quality metrics are useful and needed throughout the analysis of interferometric data. This repository is a centralized place for the HERA team to develop metrics to 1) run on data in the RTP and deliver to the wider collaboration; 2) store these metrics in the Monitor and Control database for easy access; and 3) use offline in individual analyses. As a consequence of the first two goals, contributions to hera_qm will be vetted by the community and require thorough unittests. However, the code base will also be flexible to enable the third goal, and we welcome contributions (see below).

## Installation Preferred method of installation for users is simply pip install . (or pip install git+https://github.com/HERA-Team/hera_qm). This will install required dependencies. See below for manual dependency management.

### Dependencies If you are using conda, you may wish to install the following dependencies manually to avoid them being installed automatically by pip:

$ conda install -c conda-forge "numpy>=1.23" "astropy>=5.0.4" "h5py>=3.1" "pyuvdata>=2.3" pyyaml

### Developing If you are developing hera_qm, it is preferred that you do so in a fresh conda environment. The following commands will install all relevant development packages:

$ git clone https://github.com/HERA-Team/hera_qm.git
$ cd hera_qm
$ conda create -n hera_qm python=3
$ conda activate hera_qm
$ conda env update -n hera_qm -f environment.yml
$ pip install -e .

This will install extra dependencies required for testing/development as well as the standard ones.

### Running Tests Uses the pytest package to execute test suite. From the source hera_qm directory run: `pytest` or `python -m pytest`.

## Package Details and Usage There are currently five primary modules which drive HERA quality metrics.

### ant_metrics A module to handle visibility-based metrics designed to identify misbehaving antennas. The module includes methods to calculate several metrics to identify cross-polarized antennas or dead antennas, based on either their redundancy with other antennas or their relative power. The primary class, AntennaMetrics, includes interfaces to these methods and functions for loading data, iteratively running metrics and removing misbehaving antennas, and saving the results of those metrics in a JSON. And example of using this moduleis in scripts/ant_metrics_example_notebook.ipynb.

### firstcal_metrics A module to calculate metrics based on firstcal delay solutions. These metrics identify large variations in delay solutions across time or across the array for a given time. Included are functions for plotting firstcal delay solutions, running the firstcal metrics, plotting the metrics, and writing them to file. An example of using this module is in scripts/firstcal_metrics.ipynb.

### omnical_metrics A module to calculate metrics based on omnical solutions. Currently, these metrics aim to identify discontinuities in the phase solutions of the gains and model visibilities, as well as outliers in the antenna-based chi-square output from omnical. Routines for calculating the metrics, writing them to file, and plotting the metrics (as well as the gain solutions and model visibilities) are included. For an example of how to use these metrics see scripts/omnical_metrics_example.ipynb. The metrics themselves are detailed there as well as in the doc-strings of the source code in hera_qm.Omnical_Metrics.run_metrics().

### xrfi This module contains the tools to for radio frequency interference (RFI) detection and flagging. Low-level preprocessing functions act on 2D arrays to filter data and/or calculate significance metrics. Flagging algorithms implement the low-level functions or flag in other ways (e.g. “watershed” around existing flags). “Pipelines” define the flagging strategy to apply to some data. For example, xrfi_h1c_pipe shows the flagging scheme we used for H1C observing season. Wrappers handle the file I/O, and call pipelines. xrfi_h1c_run is a wrapper we retroactively made to reflect what we did for H1C.

### UVFlag UVFlag has been moved to [pyuvdata](https://github.com/RadioAstronomySoftwareGroup/pyuvdata).

## Known Issues and Planned Improvements Issues are tracked in the [issue log](https://github.com/HERA-Team/hera_qm/issues). Major current issues and planned improvements include: * A unified metric class structure * Develop Tsys calculations into metrics (HERA Memos 16 and 34) * Develop closure quantities into metrics (HERA Memo 15)

## Contributing Contributions to this package to introduce new functionality or address any of the issues in the [issue log](https://github.com/HERA-Team/hera_qm/issues) are very welcome. Please submit improvements as pull requests against the repo after verifying that the existing tests pass and any new code is well covered by unit tests.

Bug reports or feature requests are also very welcome, please add them to the issue log after verifying that the issue does not already exist. Comments on existing issues are also welcome.

Metadata

Release files for hera-qm 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hera-qm 2.2.1
File Size Uploaded
hera_qm-2.2.1.tar.gz 62.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for hera-qm 2.2.1
File Interpreter ABI Platform
hera_qm-2.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 125.3 MB

Release files / hera_qm-2.2.1.tar.gz

Download URL hera_qm-2.2.1.tar.gz
Size 62.4 MB
Tags Source
SHA-256 checksum
How to use checksums
ade46fef4a68a696982208efb9b0cb33ab1264d09e4fd09bdf178f4925913afb
BLAKE2b-256 checksum
How to use checksums
8c73f5c4377a77c09fc140dfcadf69bc7c337907dfa3c6798e9ad62c53bd7b42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / hera_qm-2.2.1-py3-none-any.whl

Download URL hera_qm-2.2.1-py3-none-any.whl
Size 62.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e2e4b0e019dbaa725b3369d36d882dc90d521d9f0e7e40f52fa9f258bd8bbf2f
BLAKE2b-256 checksum
How to use checksums
b95cd8f81730769176bd0421c3d94670d151af21b2a0f7496827a403712e7e52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page