Skip to content

Commit 33ed7c9

Browse files
committed
Update README.md to reflect changes in orchestrator.run_pipeline output format and processing details
1 parent dab03b4 commit 33ed7c9

1 file changed

Lines changed: 32 additions & 25 deletions

File tree

README.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -105,30 +105,37 @@ from graphomotor.core import orchestrator
105105
input_file = "path/to/your/spiral_data.csv"
106106

107107
# Option 1: Process file without saving any CSV file
108-
# Only return the features dictionary
109-
features = orchestrator.run_pipeline(
108+
# Only return the DataFrame with extracted features
109+
features_df = orchestrator.run_pipeline(
110110
input_path=input_file
111111
)
112112

113113
# Option 2: Save to a directory with auto-generated filename
114114
# Creates a CSV file with auto-generated name in the specified directory
115-
# Format: {participant_id}_{task}_{hand}_features_{YYYYMMDD}.csv
116-
features = orchestrator.run_pipeline(
115+
# Format: {participant_id}_{task}_{hand}_features_{YYYYMMDD_HHMM}.csv
116+
features_df = orchestrator.run_pipeline(
117117
input_path=input_file,
118118
output_path="path/to/output/directory"
119119
)
120120

121121
# Option 3: Save to a specific CSV file
122122
# Features will be saved to the specified file path
123-
features = orchestrator.run_pipeline(
123+
features_df = orchestrator.run_pipeline(
124124
input_path=input_file,
125125
output_path="path/to/features.csv"
126126
)
127127

128-
# Features are returned as a dictionary in all cases
129-
print(f"Successfully extracted {len(features)} features:")
130-
for feature_name, value in features.items():
131-
print(f"{feature_name}: {value}")
128+
# Features are returned as a pandas DataFrame with source file as index
129+
print(f"Successfully processed {len(features_df)} file")
130+
print(f"Extracted features: {list(features_df.columns)}")
131+
132+
# Access the single file's data (features_df has one row)
133+
file_path = features_df.index[0]
134+
print(f"File: {file_path}")
135+
print(f"Participant: {features_df.loc[file_path, 'participant_id']}")
136+
print(f"Task: {features_df.loc[file_path, 'task']}")
137+
print(f"Hand: {features_df.loc[file_path, 'hand']}")
138+
print(f"Duration: {features_df.loc[file_path, 'duration']}")
132139
```
133140

134141
#### Batch Processing
@@ -141,43 +148,43 @@ input_dir = "path/to/your/spiral_data_directory"
141148

142149
# Option 1: Process files without saving any CSV files
143150
# Only return the DataFrame with extracted features
144-
features = orchestrator.run_pipeline(
151+
features_df = orchestrator.run_pipeline(
145152
input_path=input_dir,
146153
)
147154

148-
# Option 2: Save individual CSV files for each processed file
149-
# Creates separate CSV files with auto-generated names in the specified directory
150-
# Format: {participant_id}_{task}_{hand}_features_{YYYYMMDD}.csv
151-
features = orchestrator.run_pipeline(
155+
# Option 2: Save to a directory with auto-generated filename
156+
# Creates a single consolidated CSV file with auto-generated name
157+
# Format: batch_features_{YYYYMMDD_HHMM}.csv
158+
features_df = orchestrator.run_pipeline(
152159
input_path=input_dir,
153160
output_path="path/to/output/directory"
154161
)
155162

156163
# Option 3: Save to a specific CSV file (single consolidated file)
157164
# All features will be written to one specified file
158-
features = orchestrator.run_pipeline(
165+
features_df = orchestrator.run_pipeline(
159166
input_path=input_dir,
160167
output_path="path/to/consolidated_features.csv"
161168
)
162169

163170
# Features are returned as a pandas DataFrame with source files as index
164-
# Columns include: participant_id, task, hand, and calculated features
165-
print(f"Successfully processed {len(features)} files")
171+
# Columns include: participant_id, task, hand, start_time, and calculated features
172+
print(f"Successfully processed {len(features_df)} files")
166173

167174
# Access metadata and features for a specific file
168-
for file_path in features.index:
175+
for file_path in features_df.index:
169176
print(f"File: {file_path}")
170-
print(f"Participant: {features.loc[file_path, 'participant_id']}")
171-
print(f"Task: {features.loc[file_path, 'task']}")
172-
print(f"Hand: {features.loc[file_path, 'hand']}")
173-
print(f"Duration: {features.loc[file_path, 'duration']}")
177+
print(f"Participant: {features_df.loc[file_path, 'participant_id']}")
178+
print(f"Task: {features_df.loc[file_path, 'task']}")
179+
print(f"Hand: {features_df.loc[file_path, 'hand']}")
180+
print(f"Duration: {features_df.loc[file_path, 'duration']}")
174181

175182
# Or work with the DataFrame directly
176-
print(f"Mean duration across all files: {features['duration'].astype(float).mean()}")
177-
print(f"Spiral with highest linear velocity: {features['linear_velocity_median'].astype(float).idxmax()}")
183+
print(f"Mean duration across all files: {features_df['duration'].astype(float).mean()}")
184+
print(f"Spiral with highest linear velocity: {features_df['linear_velocity_median'].astype(float).idxmax()}")
178185

179186
# Easy filtering and grouping by metadata
180-
print(f"Files with dominant hand: {len(features[features['hand'] == 'Dom'])}")
187+
print(f"Files with dominant hand: {len(features_df[features_df['hand'] == 'Dom'])}")
181188
```
182189

183190
For detailed configuration options and additional parameters, refer to the [`run_pipeline` documentation](https://childmindresearch.github.io/graphomotor/graphomotor/core/orchestrator.html#run_pipeline).

0 commit comments

Comments
 (0)