Input Validation

Input validation for INTENSE analysis.

Provides validation functions for time series bunches, metrics, and common parameters used throughout the INTENSE pipeline.

driada.intense.validation.validate_time_series_bunches(ts_bunch1, ts_bunch2)[source]

Validate time series bunches for INTENSE computations.

Parameters:
Raises:

ValueError – If bunches are empty, contain wrong types, or have mismatched lengths.

Return type:

None

driada.intense.validation.validate_metric(metric, allow_scipy=True)[source]

Validate metric name and check if it’s supported.

Parameters:
  • metric (str) –

    Metric name to validate. Supported metrics:

    • ’mi’: Mutual information (supports multivariate data)

    • ’av’: Activity ratio (requires one binary and one continuous variable)

    • ’fast_pearsonr’: Fast Pearson correlation implementation

    • ’spearmanr’, ‘pearsonr’, ‘kendalltau’: scipy.stats correlation functions

    • Any other callable from scipy.stats (if allow_scipy=True)

  • allow_scipy (bool, default=True) – Whether to allow scipy.stats correlation functions.

Returns:

metric_type – Type of metric:

  • ’mi’: Mutual information metric

  • ’special’: Special metrics (‘av’, ‘fast_pearsonr’)

  • ’scipy’: scipy.stats functions

Return type:

str

Raises:

ValueError – If metric is not supported or not a callable function in scipy.stats.

Notes

The function validates that scipy.stats attributes are callable to prevent accepting non-function attributes like constants or data arrays.

driada.intense.validation.validate_common_parameters(shift_window=None, ds=None, nsh=None, noise_const=None)[source]

Validate common INTENSE parameters.

Parameters:
  • shift_window (int, optional) – Maximum shift window in frames. Must be non-negative.

  • ds (int, optional) – Downsampling factor. Must be positive integer.

  • nsh (int, optional) – Number of shuffles for significance testing. Must be positive integer.

  • noise_const (float, optional) – Noise constant for numerical stability. Must be non-negative.

Raises:
  • TypeError – If parameters have incorrect types (non-integer for int params; non-numeric for noise_const).

  • ValueError – If parameters have invalid values (negative shift_window or noise_const; non-positive ds or nsh).

Return type:

None

Notes

This function validates parameter types using isinstance checks for numpy compatibility (accepts both Python int and numpy integer types).

Functions for validating INTENSE input parameters.

Functions

driada.intense.validation.validate_time_series_bunches(ts_bunch1, ts_bunch2)[source]

Validate time series bunches for INTENSE computations.

Parameters:
Raises:

ValueError – If bunches are empty, contain wrong types, or have mismatched lengths.

Return type:

None

driada.intense.validation.validate_metric(metric, allow_scipy=True)[source]

Validate metric name and check if it’s supported.

Parameters:
  • metric (str) –

    Metric name to validate. Supported metrics:

    • ’mi’: Mutual information (supports multivariate data)

    • ’av’: Activity ratio (requires one binary and one continuous variable)

    • ’fast_pearsonr’: Fast Pearson correlation implementation

    • ’spearmanr’, ‘pearsonr’, ‘kendalltau’: scipy.stats correlation functions

    • Any other callable from scipy.stats (if allow_scipy=True)

  • allow_scipy (bool, default=True) – Whether to allow scipy.stats correlation functions.

Returns:

metric_type – Type of metric:

  • ’mi’: Mutual information metric

  • ’special’: Special metrics (‘av’, ‘fast_pearsonr’)

  • ’scipy’: scipy.stats functions

Return type:

str

Raises:

ValueError – If metric is not supported or not a callable function in scipy.stats.

Notes

The function validates that scipy.stats attributes are callable to prevent accepting non-function attributes like constants or data arrays.

driada.intense.validation.validate_common_parameters(shift_window=None, ds=None, nsh=None, noise_const=None)[source]

Validate common INTENSE parameters.

Parameters:
  • shift_window (int, optional) – Maximum shift window in frames. Must be non-negative.

  • ds (int, optional) – Downsampling factor. Must be positive integer.

  • nsh (int, optional) – Number of shuffles for significance testing. Must be positive integer.

  • noise_const (float, optional) – Noise constant for numerical stability. Must be non-negative.

Raises:
  • TypeError – If parameters have incorrect types (non-integer for int params; non-numeric for noise_const).

  • ValueError – If parameters have invalid values (negative shift_window or noise_const; non-positive ds or nsh).

Return type:

None

Notes

This function validates parameter types using isinstance checks for numpy compatibility (accepts both Python int and numpy integer types).