/ concept-collection / ephys_compression_tests
Sign in
concept-collection / ephys_compression_tests
43 lines · 1.4 KBCodeBlameHistory
fc3d0a6initialJeremy Magland 1from typing import List
4def is_compatible(algorithm_tags: List[str], dataset_tags: List[str]) -> bool:
5 """Check if an algorithm is compatible with a dataset based on their tags.
7 Args:
8 algorithm_tags: List of tags for the algorithm
9 dataset_tags: List of tags for the dataset
11 Returns:
12 True if the algorithm should be applied to the dataset
13 """
14 # If algorithm has delta_encoding or lpc_prediction, dataset must have continuous, timeseries, 1d, integer
15 if "delta_encoding" in algorithm_tags or "lpc_prediction" in algorithm_tags:
16 if (
17 "correlated" not in dataset_tags
18 or "timeseries" not in dataset_tags
19 or "1d" not in dataset_tags
20 or "integer" not in dataset_tags
21 ):
22 return False
24 # If algorithm has zero_rle, dataset must have sparse, timeseries, 1d
25 if "zero_rle" in algorithm_tags:
26 if (
27 "sparse" not in dataset_tags
28 or "timeseries" not in dataset_tags
29 or "1d" not in dataset_tags
30 ):
31 return False
33 # If algorithm has integer, dataset must have integer
34 if "integer" in algorithm_tags:
35 if "integer" not in dataset_tags:
36 return False
38 # If algorithm has "no_bernoulli", dataset must not have "bernoulli"
39 if "no_bernoulli" in algorithm_tags:
40 if "bernoulli" in dataset_tags:
41 return False
43 return True
moveopenescclose