rxmc.observation.Observation#

class rxmc.observation.Observation(x: ndarray, y: ndarray, y_stat_err=None, y_sys_err_normalization=None, y_sys_err_normalization_mask=None, y_sys_err_offset=None, y_sys_err_offset_mask=None)[source]#

Bases: object

A class to represent an observation with statistical errors, as well as systematic errors associated with a common normalization and offset of all or some of the data points of the the dependent variable y.

x#

The independent variable data.

Type:

np.ndarray

y#

The dependent variable data.

Type:

np.ndarray

statistical_covariance#

The covariance matrix representing the statistical errors of y.

Type:

np.ndarray

systematic_offset_covariance#

The covariance matrix representing systematic errors associated with the offset of y.

Type:

np.ndarray

systematic_normalization_covariance#

The fractional covariance matrix representing systematic errors associated with the normalization of y.

Type:

np.ndarray

n_data_pts#

The number of data points in the observation.

Type:

int

__init__(x: ndarray, y: ndarray, y_stat_err=None, y_sys_err_normalization=None, y_sys_err_normalization_mask=None, y_sys_err_offset=None, y_sys_err_offset_mask=None)[source]#
xnp.ndarray

The independent variable data.

ynp.ndarray

The dependent variable data.

y_stat_errnp.ndarray, optional

The statistical error associated with y. Defaults to an array of zeros with the same shape as y.

y_sys_err_normalizationfloat or array-like, optional

The fractional systematic error associated with normalization of y. Defaults to 0.0. If array-like object is passed in, that implies that there are multiple systematic errors associated with normalization, each corresponding to an entry in y_sys_err_normalization_mask.

y_sys_err_normalization_masklist of np.ndarray, optional

Masks for the systematic errors associated with normalization of y. Each mask should have the same shape as y, and the systematic error associated with normalization will only apply to the points where the mask is True. Defaults to None, meaning no systematic errors associated with normalization, or equivalently, a single systematic error for all points.

y_sys_err_offsetfloat or array-like, optional

The systematic error associated with the offset of y. Defaults to 0.0. If array-like object is passed in, that implies that there a multiple systematic errors associated with normalization, each corresponding to an entry in y_sys_err_normalization_mask.

y_sys_err_offset_masklist of np.ndarray, optional

Masks for the systematic errors associated with the offset of y. Each mask should have the same shape as y, and the systematic error associated with the offset will only apply to the points where the mask is True. Defaults to None, meaning no systematic errors associated with the offset, or equivalently, a single systematic error for all points.

Methods

__init__(x, y[, y_stat_err, ...])

x : np.ndarray

covariance(y)

Returns the default covariance matrix for the observation, which is the sum of the statistical and systematic offset covariance matrices, and the fractional normalization covariance matrix multiplied by the outer product of y with itself.

num_pts_within_interval(ylow, yhigh[, xlim])

Returns the number of points in y that fall between ylow and yhigh, useful for calculating emperical coverages

residual(ym)

covariance(y)[source]#

Returns the default covariance matrix for the observation, which is the sum of the statistical and systematic offset covariance matrices, and the fractional normalization covariance matrix multiplied by the outer product of y with itself.

Parameters:

y (np.ndarray) – The dependent variable data for which to compute the covariance.

residual(ym: ndarray)[source]#
num_pts_within_interval(ylow: ndarray, yhigh: ndarray, xlim=None)[source]#

Returns the number of points in y that fall between ylow and yhigh, useful for calculating emperical coverages

Parameters:
  • ylow (np.ndarray, same shape as self.y)

  • yhigh (np.ndarray, same shape as self.y)

  • xlim (tuple, optional) – If provided, only consider points where self.x is within this range. Defaults to None, meaning all points are considered.

Returns:

int – The number of points in self.y (within xlim) that fall within the specified interval defined by ylow and yhigh.