scatcluster.analysis.predictions

Predictions analysis module.

Classes

Predictions

Module Contents

class scatcluster.analysis.predictions.Predictions[source]
identify_predicted_cluster_from_time_window(time_window: str) int[source]

Identify the predicted cluster from a provided Time Window

Parameters:

time_window (str) – Time window in “YYYY-MM-DD HH-MM-SSSS”

Raises:

ValueError – Incorrect time window provided

Returns:

Predicted cluster id

Return type:

int

df_times_for_predictions(n_clusters, cluster_rank=False) pandas.DataFrame[source]

Get a pandas dataframe with columns {‘times’,’predictions’} for the windowed seismograms and associated prediction

Parameters:
  • n_clusters (_type_) – The number of clusters for the predition

  • cluster_rank (bool, optional) – Whether to calculate the inter-cluster rank. Defaults to False.

Returns:

A pandas dataframe with columns {‘times’,’predictions’} for the windowed seismograms and predictions

Return type:

_type_

plot_prediction_occurance(n_clusters)[source]

Plots the occurrence of predictions in a scatter plot.

Parameters:

n_clusters (int) – The number of clusters.

preload_predictions(ica_n_components, n_clusters)[source]

Load precomputed predictions from a NumPy file.

Parameters:
  • ica_n_components (int) – The number of ICA components used for prediction.

  • n_clusters (int) – The number of clusters used for prediction.

Returns:

The loaded predictions.

Return type:

numpy.ndarray

Raises:

FileNotFoundError – If the specified file does not exist.