lair.transects.magnitude#

lair.transects.magnitude(enh, threshold=None, stat='median', min_transits=10)[source]#

Per-point enhancement magnitude.

It is stat over detected transits (enh > threshold) or over all transits with data (threshold=None).

Parameters:
  • enh (np.ndarray) – Enhancement matrix enh[transit, point], as from enhancement().

  • threshold (float or None, optional) – Enhancement above which a transit counts as a detection; None (the default) uses every transit with data.

  • stat (str, optional) – "median" (the default) or "mean".

  • min_transits (int, optional) – Fewest transits with data (before thresholding) a point needs. Default 10.

Returns:

np.ndarray – The magnitude per point. Points sampled by fewer than min_transits transits are NaN; so are points with no detection at all.

Return type:

ndarray

See also

detection_frequency

How often each point is enhanced.

Examples

>>> import numpy as np
>>> from lair.transects import magnitude
>>> enh = np.array(
...     [[0.0, 0.1, 0.6, 0.0], [0.0, 0.0, 0.1, 0.7], [0.0, np.nan, 0.5, 0.0]]
... )
>>> magnitude(enh, threshold=0.2, min_transits=2)
array([ nan,  nan, 0.55, 0.7 ])