Skip to content

Class: SourceModel

Bases: Base

Base class for sky-brightness source models.

There are two kinds of source model.

The binary models' flux is their companion/primary flux ratio, which is the same thing as a companion's weight in a System whose primary has flux=1.

Subclasses implement model, and _image if they can be drawn.

time_dependent property

Whether the model changes with time (it contains an Attached component). Such a model is evaluated with at, which OIData.model does sample by sample.

model(u, v, wavel)

Evaluate complex visibilities on interferometric baselines.

Parameters:

Name Type Description Default
u array - like

Baseline coordinates in metres.

required
v array - like

Baseline coordinates in metres.

required
wavel array - like

Wavelength(s) in metres.

required

Returns:

Type Description
array - like

Complex visibilities, normalized to 1 at zero baseline.

model_on_grid(u, v, wavel, grid)

Visibilities at samples u, v that also lie on a uv grid.

OIData.model calls this when its samples form a regular lattice (a UVGrid), so that models able to use the lattice, such as a matching Image, can. By default it is model.

render(npix=256, fov_mas=200.0)

Render a unit-sum image of the model.

The image is npix x npix pixels spanning fov_mas milliarcseconds, with East to the left (column 0 is the most positive dra) and North up (row 0 is the most positive ddec). Use virgil.plotting.plot_model to display it with the correct axes.

total_spectrum(wavel)

The model's total flux at wavel (metres), e.g. for OI_FLUX.

The sum of the component spectra, in the same relative units as their fluxes: one grey scale (absolute calibration, injection) away from a measured spectrum. It is the intrinsic total, with no fibre coupling. For a System it is the sum of its parts' fluxes, where a nested system counts with its own flux, as in the visibilities.

Examples:

>>> from virgil.spectra import PowerLaw
>>> scene = System(
...     star=PointSource(),
...     disk=GaussianDisk(5.0, flux=PowerLaw(0.5, index=1.0, wavel0=2.0e-6)),
... )
>>> [round(float(f), 3) for f in scene.total_spectrum(np.array([2.0e-6, 4.0e-6]))]
[1.5, 2.0]

is_physical()

Whether the model is physically valid, as a (traceable) boolean.

Unlike the checks made when a model is built, this works inside jax.jit and on models changed with set, so likelihoods can reject invalid models (see reject_unphysical in model_loglike). The base class has no constraints.

at(mjd, t_ref=0.0)

This model at time t_ref + mjd (days, MJD).

The time is split so that it keeps its precision: t_ref is a float64 number and mjd may be small offsets from it, even in float32 (as OIData passes them). For a single time, model.at(60500.3) is enough. A model that does not change with time returns itself.