Neurocaps

Latest version: v0.21.0

Safety actively analyzes 693883 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 19

0.17.8

🚀 New/Added
- For `TimeseriesExtractor.get_bold()`, a new `parallel_log_config` parameter has been added to pass an instance of
`multiprocessing.Manager.Queue` to redirect logs if parallel processing is used.
♻ Changed
- For `TimeseriesExtractor.get_bold()`, logging of additional subject-specific messages are also controlled by `verbose`.

0.17.7

🚀 New/Added
- Added `vmin` and `vmin` kwargs for `transition_matrix` and `CAP.caps2corr`.
🐛 Fixes
- Fix issue with x and y labels for `CAP.caps2plot` not changing in size when `xticklabels_size` and
`yticklabels_size` modified.

0.17.6

🚀 New/Added
- Added "n_before" and "n_after" subkeys for when `fd_threshold` is a dictionary. This the frame exceeding the
fd threshold to be scrubbed including an additional "n" number of frames before or after the exceeding frame to also
be scrubbed.
🐛 Fixes
- Log message that specifies certain confounds not found is now set as a warning instead of info. Additionally, there
is no Nonetype error if zero confounds are found in the data frame.
- Fix that appears to have only affected Windows where the system defined a default root handler (stderr) after the
top level loggers were initialized. This caused loggers initialized inside functions, such as `_extract_timeseries`
to adopt this root handler and timeseries extraction logs had a slightly different formatting. This is now fixed with
the following internal code.

python
"""Internal logging function and class for flushing"""

import logging, sys

Global variables to determine if a handler is user defined or defined by OS
_USER_ROOT_HANDLER = None
_USER_MODULE_HANDLERS = {}


class _Flush(logging.StreamHandler):
def emit(self, record):
super().emit(record)
self.flush()


def _logger(name, flush=False, top_level=True):
global _USER_ROOT_HANDLER, _USER_MODULE_HANDLERS

logger = logging.getLogger(name.split(".")[-1])

Windows appears to assign stderr has the root handler after the top level loggers are assigned, which causes
any loggers not assigned at top level to adopt this handler. Global variable used to assess if the base root
handler is user defined or assigned by the system
if top_level == True:
_USER_ROOT_HANDLER = logging.getLogger().hasHandlers()
_USER_MODULE_HANDLERS[logger.name] = logging.getLogger(logger.name).hasHandlers()

if not logger.level:
logger.setLevel(logging.INFO)

Check if user defined root handler or assigned a specific handler for module
default_handlers = _USER_ROOT_HANDLER or _USER_MODULE_HANDLERS[logger.name]

Works to see if root has handler and propagate if it does
logger.propagate = True if _USER_ROOT_HANDLER else False

Add or messages will repeat several times due to multiple handlers if same name used
if not default_handlers and not (logger.name == "_extract_timeseries" and top_level):
If no user specified default handler, any handler is assigned by OS and is cleared
if logger.name == "_extract_timeseries":
logger.handlers.clear()

if flush:
handler = _Flush(sys.stdout)
else:
handler = logging.StreamHandler(sys.stdout)

handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
logger.addHandler(handler)

return logger

0.17.5

🚀 New/Added
- Added `dtype` parameter to `TimeseriesExtractor` with default set to None. This parameter is passed to nilearn's
`load_img` function.
♻ Changed
- Some speed increase if calling `TimeseriesExtractor.get_bold` multiple times in the same script. New internal function
uses `functools` `cache` when calling `BIDSLayout` now.

python
staticmethod
cache
def _call_layout(bids_dir, pipeline_name):
try:
import bids
except ModuleNotFoundError:
raise ModuleNotFoundError(
"This function relies on the pybids package to query subject-specific files. "
"If on Windows, pybids does not install by default to avoid long path error issues "
"during installation. Try using `pip install pybids` or `pip install neurocaps[windows]`."
)

bids_dir = os.path.normpath(bids_dir).rstrip(os.path.sep)

if bids_dir.endswith("derivatives"):
bids_dir = os.path.dirname(bids_dir)

if pipeline_name:
pipeline_name = os.path.normpath(pipeline_name).lstrip(os.path.sep).rstrip(os.path.sep)
if pipeline_name.startswith("derivatives"):
pipeline_name = pipeline_name[len("derivatives") :].lstrip(os.path.sep)
layout = bids.BIDSLayout(bids_dir, derivatives=os.path.join(bids_dir, "derivatives", pipeline_name))
else:
layout = bids.BIDSLayout(bids_dir, derivatives=True)

LG.info(f"{layout}")

return layout

0.17.4

- `CAP.caps2radar` test for Github Actions added due to this [action](https://github.com/coactions/setup-xvfb)
resolving the VTK issue. Test only for Linux. Now all functions are tested on Github Actions.
🐛 Fixes
- `CAP.caps2radar` uses try except block to show figures and should be able to display and close figures in a
Jupyter notebook or python CL.
- In `CAP.caps2radar` "round" kwarg was never used in code and was removed.
- When tick values are not specified in the `radialaxis` kwargs in `CAP.caps2radar` function, default tick values
no longer produces an error and now does the following:

python
if "tickvals" not in plot_dict["radialaxis"] and "range" not in plot_dict["radialaxis"]:
default_ticks = [max_value / 4, max_value / 2, 3 * max_value / 4, max_value]
plot_dict["radialaxis"]["tickvals"] = [round(x, 2) for x in default_ticks]

♻ Changed
- To prevent numerical stability issues when scaling, previous versions did the following when the standard deviation
for a column was essentially zero:

python
std = np.std(arr, axis=0, ddof=1)
eps = np.finfo(np.float64).eps

0.17.3

🐛 Fixes
- Fixes specific error that occurs when using a suffix name and saving nifti in `CAP.caps2surf`.

Page 6 of 19

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.