virgil.pipeline
The classes and functions of the pipelines. For what a pipeline does, the run folder, the checks and the stability policy, see Pipelines and their stability.
Bases: _Pipeline
Search for a companion, set contrast limits, fit and sample a binary.
Stages: load → overview → search → limits → fit → posterior →
quicklook.
loadapplieswavel_rangeanderror_floorand writes the data that are fitted todata/processed.oifits.overviewplots the data and their uv coverage.searchrunsdetection_statistics(Δχ², log Bayes factor, best SNR) on a point-companion grid (dra,ddecin mas, log-spacedflux), with maps of Δχ², best flux and SNR, and the significance at the peak (local_nsigma) before and after a look-elsewhere correction for the number of resolution elements searched.limitsrunsabsil_limitsatsigmaand itsradial_profile.fitrunsfiton the model template from the best grid point.posteriorsamplesnumpyro_modelwith NUTS from the fit.quicklookwrites and executesquicklook.ipynb.
The fit is on the quoted errors unless error_scale="fit", and χ²/N
is always reported on the quoted errors. Priors are group-invariant:
uniform in position (dra, ddec or sep), uniform in
position angle (an AngleVector, with
no wrap at 0°/360°) and log-uniform in flux over flux_range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
OIData
|
The data. |
required |
model
|
BinaryModelAngular or BinaryModelCartesian
|
Model template; its class sets the fitted parameters ( |
None
|
output
|
str or PathLike
|
Run folder (default |
'run'
|
**settings
|
Overrides of the defaults (see
|
{}
|
Examples:
>>> import virgil as vg
>>> from virgil.pipeline import BinaryPipeline, load
>>> res = BinaryPipeline(vg.OIData("hd1234.oifits"), output="runs/hd1234").run()
>>> res.summary["companion"]["sep_mas"]
NAME = 'binary'
class-attribute
instance-attribute
STABILITY = 'stable'
class-attribute
instance-attribute
STAGES = ('load', 'overview', 'search', 'limits', 'fit', 'posterior', 'quicklook')
class-attribute
instance-attribute
__init__(data, model=None, *, output='run', **settings)
Bases: _Pipeline
Measure a star's angular diameter, with and without limb darkening.
Stages: load → overview → fit → posterior → quicklook.
loadapplieswavel_rangeanderror_floorand writes the data that are fitted todata/processed.oifits.overviewplots the data and their uv coverage.fitscans the uniform-disk diameter (a uniform disk's closure phases flip at every null, so its χ² is not smooth and a scan is the reliable fit), then fits each other model withfitfrom the scanned diameter. With the defaultmodelit compares the limb-darkened and uniform fits by their Δχ² on the quoted errors against a BIC penalty.posteriorsamples every fitted model with NUTS (numpyro_model).quicklookwrites and executesquicklook.ipynb: the main result is V² against spatial frequency with the model curves.
The fit is on the quoted errors unless error_scale="fit", and χ²/N
is always reported on the quoted errors. Priors are group-invariant:
log-uniform in the diameter over diam_range_mas and uniform on
[0, 1] in Kipping's limb-darkening coefficients q1, q2, which
cover exactly the physical quadratic laws.
res.model() is the preferred model (the limb-darkened one only if
its Δχ² exceeds the BIC penalty of its two extra parameters);
res.model("uniform") and res.model("limb_darkened") give each.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
OIData
|
The data. |
required |
model
|
str or SourceModel
|
What to fit. A short name, |
None
|
output
|
str or PathLike
|
Run folder (default |
'run'
|
**settings
|
Overrides of the defaults (see
|
{}
|
Examples:
>>> import virgil as vg
>>> from virgil.pipeline import StarPipeline
>>> res = StarPipeline(vg.OIData("star.oifits"), output="runs/star").run()
>>> res.summary["star"]["diam_mas"]
NAME = 'star'
class-attribute
instance-attribute
STABILITY = 'stable'
class-attribute
instance-attribute
STAGES = ('load', 'overview', 'fit', 'posterior', 'quicklook')
class-attribute
instance-attribute
names = names
instance-attribute
__init__(data, model=None, *, output='run', **settings)
Reload a pipeline run from its folder, without recomputing anything.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str or PathLike
|
The run folder (the pipeline's |
required |
Returns:
| Type | Description |
|---|---|
Result
|
|
The outputs of a pipeline run, reloaded from its folder.
Nothing is recomputed: every accessor reads the files the run wrote, and returns plain numbers, numpy arrays or real virgil objects that can be refined by hand.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Path
|
The run folder. |
run |
dict
|
The contents of |
summary |
dict
|
The contents of |
path = Path(path)
instance-attribute
run = read_json(run_file)
instance-attribute
summary = read_json(summary_file) if summary_file.exists() else {}
instance-attribute
status
property
Run status: "running", "partial", "complete" or "failed".
checks
property
The quality checks, as a list of Check.
plots
property
Paths of the plots the run wrote, sorted by name.
__init__(path)
__repr__()
describe()
The key numbers of the summary as short text, one per line.
data()
The data actually fitted, as an OIData, from data/processed.oifits.
model(name=None)
A fitted model, a real virgil object with its values set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
For a run that fitted several models ( |
None
|
model_values(name=None)
The fitted parameter values, as path → numpy array (see model).
samples(group_by_chain=True, name=None)
Posterior samples by site, shaped (chain, draw) (or flat).
name selects one of several fitted models, as in model.
sample_stats(name=None)
NUTS diagnostics per transition, shaped (chain, draw).
grid()
Grid results: "axes" (usable as grid=) plus one map per name.
fit_result(name=None)
The MAP fit as a virgil FitResult, e.g. to continue with fit.
name selects one of several fitted models, as in model.
One quality check of a pipeline run.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Stable identifier, e.g. |
status |
{'pass', 'warn', 'fail'}
|
Outcome. |
value |
(float, list or None)
|
The quantity tested. |
threshold |
(float, list or None)
|
The threshold it was compared with. |
message |
str
|
One templated sentence saying what the outcome means. |
name
instance-attribute
status
instance-attribute
value
instance-attribute
threshold
instance-attribute
message
instance-attribute
__post_init__()
to_dict()
The check as a JSON-ready dict.
from_dict(record)
classmethod
Rebuild a check from :meth:to_dict.