From 3e01f18639423b6df2a3a24f4f2559ec6185e0c6 Mon Sep 17 00:00:00 2001 From: Horea Christian Date: Thu, 25 Apr 2024 19:29:38 -0400 Subject: [PATCH] Improved formatting --- nwb2bids/base.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/nwb2bids/base.py b/nwb2bids/base.py index 028d0cf..67f14f6 100644 --- a/nwb2bids/base.py +++ b/nwb2bids/base.py @@ -112,11 +112,22 @@ def reposit(in_dir, out_dir): for var in ("contacts", "probes", "channels"): var_metadata = metadata[var] var_metadata = drop_false_keys(var_metadata) - var_metadata_file_path = os.path.join(out_dir, subject_id, session_id, "ephys", subject_id + "_" + var + ".tsv") + var_metadata_file_path = os.path.join( + out_dir, + subject_id, + session_id, + "ephys", + f"{subject_id}_{var}.tsv") write_tsv(var_metadata, var_metadata_file_path) - bids_path = f"{out_dir}/{metadata['subject']['subject_id']}/{metadata['session']['session_id']}/ephys/{metadata['subject']['subject_id']}_{metadata['session']['session_id']}_ephys.nwb" - shutil.copyfile(nwb_file, bids_path) + bids_path = os.path.join( + out_dir, + metadata['subject']['subject_id'], + metadata['session']['session_id'], + "ephys", + f"{metadata['subject']['subject_id']}_{metadata['session']['session_id']}_ephys.nwb" + ) + shutil.copyfile(nwb_file, bids_path_)