Skip to content

Releases: donishadsmith/neurocaps

0.12.2

28 Jun 05:33
Compare
Choose a tag to compare

♻ Changed

  • When specified, allows runs parameter to be string, int, list of strings, or list of integers instead of just lists.
    Always ensures it is converted to list if integer or string.
  • Clarifies warning if tr not specified in TimeseriesExtractor by stating the tr is set to None and that extraction
    will continue.
  • For CAP.get_caps(), if runs is None, the self.runs property is just None instead of being set to "all". Only affects what
    is returned by self.runs when nothing is specified.

0.12.1.post2

28 Jun 03:18
Compare
Choose a tag to compare

💻 Metadata

  • Updates potential unsupported type hint included in the first .post, which is yanked.

0.12.1.post1

28 Jun 02:48
Compare
Choose a tag to compare

💻 Metadata

  • Additional type hint updates

0.12.1

28 Jun 01:45
Compare
Choose a tag to compare

♻ Changed

  • For merge_dicts sorts the run keys lexicographically so that subjects that don't have the earliest run-id in the
    first dictionary due to not having that run or the run being excluded still have ordered run keys in the merged
    dictionary.

💻 Metadata

  • Updates runs parameters type hints so that it is known that strings can be used to0.

0.12.0

26 Jun 21:57
Compare
Choose a tag to compare
  • Entails some code cleaning and verification to ensure that the code cleaned for clarity purposes produces the same
    results.

🚀 New/Added

  • Davies Bouldin and Variance Ratio (Calinski Harabasz) added

♻ Changed

  • For CAPs.calculate_metrics() if performing an analysis on groups where each group has a different number of CAPs, then for "temporal_fraction",
    "persistence", and "counts", "nan" values will be seen for CAP numbers that exceed the group's number of CAPs.
    • For instance, if group "A" has 2 CAPs but group "B" has 4 CAPs, the DataFrame will contain columns for CAP-1,
      CAP-2, CAP-3, and CAP-4. However, for all members in group "A", CAP-3 and CAP-4 will contain "nan" values to
      indicate that these CAPs are not applicable to the group. This differentiation helps distinguish between CAPs
      that are not applicable to the group and CAPs that are applicable but had zero instances for a specific member.

🐛 Fixes

  • Adds error earlier when tr is not specified or able to be retrieved form the bold metadata when the condition is specified
    instead of allowing the pipeline to produce this error later.
  • Fixed issue with show_figs in CAP.caps2surf() showing figure when set to False.

0.11.3

25 Jun 00:58
Compare
Choose a tag to compare

♻ Changed

  • With parallel processing, joblib outputs are now returned as a generator as opposed to the default, which is a list,
    to reduce memory usage

0.11.2

24 Jun 02:41
Compare
Choose a tag to compare

♻ Changed

  • Changed how ids are organized in respective group when initializing the CAP class. In version 0.11.1, the ids are
    sorted lexicographically:
self._groups[group] = sorted(list(set(self._groups[group])))

This doesn't affect functionality but it may be better to respect the original user ordering.This is no longer the case.

0.11.1

23 Jun 08:08
Compare
Choose a tag to compare

🐛 Fixes

  • Fix for python 3.12 when using CAP.caps2surf().
    • Changes in pathlib.py in Python 3.12 results in an error message format change. The error message now includes
      quotes (e.g., "not 'Nifti1Image'") instead of the previous format without quotes ("not Nifti1Image"). This issue
      arises when using neuromaps.transforms.mni_to_fslr within CAP.caps2surf() as neuromaps captures the error as a
      string and checks if "not Nifti1Image" is in the string to determine if the input is a NifTI image. As a patch,
      if the error occurs, a temporary .nii.gz file is created, the statistical image is saved to this file, and it is
      used as input for neuromaps.transforms.mni_to_fslr. The temporary file is deleted after use. Below is the code
      implementing this fix.
# Fix for python 3.12, saving stat_map so that it is path instead of a NifTI
try:
    gii_lh, gii_rh = mni152_to_fslr(stat_map, method=method, fslr_density=fslr_density)
except TypeError:
    # Create temp
    temp_nifti = tempfile.NamedTemporaryFile(delete=False, suffix=".nii.gz")
    warnings.warn(textwrap.dedent(f"""
                    Error potentially due to change in pathlib.py in python 3.12 causing the error
                    message to output as "not 'Nifti1Image'" instead of "not Nifti1Image", which
                    neuromaps uses to determine if the input is a Nifti1Image object.
                    Converting stat_map into a temporary nii.gz file (which will be automatically
                    deleted afterwards) at {temp_nifti.name}
                    """))
    # Ensure file is closed
    temp_nifti.close()
    # Save temporary nifti to temp file
    nib.save(stat_map, temp_nifti.name)
    gii_lh, gii_rh = mni152_to_fslr(temp_nifti.name, method=method, fslr_density=fslr_density)
    # Delete
    os.unlink(temp_nifti.name)
  • Final patch is for strings in triple quotes. The standard textwrap module is used to remove the indentations at each
    new line.

0.11.0.post2

22 Jun 20:53
Compare
Choose a tag to compare

[0.11.0.post2] - 2024-06-22

💻 Metadata

  • Very minor explanation added to CAP.calculate_metrics() regarding using individual dictionaries from merged
    dictionaries as inputs.

[0.11.0.post1] - 2024-06-22

💻 Metadata

  • Two docstring changes for merge_dicts, which includes nesting the return type hint and capitalizing all letters of
    the docstring header for aesthetics.

[0.11.0] - 2024-06-22

🚀 New/Added

  • Added new function change_dtype to make it easier to change the dtypes of each subject's numpy array to assist with
    memory usage, especially if doing the CAPs analysis on a local machine.
  • Added new parameters - output_dir, file_name, and return_dict tostandardizeto save dictionary, the return_dict` defaults to True.
  • Adds a new version attribute so you can check the current version using neurocaps.__version__

♻ Changed

  • Adds back python 3.12 classifier. The CAP.caps2surf() function may still not work well but if its detected that
    neurocaps is being installed using python 3.12, setuptools is installed to prevent the pkgresources error.

🐛 Fixes

  • Minor fix for file_name parameter in merge_dicts. If user does not supply a file_name when saving the dictionary,
    it will provide a default file_name now instead of producing a Nonetype error.

💻 Metadata

  • Minor docstrings revisions, mostly to the typehint for subject_timeseries.

0.11.0.post1

22 Jun 05:04
Compare
Choose a tag to compare

[0.11.0.post1] - 2024-06-22

💻 Metadata

  • Two docstring changes for merge_dicts, which includes nesting the return type hint and capitalizing all letters of
    the docstring header for aesthetics.

[0.11.0] - 2024-06-22

🚀 New/Added

  • Added new function change_dtype to make it easier to change the dtypes of each subject's numpy array to assist with
    memory usage, especially if doing the CAPs analysis on a local machine.
  • Added new parameters - output_dir, file_name, and return_dict tostandardizeto save dictionary, the return_dict` defaults to True.
  • Adds a new version attribute so you can check the current version using neurocaps.__version__

♻ Changed

  • Adds back python 3.12 classifier. The CAP.caps2surf() function may still not work well but if its detected that
    neurocaps is being installed using python 3.12, setuptools is installed to prevent the pkgresources error.

🐛 Fixes

  • Minor fix for file_name parameter in merge_dicts. If user does not supply a file_name when saving the dictionary,
    it will provide a default file_name now instead of producing a Nonetype error.

💻 Metadata

  • Minor docstrings revisions, mostly to the typehint for subject_timeseries.