generated from PennLINC/paper-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
33 3 1 | ||
36 3 1 | ||
39 3 1 | ||
42 3 1 | ||
45 3 1 | ||
48 3 1 | ||
51 3 1 | ||
54 3 1 | ||
57 3 1 | ||
60 3 1 | ||
63 3 1 | ||
66 3 1 | ||
69 3 1 | ||
72 3 1 | ||
75 3 1 | ||
78 3 1 | ||
81 3 1 | ||
84 3 1 | ||
87 3 1 | ||
90 3 1 | ||
309 3 1 | ||
312 3 1 | ||
315 3 1 | ||
318 3 1 | ||
321 3 1 | ||
324 3 1 | ||
327 3 1 | ||
330 3 1 | ||
333 3 1 | ||
336 3 1 | ||
339 3 1 | ||
342 3 1 | ||
345 3 1 | ||
348 3 1 | ||
351 3 1 | ||
354 3 1 | ||
357 3 1 | ||
360 3 1 | ||
363 3 1 | ||
366 3 1 | ||
609 3 1 | ||
612 3 1 | ||
615 3 1 | ||
618 3 1 | ||
621 3 1 | ||
624 3 1 | ||
627 3 1 | ||
630 3 1 | ||
633 3 1 | ||
636 3 1 | ||
639 3 1 | ||
642 3 1 | ||
645 3 1 | ||
648 3 1 | ||
651 3 1 | ||
654 3 1 | ||
657 3 1 | ||
660 3 1 | ||
663 3 1 | ||
666 3 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
102 3 1 | ||
105 3 1 | ||
108 3 1 | ||
111 3 1 | ||
114 3 1 | ||
117 3 1 | ||
120 3 1 | ||
123 3 1 | ||
126 3 1 | ||
129 3 1 | ||
132 3 1 | ||
135 3 1 | ||
138 3 1 | ||
141 3 1 | ||
144 3 1 | ||
147 3 1 | ||
150 3 1 | ||
153 3 1 | ||
156 3 1 | ||
159 3 1 | ||
402 3 1 | ||
405 3 1 | ||
408 3 1 | ||
411 3 1 | ||
414 3 1 | ||
417 3 1 | ||
420 3 1 | ||
423 3 1 | ||
426 3 1 | ||
429 3 1 | ||
432 3 1 | ||
435 3 1 | ||
438 3 1 | ||
441 3 1 | ||
444 3 1 | ||
447 3 1 | ||
450 3 1 | ||
453 3 1 | ||
456 3 1 | ||
459 3 1 | ||
540 3 1 | ||
543 3 1 | ||
546 3 1 | ||
549 3 1 | ||
552 3 1 | ||
555 3 1 | ||
558 3 1 | ||
561 3 1 | ||
564 3 1 | ||
567 3 1 | ||
570 3 1 | ||
573 3 1 | ||
576 3 1 | ||
579 3 1 | ||
582 3 1 | ||
585 3 1 | ||
588 3 1 | ||
591 3 1 | ||
594 3 1 | ||
597 3 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
171 3 1 | ||
174 3 1 | ||
177 3 1 | ||
180 3 1 | ||
183 3 1 | ||
186 3 1 | ||
189 3 1 | ||
192 3 1 | ||
195 3 1 | ||
198 3 1 | ||
201 3 1 | ||
204 3 1 | ||
207 3 1 | ||
210 3 1 | ||
213 3 1 | ||
216 3 1 | ||
219 3 1 | ||
222 3 1 | ||
225 3 1 | ||
228 3 1 | ||
240 3 1 | ||
243 3 1 | ||
246 3 1 | ||
249 3 1 | ||
252 3 1 | ||
255 3 1 | ||
258 3 1 | ||
261 3 1 | ||
264 3 1 | ||
267 3 1 | ||
270 3 1 | ||
273 3 1 | ||
276 3 1 | ||
279 3 1 | ||
282 3 1 | ||
285 3 1 | ||
288 3 1 | ||
291 3 1 | ||
294 3 1 | ||
297 3 1 | ||
471 3 1 | ||
474 3 1 | ||
477 3 1 | ||
480 3 1 | ||
483 3 1 | ||
486 3 1 | ||
489 3 1 | ||
492 3 1 | ||
495 3 1 | ||
498 3 1 | ||
501 3 1 | ||
504 3 1 | ||
507 3 1 | ||
510 3 1 | ||
513 3 1 | ||
516 3 1 | ||
519 3 1 | ||
522 3 1 | ||
525 3 1 | ||
528 3 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pandas as pd | ||
from glob import glob | ||
|
||
# Parameters | ||
input_files = ["0back.txt", "1back.txt", "2back.txt", "instr.txt"] | ||
output_file = "task-fracback_acq-singleband_events.tsv" | ||
|
||
# Function to merge consecutive blocks | ||
def merge_blocks(df, trial_type): | ||
df = df.sort_values("onset").reset_index(drop=True) | ||
blocks = [] | ||
current_block = {"onset": df.loc[0, "onset"], "duration": df.loc[0, "duration"]} | ||
for i in range(1, len(df)): | ||
if df.loc[i, "onset"] == current_block["onset"] + current_block["duration"]: | ||
current_block["duration"] += df.loc[i, "duration"] | ||
else: | ||
blocks.append(current_block) | ||
current_block = {"onset": df.loc[i, "onset"], "duration": df.loc[i, "duration"]} | ||
blocks.append(current_block) | ||
return pd.DataFrame(blocks).assign(trial_type=trial_type) | ||
|
||
# Process all files and combine them | ||
all_events = [] | ||
for file in input_files: | ||
trial_type = file.split(".")[0] # Extract trial type from file name | ||
df = pd.read_csv(file, sep="\t", header=None, names=["onset", "duration", "ignore"]) | ||
merged_df = merge_blocks(df, trial_type) | ||
all_events.append(merged_df) | ||
|
||
# Combine all trial types and save to a BIDS-compatible file | ||
events = pd.concat(all_events).sort_values("onset").reset_index(drop=True) | ||
events.to_csv(output_file, sep="\t", index=False) | ||
|
||
print(f"Events file created: {output_file}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
24 3 1 | ||
27 3 1 | ||
30 3 1 | ||
93 3 1 | ||
96 3 1 | ||
99 3 1 | ||
162 3 1 | ||
165 3 1 | ||
168 3 1 | ||
231 3 1 | ||
234 3 1 | ||
237 3 1 | ||
300 3 1 | ||
303 3 1 | ||
306 3 1 | ||
393 3 1 | ||
396 3 1 | ||
399 3 1 | ||
462 3 1 | ||
465 3 1 | ||
468 3 1 | ||
531 3 1 | ||
534 3 1 | ||
537 3 1 | ||
600 3 1 | ||
603 3 1 | ||
606 3 1 |