drpangloss.grid_fit
Functions
likelihood_grid(data_obj, model_class, samples_dict)
Function to vmap a likelihood function over a grid of parameter values provided in a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_obj
|
OIData
|
Object containing the data to be fitted. |
required |
model_class
|
class
|
Model class to be fitted to the data. |
required |
samples_dict
|
Dictionary of parameter names and values to be fitted to the data. |
required |
Returns:
| Type | Description |
|---|---|
array - like
|
Log-likelihood values over the grid of parameter values. |
optimized_likelihood_grid(data_obj, model_class, samples_dict)
Function to optimize the contrast of a model over a grid of parameter values provided in a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_obj
|
OIData
|
Object containing the data to be fitted. |
required |
model_class
|
class
|
Model class to be fitted to the data. |
required |
samples_dict
|
Dictionary of parameter names and values to be fitted to the data. |
required |
Returns:
| Type | Description |
|---|---|
array - like
|
Optimized contrast values over the grid of parameter values. |
optimized_contrast_grid(data_obj, model_class, samples_dict)
Function to optimize the contrast of a model over a grid of parameter values provided in a dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_obj
|
OIData
|
Object containing the data to be fitted. |
required |
model_class
|
class
|
Model class to be fitted to the data. |
required |
samples_dict
|
Dictionary of parameter names and values to be fitted to the data. |
required |
Returns:
| Type | Description |
|---|---|
array - like
|
Optimized contrast values over the grid of parameter values. |
laplace_contrast_uncertainty_grid(best_contrast_indices, data_obj, model_class, samples_dict)
Calculate the uncertainty with the Laplace method over a grid of parameters, for an optimized fit between a model and data object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
best_contrast_indices
|
array - like
|
Indices of the best contrast values in a grid calculated with likelihood_grid. |
required |
data_obj
|
OIData
|
Object containing the data to be fitted. |
required |
model_class
|
class
|
Model class to be fitted to the data. |
required |
samples_dict
|
Dictionary of parameter names and values to be fitted to the data. |
required |
Returns:
| Type | Description |
|---|---|
array - like
|
Uncertainty in the contrast. |
ruffio_upperlimit(mean, sigma, percentile)
Calculate the upper limit of a distribution given the mean and standard deviation. This is a vectorized JAX implementation of Ruffio et al. (2018).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mean
|
array - like
|
Mean of the distribution. |
required |
sigma
|
array - like
|
Standard deviation of the distribution. |
required |
percentile
|
float
|
Percentile value for the upper limit. |
required |
Returns:
| Type | Description |
|---|---|
array - like
|
Upper limit of the distribution. |
azimuthalAverage(image, center=None, stddev=False, returnradii=False, return_nr=False, binsize=0.5, weights=None, steps=False, interpnan=False, left=None, right=None, return_max=False)
Calculate an azimuthally averaged radial profile for a 2D image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
array - like
|
Two-dimensional image. |
required |
center
|
tuple[float, float]
|
Pixel coordinates |
None
|
stddev
|
bool
|
If |
False
|
returnradii
|
bool
|
If |
False
|
return_nr
|
bool
|
If |
False
|
binsize
|
float
|
Radial bin width in pixel units. |
0.5
|
weights
|
array - like
|
Per-pixel weights. Must match |
None
|
steps
|
bool
|
If |
False
|
interpnan
|
bool
|
If |
False
|
left
|
float
|
Left extrapolation value passed to |
None
|
right
|
float
|
Right extrapolation value passed to |
None
|
return_max
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
array - like or tuple
|
Radial profile array, or a tuple depending on |
Notes
Empty bins are returned as NaN unless interpolated.
absil_limits(samples_dict, data_obj, model_class, sigma)
Using Jax for optimization, calculate the detection limits for a given model class and data object. This is by finding the contrast at which the detection significance is equal to the sigma value. For example, if we set sigma = 3, we optimize in each coordinate cell to find the contrast at which we would be 3 sigma confident that the companion is detected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
samples_dict
|
Dictionary of parameter names and values to be fitted to the data, eg dra and ddec grids. |
required | |
data_obj
|
Observational data in the format of an OIData object. |
required | |
model_class
|
Model class to be fitted to the data. |
required | |
sigma
|
Detection significance. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
res |
float
|
Maximum relative flux of companion. |