Skip to content

Bug/Enhancement: osl_ephys/source_recon/wrappers/ l.1612 fix_sign_ambiguities #393

@CarinaFo

Description

@CarinaFo

I have multiple subjects with multiple sessions and named the folders like this: subjectid_session, e.g. 199_1, 199_2, 199_3, 201_1 ....

I run the following code:

  # We create a list by looking for subjects that have a parc/parc-raw.fif file
  subjects = []
  for path in sorted(glob(f"{outdir}/*/parc/lcmv-parc-raw.fif")):
      subject = path.split("/")[-3]
      subjects.append(subject)    # e.g. ('161_1')

  # get only session 1 for now
  session_1_ids = [id for id in subjects if id.endswith("_1")]

  # Find a good template subject to align other subjects to
  template_id = find_template_subject(
      outdir, session_1_ids,  n_embeddings=15, standardize=True
  )

  # Settings for batch processing
  config = f"""
      source_recon:
      - fix_sign_ambiguity:
          template: {template_id}
          n_embeddings: 15
          standardize: True
          n_init: 3
          n_iter: 2500
          max_flips: 20
 """

This doesn't work because python (PEP 515) treats template_id in the source recon config as numeric and will remove the underscore.
I think it is nice to allow for underscores, they are usually pretty safe in python.
Packing the {template id} in quotation marks fixes the underscore issue.

template: '{template_id}'

Cheers,

Carina

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions