A python package to interpret multiwavelength astronomical timeseries with GPs
Project description
pgmuvi
Python gaussian processes for multiwavelength variability inference
pgmuvi is based on GPyTorch and intended for us in infering the properties of astronomical sources with multiwavelength variability. It uses spectral-mixture kernels to learn an approximation of the PSD of the variability, which have been shown to be very effective for pattern discovery (see https://arxiv.org/pdf/1302.4245.pdf).
Installation and Quickstart
pgmuvi can be installed easily with pip::
$ pip install pgmuvi
You can also clone the latest version of pgmuvi from Github, for all the latest bugs but increased risk of features::
$ git clone git://github.com/ICSM/pgmuvi.git
and then you can install it::
$ cd pgmuvi
$ pip install .
If you want to contribute to pgmuvi and develop new features, you might want an editable install::
$ pip install -e .
this way you can test how things change as you go along.
Contributing
We very much welcome contributions to pgmuvi! Please take a look at our contributing guide for more information on how to contribute! But don't forget to read our code of conduct before you get started.
Citing pgmuvi
pgmuvi is currently under review in the Journal of Open Source Software. If you use pgmuvi in your research, please cite the paper (details will be given here when the paper is accepted!)
Using pgmuvi
You can find full documentation for pgmuvi at https://pgmuvi.readthedocs.io/. This includes a quickstart guide and a set of tutorials intended to get you up and running.
Sampling Quality Assessment
Before fitting a GP, you can check whether your lightcurve has adequate temporal sampling:
# Compute sampling metrics
metrics = lc.compute_sampling_metrics()
print(f"Nyquist period: {metrics['nyquist_period']:.2f} days")
print(f"Detectable range: {metrics['nyquist_period']:.1f}"
f" - {metrics['longest_detectable_period']:.1f} days")
# Full quality assessment with detailed report
passes, diagnostics = lc.assess_sampling_quality(verbose=True)
if diagnostics['recommendation'] == 'PROCEED':
lc.fit(...)
By default, fit() automatically checks sampling quality:
lc.fit(model='1D', ...) # Raises ValueError if sampling is poor
lc.fit(model='1D', ..., check_sampling=False) # Force fitting anyway
For multiband data:
# Check each wavelength band
results = lc2d.assess_sampling_quality_per_band()
print(f"{results['summary']['n_passing']}/{results['summary']['n_bands']} bands pass")
# Compute metrics per band
band_metrics = lc2d.compute_sampling_metrics_per_band()
# Filter to well-sampled bands only
lc_good = lc2d.filter_well_sampled_bands()
lc_good.fit(model='2D', ...)
Variability Detection
Before fitting a GP, you can check if your lightcurve shows significant variability using the built-in three-tier statistical testing framework (weighted chi-square, F_var excess variance, and Stetson K index):
from pgmuvi.lightcurve import Lightcurve
lc = Lightcurve(t, y, yerr)
# Check variability
diagnostics = lc.check_variability(verbose=True)
if diagnostics['decision'] == 'VARIABLE':
# Proceed with fitting
lc.fit(...)
else:
print(f"Not variable: {diagnostics['decision']}")
You can also enable automatic variability checking inside fit():
# Raises ValueError if lightcurve is not variable
lc.fit(..., check_variability=True)
# To force fitting of a non-variable source:
lc.fit(..., check_variability=False)
For multiband data, each band can be checked independently:
lc2d = Lightcurve(xdata_2d, flux, error)
# Check each band
results = lc2d.check_variability_per_band(verbose=True)
print(f"{results['summary']['n_variable']} variable bands")
# Create a new Lightcurve with only variable bands retained
lc_var = lc2d.filter_variable_bands()
lc_var.fit(...)
Project details
Release history Release notifications | RSS feed
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 pgmuvi-0.2.0rc2.tar.gz.
File metadata
- Download URL: pgmuvi-0.2.0rc2.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b23436b6a1664c646903db46c2960a0769218de8770262bef9783253411711ef
|
|
| MD5 |
dc51e60e5ad53df97d363fe67c73964f
|
|
| BLAKE2b-256 |
8c4b3a3fb4cd5e3857b54b4e38e4ad744da5380d4910aa8511db54b81bebf206
|
Provenance
The following attestation bundles were made for pgmuvi-0.2.0rc2.tar.gz:
Publisher:
publish-package-pypi.yml on ICSM/pgmuvi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgmuvi-0.2.0rc2.tar.gz -
Subject digest:
b23436b6a1664c646903db46c2960a0769218de8770262bef9783253411711ef - Sigstore transparency entry: 1399191848
- Sigstore integration time:
-
Permalink:
ICSM/pgmuvi@fba6ca947587820fb20e7d9a7860a6e4a604a0aa -
Branch / Tag:
refs/tags/v0.2.0rc2 - Owner: https://github.com/ICSM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package-pypi.yml@fba6ca947587820fb20e7d9a7860a6e4a604a0aa -
Trigger Event:
push
-
Statement type:
File details
Details for the file pgmuvi-0.2.0rc2-py3-none-any.whl.
File metadata
- Download URL: pgmuvi-0.2.0rc2-py3-none-any.whl
- Upload date:
- Size: 165.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4759730aa18610fe495c234f86f39331bc455adbd69d2e0c1d6cc615cb4267a6
|
|
| MD5 |
e1fa1a852a97179b2ee1f5c825ac3da6
|
|
| BLAKE2b-256 |
b7ba78b30213c1924c55daf08d26844a99963c58cc8c58672351d9283b5cf380
|
Provenance
The following attestation bundles were made for pgmuvi-0.2.0rc2-py3-none-any.whl:
Publisher:
publish-package-pypi.yml on ICSM/pgmuvi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pgmuvi-0.2.0rc2-py3-none-any.whl -
Subject digest:
4759730aa18610fe495c234f86f39331bc455adbd69d2e0c1d6cc615cb4267a6 - Sigstore transparency entry: 1399191859
- Sigstore integration time:
-
Permalink:
ICSM/pgmuvi@fba6ca947587820fb20e7d9a7860a6e4a604a0aa -
Branch / Tag:
refs/tags/v0.2.0rc2 - Owner: https://github.com/ICSM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package-pypi.yml@fba6ca947587820fb20e7d9a7860a6e4a604a0aa -
Trigger Event:
push
-
Statement type: