Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multi-run workflow synchronized with BIDS dataset #219

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
65f314b
Start working on BIDS dataset-based multi-run converter.
tsalo May 8, 2020
69fecdb
Add some code. Not good code, but code.
tsalo May 8, 2020
7c169c5
Fix style issues.
tsalo May 8, 2020
1b198c4
Get synchronize_onsets basically working.
tsalo May 9, 2020
c0367c4
Add duration determination.
tsalo May 9, 2020
bd736e4
Minor refactor.
tsalo May 10, 2020
223adb1
More documentation.
tsalo May 12, 2020
7b262ba
Some more fixes.
tsalo May 12, 2020
7191a3e
Fix bugs and include echo keyword.
tsalo May 12, 2020
d15ad97
More flexible trigger channel selection for debugging.
tsalo May 18, 2020
eb46a71
More progress on multi-run conversion.
tsalo Jun 18, 2020
a5aad49
Merge remote-tracking branch 'physiopy/master' into enh/bids-multi-run
tsalo Jun 18, 2020
8591332
Merge pull request #1 from physiopy/master
tsalo Jul 3, 2020
9a5ce3b
Workflow is working now.
tsalo Jul 3, 2020
26f8aae
Fix style issues.
tsalo Jul 3, 2020
18f2831
Reorganize and improve documentation.
tsalo Jul 3, 2020
40fe26b
Fix bugs.
tsalo Jul 4, 2020
568d6aa
Use physio object instead of file.
tsalo Jul 4, 2020
4c3809c
Add requirements.
tsalo Jul 4, 2020
f0222cb
Add plotting function for QC.
tsalo Jul 4, 2020
b597880
fix.
tsalo Jul 4, 2020
d9d03fb
Reorganize functions and generalize update_bids_name.
tsalo Jul 8, 2020
92c99e8
Fix style issue.
tsalo Jul 8, 2020
17dfa07
Update.
tsalo Jul 19, 2020
40d792f
Merge branch 'master' into enh/bids-multi-run
tsalo Jul 19, 2020
cd1dea5
Get trigger update and resampling working.
tsalo Jul 19, 2020
233bb11
Update requirements.
tsalo Jul 19, 2020
8eaa407
Merge branch 'master' into enh/bids-multi-run
tsalo Oct 8, 2020
56f0ad0
Run black on files.
tsalo Oct 10, 2020
bb8166f
Move test of function I'd renamed.
tsalo Oct 10, 2020
428dd9f
Fix style issues.
tsalo Oct 10, 2020
bc7698a
Update conversion.py
tsalo Oct 10, 2020
2c7438f
Merge branch 'master' into enh/bids-multi-run
tsalo Jan 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
356 changes: 261 additions & 95 deletions phys2bids/bids.py

Large diffs are not rendered by default.

457 changes: 457 additions & 0 deletions phys2bids/conversion.py

Large diffs are not rendered by default.

32 changes: 2 additions & 30 deletions phys2bids/phys2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,6 @@ def print_summary(filename, ntp_expected, ntp_found, samp_freq, time_offset, out
utils.write_file(outfile, '.log', summary)


def print_json(outfile, samp_freq, time_offset, ch_name):
"""
Print the json required by BIDS format.

Parameters
----------
outfile: str or path
Fullpath to output file.
samp_freq: float
Frequency of sampling for the output file.
time_offset: float
Difference between beginning of file and first TR.
ch_name: list of str
List of channel names, as specified by BIDS format.

Notes
-----
Outcome:
outfile: .json file
File containing information for BIDS.
"""
start_time = -time_offset
summary = dict(SamplingFrequency=samp_freq,
StartTime=round(start_time, 4),
Columns=ch_name)
utils.write_json(outfile, summary, indent=4, sort_keys=False)


@due.dcite(
Doi('10.5281/zenodo.3470091'),
path='phys2bids',
Expand Down Expand Up @@ -430,8 +402,8 @@ def phys2bids(filename, info=False, indir='.', outdir='.', heur_file=None,
LGR.info(f'Exporting files for run {run} freq {uniq_freq}')
np.savetxt(phys_out[key].filename + '.tsv.gz',
phys_out[key].timeseries, fmt='%.8e', delimiter='\t')
print_json(phys_out[key].filename, phys_out[key].freq,
phys_out[key].start_time, phys_out[key].ch_name)
utils.save_json(phys_out[key].filename, phys_out[key].freq,
phys_out[key].start_time, phys_out[key].ch_name)
print_summary(filename, num_timepoints_expected,
phys_in[run].num_timepoints_found, uniq_freq,
phys_out[key].start_time,
Expand Down
Loading