Skip to content

Commit a477b17

Browse files
committed
avoid deprecation warning
1 parent 7621cfb commit a477b17

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

niworkflows/viz/utils.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -550,15 +550,15 @@ def plot_melodic_components(melodic_dir, in_file, tr=None,
550550
row = int(i / 2)
551551
l_row = row * 2
552552

553-
if noise_components:
554-
if (i + 1) in noise_components:
555-
color_title = color_time = color_power = 'r'
556-
else:
557-
color_title = color_time = color_power = 'g'
558-
else:
559-
color_title = 'k'
560-
color_time = current_palette[0]
561-
color_power = current_palette[1]
553+
# Set default colors
554+
color_title = 'k'
555+
color_time = current_palette[0]
556+
color_power = current_palette[1]
557+
558+
if noise_components.size > 0:
559+
# If a noise components list is provided, assign red/green
560+
color_title = color_time = color_power = (
561+
'r' if (i + 1) in noise_components else 'g')
562562

563563
data = img.get_data()
564564
for j in range(3):

0 commit comments

Comments
 (0)