Coverage for nilearn/_utils/fmriprep_confounds.py: 18%

13 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-16 12:32 +0200

1"""Misc utilities for function nilearn.interfaces.fmriprep.load_confounds.""" 

2 

3 

4def flag_single_gifti(img_files): 

5 """Test if the paired input files are giftis.""" 

6 # Possibly two gifti; if file is not correct, will be caught 

7 if isinstance(img_files[0], list): 

8 return False 

9 

10 flag_single_gifti = [] # gifti in pairs 

11 for img in img_files: 

12 ext = ".".join(img.split(".")[-2:]) 

13 flag_single_gifti.append(ext == "func.gii") 

14 return all(flag_single_gifti) 

15 

16 

17def is_camel_case(s): 

18 """Check if the given string is in camel case.""" 

19 return s != s.lower() and s != s.upper() and "_" not in s 

20 

21 

22def to_camel_case(snake_str): 

23 """Convert camel to snake case.""" 

24 components = snake_str.split("_") 

25 return components[0] + "".join(x.title() for x in components)