contraction_net.annotation
Classes
Class to annotate contraction intervals in multiple time-series files and save the results. |
Functions
|
Split a time-series trace into smaller chunks and save them to separate files. |
Module Contents
- class contraction_net.annotation.TimeSeriesAnnotator(file_list, output_dir, figsize=(11, 3.5))[source]
Class to annotate contraction intervals in multiple time-series files and save the results.
This class allows users to interactively annotate the start and end of contractions in time-series data by clicking on the plot. The user can press the left mouse button at the start of a contraction interval and release at the end of the contraction interval. The results are saved to a specified output directory.
- Parameters:
file_list (list of str) – List of file paths to the time-series data files to be annotated.
output_dir (str) – Directory where the output files with annotated contraction intervals will be saved.
figsize (tuple, optional) – Figure size in inches.
Notes
In an interactive Jupyter notebook, add the following before running the TimeSeriesAnnotator:
` matplotlib.use('nbagg') %matplotlib notebook `
- file_list
- output_dir
- current_file_index = 0
- start_contraction = []
- end_contraction = []
- save_button
- reset_button
- contraction_net.annotation.split_trace(filepath, output_dir, chunk_size=512, p=1)[source]
Split a time-series trace into smaller chunks and save them to separate files.
- Parameters:
filepath (str) – Path to the input time-series data file.
output_dir (str) – Directory where the output chunk files will be saved.
chunk_size (int, optional) – The size of each chunk, by default 512.
p (float, optional) – Probability of saving each chunk, by default 1 (save all chunks).