Skip to content

Commit ec77e5c

Browse files
committed
Refactor run_pipeline function to improve docstring clarity and set default values for output_path and feature_categories
1 parent dac5c1b commit ec77e5c

1 file changed

Lines changed: 30 additions & 20 deletions

File tree

src/graphomotor/core/orchestrator.py

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -213,32 +213,42 @@ def extract_features(
213213

214214
def run_pipeline(
215215
input_path: pathlib.Path | str,
216-
output_path: pathlib.Path | str | None,
217-
feature_categories: list[FeatureCategories],
216+
output_path: pathlib.Path | str | None = None,
217+
feature_categories: list[FeatureCategories] = [
218+
"duration",
219+
"velocity",
220+
"hausdorff",
221+
"AUC",
222+
],
218223
config_params: dict[str, float | int] | None = None,
219224
) -> dict[str, str]:
220-
"""Run the Graphomotor pipeline to extract features from spiral drawing data.
225+
"""Run the Graphomotor pipeline to extract features from spiral drawings.
221226
222227
Args:
223-
input_path: Path to the input CSV file containing spiral drawing data.
224-
output_path: Path where extracted features will be saved. Three behaviors are
225-
possible:
226-
- If None: Features are calculated but not saved to disk.
227-
- If path includes file extension (e.g., "/path/to/output.csv"): This exact
228-
file path is used.
229-
- If path has no file extension (e.g., "/path/to/output"): A file is
230-
created in that directory with auto-generated filename:
231-
"/path/to/output/{participant_id}_{task}_{hand}_features_{date}.csv".
232-
feature_categories: List of feature categories to extract. Options are:
233-
- "duration": Extract task duration.
234-
- "velocity": Extract velocity-based metrics.
235-
- "hausdorff": Extract Hausdorff distance metrics.
236-
- "AUC": Extract area under the curve metric.
237-
config_params: Optional configuration parameters for spiral drawing. If None,
238-
default parameters are used.
228+
input_path: Path to the input CSV file with spiral drawing data.
229+
output_path: Path to save extracted features. If None, features aren't saved. If
230+
path has an extension, features are saved to that file. If path points to a
231+
directory, a file is created with participant ID, task, hand, and date in
232+
the filename.
233+
feature_categories: Feature categories to extract. Defaults to all available
234+
categories:
235+
- "duration": Task duration
236+
- "velocity": Velocity-based metrics
237+
- "hausdorff": Hausdorff distance metrics
238+
- "AUC": Area under the curve metric
239+
config_params: Optional dictionary with custom spiral configuration parameters.
240+
These parameters control reference spiral generation and spiral centering.
241+
If None, default parameters are used. Supported parameters are:
242+
- "center_x": X-coordinate of the spiral center. Default is 50.
243+
- "center_y": Y-coordinate of the spiral center. Default is 50.
244+
- "start_radius": Starting radius of the spiral. Default is 0.
245+
- "growth_rate": Growth rate of the spiral. Default is 1.075.
246+
- "start_angle": Starting angle of the spiral. Default is 0.
247+
- "end_angle": Ending angle of the spiral. Default is 8π.
248+
- "num_points": Number of points in the spiral. Default is 10000.
239249
240250
Returns:
241-
Dictionary containing the extracted features.
251+
Dictionary of extracted features.
242252
"""
243253
logger.info("Starting Graphomotor pipeline")
244254
logger.info(f"Input path: {input_path}")

0 commit comments

Comments
 (0)