Struct light_curve_feature::features::BeyondNStd
source · pub struct BeyondNStd<T> { /* private fields */ }
Expand description
Fraction of observations beyond $n,\sigma_m$ from the mean magnitude $\langle m \rangle$
$$ \mathrm{beyond}~n,\sigma_m \equiv \frac{\sum_i I_{|m - \langle m \rangle| > n,\sigma_m}(m_i)}{N}, $$ where $I$ is the indicator function, $N$ is the number of observations, $\langle m \rangle$ is the mean magnitude and $\sigma_m = \sqrt{\sum_i (m_i - \langle m \rangle)^2 / (N-1)}$ is the magnitude standard deviation.
- Depends on: magnitude
- Minimum number of observations: 2
- Number of features: 1
D’Isanto et al. 2016 DOI:10.1093/mnras/stw157
Example
use light_curve_feature::*;
use light_curve_common::all_close;
use std::f64::consts::SQRT_2;
let fe = FeatureExtractor::new(vec![BeyondNStd::default(), BeyondNStd::new(2.0)]);
let time = [0.0; 21]; // Doesn't depend on time
let mut magn = vec![0.0; 17];
magn.extend_from_slice(&[SQRT_2, -SQRT_2, 2.0 * SQRT_2, -2.0 * SQRT_2]);
let mut ts = TimeSeries::new_without_weight(&time[..], &magn[..]);
assert_eq!(0.0, ts.m.get_mean());
assert!((1.0 - ts.m.get_std()).abs() < 1e-15);
assert_eq!(vec![4.0 / 21.0, 2.0 / 21.0], fe.eval(&mut ts).unwrap());
Implementations
sourceimpl<T> BeyondNStd<T>where
T: Float,
impl<T> BeyondNStd<T>where
T: Float,
sourceimpl<T> BeyondNStd<T>
impl<T> BeyondNStd<T>
Trait Implementations
sourceimpl<T: Clone> Clone for BeyondNStd<T>
impl<T: Clone> Clone for BeyondNStd<T>
sourcefn clone(&self) -> BeyondNStd<T>
fn clone(&self) -> BeyondNStd<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<T: Debug> Debug for BeyondNStd<T>
impl<T: Debug> Debug for BeyondNStd<T>
sourceimpl<T> Default for BeyondNStd<T>where
T: Float,
impl<T> Default for BeyondNStd<T>where
T: Float,
sourceimpl<'de, T> Deserialize<'de> for BeyondNStd<T>where
T: Float,
impl<'de, T> Deserialize<'de> for BeyondNStd<T>where
T: Float,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T: Float> EvaluatorInfoTrait for BeyondNStd<T>
impl<T: Float> EvaluatorInfoTrait for BeyondNStd<T>
sourcefn min_ts_length(&self) -> usize
fn min_ts_length(&self) -> usize
Minimum time series length required to successfully evaluate feature
sourcefn is_t_required(&self) -> bool
fn is_t_required(&self) -> bool
If time array used by the feature
sourcefn is_m_required(&self) -> bool
fn is_m_required(&self) -> bool
If magnitude array is used by the feature
sourcefn is_w_required(&self) -> bool
fn is_w_required(&self) -> bool
If weight array is used by the feature
sourcefn is_sorting_required(&self) -> bool
fn is_sorting_required(&self) -> bool
If feature requires time-sorting on the input TimeSeries
sourceimpl<T> FeatureEvaluator<T> for BeyondNStd<T>where
T: Float,
impl<T> FeatureEvaluator<T> for BeyondNStd<T>where
T: Float,
sourcefn eval(&self, ts: &mut TimeSeries<'_, T>) -> Result<Vec<T>, EvaluatorError>
fn eval(&self, ts: &mut TimeSeries<'_, T>) -> Result<Vec<T>, EvaluatorError>
Vector of feature values or
EvaluatorError
sourcefn eval_or_fill(&self, ts: &mut TimeSeries<'_, T>, fill_value: T) -> Vec<T>
fn eval_or_fill(&self, ts: &mut TimeSeries<'_, T>, fill_value: T) -> Vec<T>
Returns vector of feature values and fill invalid components with given value
sourcefn check_ts_length(
&self,
ts: &TimeSeries<'_, T>
) -> Result<usize, EvaluatorError>
fn check_ts_length(
&self,
ts: &TimeSeries<'_, T>
) -> Result<usize, EvaluatorError>
Checks if TimeSeries has enough points to evaluate the feature
sourceimpl<T> FeatureNamesDescriptionsTrait for BeyondNStd<T>where
T: Float,
impl<T> FeatureNamesDescriptionsTrait for BeyondNStd<T>where
T: Float,
sourceimpl<T> From<BeyondNStd<T>> for Feature<T>where
T: Float,
impl<T> From<BeyondNStd<T>> for Feature<T>where
T: Float,
sourcefn from(v: BeyondNStd<T>) -> Feature<T>
fn from(v: BeyondNStd<T>) -> Feature<T>
Converts to this type from the input type.
sourceimpl<T> JsonSchema for BeyondNStd<T>where
T: Float,
impl<T> JsonSchema for BeyondNStd<T>where
T: Float,
sourcefn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moresourcefn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
sourcefn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
sourceimpl<T> Serialize for BeyondNStd<T>where
T: Float,
impl<T> Serialize for BeyondNStd<T>where
T: Float,
sourceimpl<T> TryInto<BeyondNStd<T>> for Feature<T>where
T: Float,
impl<T> TryInto<BeyondNStd<T>> for Feature<T>where
T: Float,
sourcefn try_into(
self
) -> Result<BeyondNStd<T>, <Self as TryInto<BeyondNStd<T>>>::Error>
fn try_into(
self
) -> Result<BeyondNStd<T>, <Self as TryInto<BeyondNStd<T>>>::Error>
Performs the conversion.
Auto Trait Implementations
impl<T> RefUnwindSafe for BeyondNStd<T>where
T: RefUnwindSafe,
impl<T> Send for BeyondNStd<T>where
T: Send,
impl<T> Sync for BeyondNStd<T>where
T: Sync,
impl<T> Unpin for BeyondNStd<T>where
T: Unpin,
impl<T> UnwindSafe for BeyondNStd<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
sourcefn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
sourceimpl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
sourcefn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
sourcefn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject with the default scheme.
sourcefn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject with a specific scheme.
sourceimpl<T> ConvUtil for T
impl<T> ConvUtil for T
sourcefn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
sourcefn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
sourcefn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
Convert the subject to a given type.