ConjugateSpectrumModel

class screens.modeling.ConjugateSpectrumModel(cs, d_eff=None, mu_eff=None, theta=None, magnification=None)[source] [edit on github]

Bases: object

Conjugate spectrum and methods to fit it.

The code is meant to be agnostic to which axes are which, but some may assume a shape of (..., doppler_axis, delay_axis).

Parameters:
csConjugateSpectrum

Fourier transform of a dynamic spectrum.

d_effQuantity

Assumed effective distance. This is used throughout and not fit, but can be treated as a scaling parameters.

mu_effQuantity, optional

Initial guess for the effective proper motion, v_eff/d_eff.

thetaQuantity, optional

Grid of theta angles to use for modelling the dynamic spectrum. Probably more usefully calculated later using theta_grid.

magnificationQuantity, optional

Magnifications at each theta. More typically inferred by fitting the secondary spectrum.

Methods Summary

locate_mu_eff([mu_eff_trials, use_secspec, ...])

Try reproducing the secondary spectrum for a range of proper motion.

model([magnification, mu_eff, conserve])

Calculate the expected conjugate spectrum for given parameters.

theta_grid([oversample_tau, oversample_fd])

Calculate a grid of theta for modelling the secondary spectrum.

theta_theta([mu_eff, conserve, theta_grid])

Project the secondary spectrum into theta-theta space.

Methods Documentation

locate_mu_eff(mu_eff_trials=None, use_secspec=True, verbose=False)[source] [edit on github]

Try reproducing the secondary spectrum for a range of proper motion.

For each proper motion, construct a theta-theta array, calculte the largest eigenvalue and use the corresponding eigenvector as the model one-dimensional screen.

Parameters:
mu_eff_trialsQuantity

Proper motions to try.

use_secspecbool

Whether to just decompose the powers or the full complex secondary spectrum. The former is faster and varies less quickly with proper motion, so can be used to find the global minimum before re-running on the full complex values.

verbosebool

Whether or not to give summary statistics for each trial.

Returns:
curvatureQTable

Table with the following columns: - mu_eff : Input proper motions. - theta : grid in theta used. - w : Largest eigenvalue. - recovered : corresponding eigenvector, i.e., magnifications. - th_ms : Mean-square residual in theta-theta space. - ndof : degrees of freedom n_dynspec - n_theta - 2. - redchi2 : reduced chi2 ((dynspec - model)/noise)**2/ndof.

Notes

The resulting table is also stored on the instance, as curvature.

Note that the noise in the secondary spectrum is currently ignored.

model(magnification=None, mu_eff=None, conserve=False)[source] [edit on github]

Calculate the expected conjugate spectrum for given parameters.

theta_grid(oversample_tau=2, oversample_fd=4, **kwargs)[source] [edit on github]

Calculate a grid of theta for modelling the secondary spectrum.

Wraps screens.fields.theta_grid with defaults from the class. See that function for details. Oversampling is set relatively high here, since covariances between the theta are not as important as for fitting a dynamic spectrum.

Note that this does not set the angles on the class, so typical usage is ds.theta = ds.theta_grid().

theta_theta(mu_eff=None, conserve=False, theta_grid=True, **kwargs)[source] [edit on github]

Project the secondary spectrum into theta-theta space.

For a given grid in theta (possibly calculated) and a set of pairs found using screens.fields.theta_theta_indices, interpolate in the secondary spectrum to find the theta-theta arrays.

Parameters:
mu_effQuantity, optional

Effective proper motion to use. Defaults to that stored on the instance. Will update the instance if given.

conservebool

Whether to conserve flux per surface area. Doing so reduces sensitivity to points near the axes, but means one cannot directly use any eigenvectors directly in constructing dynamic spectra.

theta_gridbool, optional

Whether to calculate a new theta grid, or use the one stored on the instance. By default, calculate it only if mu_eff is passed in. If True, this will update the grid stored on the instance.

**kwargs

Any further arguments are passed on to theta_grid