Skip to content

Commit

Permalink
[FIX] assert statements for channel selection
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamaedler committed Feb 2, 2025
1 parent f0538a5 commit 2f762bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/scportrait/pipeline/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from pathlib import Path
from alphabase.io import tempmmap

from typing import Union, List
from tqdm.auto import tqdm


Expand Down Expand Up @@ -1185,11 +1184,16 @@ def _check_config(self):
self.channel_selection = self.config["channel_selection"]

assert isinstance(
self.channel_selection, Union[int, List[int]]
self.channel_selection, (int, list)
), "channel_selection should be an integer or a list of integers"

if isinstance(self.channel_selection, int):
self.channel_selection = [self.channel_selection]
if isinstance(self.channel_selection, list):
assert all(isinstance(i, int) for i in self.channel_selection)
"channel_selection should be an integer or a list of integers"
assert len(self.channel_selection) in [1, 3]
"channel_selection should be either 1 or 3 channels"

def _load_model(self):
# lazy imports
Expand Down

0 comments on commit 2f762bf

Please sign in to comment.