make_dataset
make_dataset.py
This module provides a function to execute the full Merrypopins pipeline, from loading the dataset to preprocessing, locating pop-ins, and visualizing the results.
It integrates various methods for pop-in detection and saves the results as a DataFrame.
Provides:
- merrypopins_pipeline
: A function that orchestrates the entire process.
- Saves visualizations of the detected pop-ins.
- Returns a DataFrame with all annotations.
merrypopins_pipeline(txt_path, iforest_contamination=0.001, iforest_random_state=None, cnn_window_size=64, cnn_epochs=10, cnn_threshold_multiplier=5.0, cnn_batch_size=32, cnn_validation_split=0.0, fd_threshold=3.0, fd_spacing=1.0, savgol_window_length=11, savgol_polyorder=2, savgol_threshold=3.0, sg_deriv_order=1, stiffness_window=5, trim_edges_enabled=True, trim_margin=None, max_load_trim_enabled=True, use_iforest=True, use_cnn=True, use_fd=True, use_savgol=True, depth_col='Depth (nm)', load_col='Load (µN)', save_plot_dir=Path('visualisations'))
Executes the full Merrypopins pipeline: load -> preprocess -> locate -> visualize.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
txt_path
|
Path or str
|
Path to the indentation .txt file. |
required |
iforest_contamination
|
float
|
Contamination level for IsolationForest. |
0.001
|
iforest_random_state
|
int
|
Random seed for IsolationForest. |
None
|
cnn_window_size
|
int
|
CNN autoencoder window size. |
64
|
cnn_epochs
|
int
|
CNN training epochs. |
10
|
cnn_threshold_multiplier
|
float
|
Threshold multiplier for CNN. |
5.0
|
cnn_batch_size
|
int
|
Batch size for CNN training. |
32
|
cnn_validation_split
|
float
|
Fraction of data for validation. |
0.0
|
fd_threshold
|
float
|
Threshold for finite difference method. |
3.0
|
fd_spacing
|
float
|
Sampling interval for Fourier derivative. |
1.0
|
savgol_window_length
|
int
|
Window length for Savitzky-Golay filter. |
11
|
savgol_polyorder
|
int
|
Polynomial order for Savitzky-Golay. |
2
|
savgol_threshold
|
float
|
Threshold for Savitzky-Golay. |
3.0
|
sg_deriv_order
|
int
|
Derivative order for Savitzky-Golay. |
1
|
stiffness_window
|
int
|
Smoothing window for stiffness calculation. |
5
|
trim_edges_enabled
|
bool
|
Whether to trim pop-ins at curve edges. |
True
|
trim_margin
|
int
|
Margin to trim detections at beginning. |
None
|
max_load_trim_enabled
|
bool
|
Whether to trim pop-ins based on max load. |
True
|
use_iforest
|
bool
|
Enable IsolationForest detection. |
True
|
use_cnn
|
bool
|
Enable CNN detection. |
True
|
use_fd
|
bool
|
Enable Fourier detection. |
True
|
use_savgol
|
bool
|
Enable Savitzky-Golay detection. |
True
|
depth_col
|
str
|
Column name for depth. |
'Depth (nm)'
|
load_col
|
str
|
Column name for load. |
'Load (µN)'
|
save_plot_dir
|
Path
|
Directory where plots will be saved. |
Path('visualisations')
|
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
Final DataFrame with all annotations. |
Source code in src/merrypopins/make_dataset.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|