project_name
string
class_name
string
class_modifiers
string
class_implements
int64
class_extends
int64
function_name
string
function_body
string
cyclomatic_complexity
int64
NLOC
int64
num_parameter
int64
num_token
int64
num_variable
int64
start_line
int64
end_line
int64
function_index
int64
function_params
string
function_variable
string
function_return_type
string
function_body_line_type
string
function_num_functions
int64
function_num_lines
int64
outgoing_function_count
int64
outgoing_function_names
string
incoming_function_count
int64
incoming_function_names
string
lexical_representation
string
CAREamics_careamics
public
public
0
0
get_device
def get_device() -> str:"""Get the device on which operations take place.Returns-------strThe device on which operations take place, e.g. "cuda", "cpu" or "mps"."""if torch.cuda.is_available():device = "cuda"elif torch.backends.mps.is_available() and platform.processor() in ("arm","arm64",):device = "mps"else:device = ...
4
11
0
53
1
20
39
20
['device']
str
{"Assign": 3, "Expr": 1, "If": 2, "Return": 1}
3
20
3
["torch.cuda.is_available", "torch.backends.mps.is_available", "platform.processor"]
6
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.get_single_file_mmse", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.get_...
The function (get_device) defined within the public class called public.The function start at line 20 and ends at 39. It contains 11 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called insi...
CAREamics_careamics
public
public
0
0
filter_parameters
def filter_parameters(func: type,user_params: dict,) -> dict:"""Filter parameters according to the function signature.Parameters----------func : typeClass object.user_params : dictUser provided parameters.Returns-------dictParameters matching `func`'s signature."""# Get the list of all default parametersdefault_params ...
2
7
2
60
2
42
67
42
func,user_params
['default_params', 'params_to_be_used']
dict
{"Assign": 2, "Expr": 1, "Return": 1}
6
26
6
["list", "parameters.keys", "inspect.signature", "set", "user_params.keys", "set"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.config.optimizer_models_py.LrSchedulerModel.filter_parameters", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.config.optimizer_mo...
The function (filter_parameters) defined within the public class called public.The function start at line 42 and ends at 67. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [42.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions ca...
CAREamics_careamics
public
public
0
0
get_optimizer
def get_optimizer(name: str) -> torch.optim.Optimizer:"""Return the optimizer class given its name.Parameters----------name : strOptimizer name.Returns-------torch.nn.OptimizerOptimizer class."""if name not in SupportedOptimizer:raise NotImplementedError(f"Optimizer {name} is not yet supported.")return getattr(torch.op...
2
4
1
35
0
70
87
70
name
[]
torch.optim.Optimizer
{"Expr": 1, "If": 1, "Return": 1}
2
18
2
["NotImplementedError", "getattr"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3659638_climbsrocks_auto_ml.auto_ml.utils_models_py.make_deep_learning_classifier", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3659638_climbsrocks_auto_ml.auto_ml.utils_models_py.make_deep_learning_model", "_.con...
The function (get_optimizer) defined within the public class called public.The function start at line 70 and ends at 87. It contains 4 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions called in...
CAREamics_careamics
public
public
0
0
get_optimizers
def get_optimizers() -> dict[str, str]:"""Return the list of all optimizers available in torch.optim.Returns-------dictOptimizers available in torch.optim."""optims = {}for name, obj in inspect.getmembers(torch.optim):if inspect.isclass(obj) and issubclass(obj, torch.optim.Optimizer):if name != "Optimizer":optims[name]...
5
7
0
62
1
90
104
90
['optims']
dict[str, str]
{"Assign": 2, "Expr": 1, "For": 1, "If": 2, "Return": 1}
3
15
3
["inspect.getmembers", "inspect.isclass", "issubclass"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.utils.test_torch_utils_py.test_get_optimizers_exist"]
The function (get_optimizers) defined within the public class called public.The function start at line 90 and ends at 104. It contains 7 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions called ...
CAREamics_careamics
public
public
0
0
get_scheduler
def get_scheduler(name: str,) -> Union[# torch.optim.lr_scheduler.LRScheduler,torch.optim.lr_scheduler.ReduceLROnPlateau,
1
4
1
18
0
107
111
107
name
[]
Union[torch.optim.lr_scheduler.ReduceLROnPlateau,]
{"Expr": 1, "If": 1, "Return": 1}
2
23
2
["NotImplementedError", "getattr"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70411573_eleutherai_oslo.oslo.transformers.trainer_py.Trainer.create_scheduler", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.dataset_ng.lightning_modules.unet_m...
The function (get_scheduler) defined within the public class called public.The function start at line 107 and ends at 111. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, It has 2.0 functions called ...
CAREamics_careamics
public
public
0
0
get_schedulers
def get_schedulers() -> dict[str, str]:"""Return the list of all schedulers available in torch.optim.lr_scheduler.Returns-------dictSchedulers available in torch.optim.lr_scheduler."""schedulers = {}for name, obj in inspect.getmembers(torch.optim.lr_scheduler):if inspect.isclass(obj) and issubclass(obj, torch.optim.lr_...
6
11
0
78
1
132
150
132
['schedulers']
dict[str, str]
{"Assign": 3, "Expr": 1, "For": 1, "If": 3, "Return": 1}
3
19
3
["inspect.getmembers", "inspect.isclass", "issubclass"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.utils.test_torch_utils_py.test_get_schedulers_exist"]
The function (get_schedulers) defined within the public class called public.The function start at line 132 and ends at 150. It contains 11 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value. It declares 3.0 functions, It has 3.0 functions calle...
CAREamics_careamics
public
public
0
0
get_careamics_version
def get_careamics_version() -> str:"""Get clean CAREamics version.This method returns the latest `Major.Minor.Patch` version of CAREamics, removingany local version identifier.Returns-------strClean CAREamics version."""parts = __version__.split(".")# for local installs that do not detect the latest versions via tags# ...
2
13
0
69
2
10
38
10
['clean_version', 'parts']
str
{"Assign": 3, "Expr": 2, "If": 1, "Return": 1}
4
29
4
["__version__.split", "join", "logger.warning", "join"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.model_io.bioimage.bioimage_utils_py.create_env_text", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.model_io.bmz_io_py.export_to_...
The function (get_careamics_version) defined within the public class called public.The function start at line 10 and ends at 38. It contains 13 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions ...
CAREamics_careamics
public
public
0
0
gaussian_likelihood_params
def gaussian_likelihood_params():return {"predict_logvar": "pixelwise", "logvar_lowerbound": -5}
1
2
0
15
0
13
14
13
[]
Returns
{"Return": 1}
0
2
0
[]
0
[]
The function (gaussian_likelihood_params) defined within the public class called public.The function start at line 13 and ends at 14. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value..
CAREamics_careamics
public
public
0
0
create_tiff
def create_tiff(path: Path, n_files: int):"""Create tiff files for testing."""if not path.exists():path.mkdir()for i in range(n_files):file_path = path / f"file_{i}.tif"file_path.touch()
3
6
2
44
1
19
26
19
path,n_files
['file_path']
None
{"Assign": 1, "Expr": 3, "For": 1, "If": 1}
4
8
4
["path.exists", "path.mkdir", "range", "file_path.touch"]
0
[]
The function (create_tiff) defined within the public class called public.The function start at line 19 and ends at 26. It contains 6 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [19.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions cal...
CAREamics_careamics
public
public
0
0
minimum_algorithm_n2v
def minimum_algorithm_n2v() -> dict:"""Create a minimum algorithm dictionary.Returns-------dictA minimum algorithm example."""# create dictionaryalgorithm = {"algorithm": "n2v","loss": "n2v","model": {"architecture": "UNet",},}return algorithm
1
9
0
30
1
30
47
30
['algorithm']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
0
18
0
[]
0
[]
The function (minimum_algorithm_n2v) defined within the public class called public.The function start at line 30 and ends at 47. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
minimum_algorithm_supervised
def minimum_algorithm_supervised() -> dict:"""Create a minimum algorithm dictionary.Returns-------dictA minimum algorithm example."""# create dictionaryalgorithm = {"algorithm": "n2n","loss": "mae","model": {"architecture": "UNet",},}return algorithm
1
9
0
30
1
51
68
51
['algorithm']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
0
18
0
[]
0
[]
The function (minimum_algorithm_supervised) defined within the public class called public.The function start at line 51 and ends at 68. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
minimum_algorithm_musplit
def minimum_algorithm_musplit() -> dict:"""Create a minimum algorithm dictionary.Returns-------dictA minimum algorithm example."""# create dictionaryalgorithm = {"algorithm_type": "vae","algorithm": "musplit",# TODO temporary"loss": "musplit","model": {"architecture": "LVAE","z_dims": (128, 128, 128),"multiscale_count"...
1
16
0
61
1
73
97
73
['algorithm']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
0
25
0
[]
0
[]
The function (minimum_algorithm_musplit) defined within the public class called public.The function start at line 73 and ends at 97. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
minimum_algorithm_denoisplit
def minimum_algorithm_denoisplit() -> dict:"""Create a minimum algorithm dictionary.Returns-------dictA minimum algorithm example."""# create dictionaryalgorithm = {"algorithm_type": "vae","algorithm": "denoisplit","loss": "denoisplit","model": {"architecture": "LVAE","z_dims": (128, 128, 128),"multiscale_count": 2,},"...
1
14
0
64
1
102
124
102
['algorithm']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
0
23
0
[]
0
[]
The function (minimum_algorithm_denoisplit) defined within the public class called public.The function start at line 102 and ends at 124. It contains 14 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
minimum_algorithm_microsplit
def minimum_algorithm_microsplit() -> dict:"""Create a minimum MicroSplit algorithm dictionary.Returns-------dictA minimum MicroSplit algorithm example."""# create dictionaryalgorithm = {"algorithm": "microsplit","loss": "microsplit","model": {"architecture": "LVAE","z_dims": (128, 128, 128),"multiscale_count": 2,"pred...
1
15
0
57
1
128
151
128
['algorithm']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
0
24
0
[]
0
[]
The function (minimum_algorithm_microsplit) defined within the public class called public.The function start at line 128 and ends at 151. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
minimum_data
def minimum_data() -> dict:"""Create a minimum data dictionary.Returns-------dictA minimum data example."""# create dictionarydata = {"data_type": SupportedData.ARRAY.value,"patch_size": [8, 8],"axes": "YX",}return data
1
7
0
33
1
155
170
155
['data']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
0
16
0
[]
0
[]
The function (minimum_data) defined within the public class called public.The function start at line 155 and ends at 170. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
minimum_inference
def minimum_inference() -> dict:"""Create a minimum inference dictionary.Returns-------dictA minimum data example."""# create dictionarypredic = {"data_type": SupportedData.ARRAY.value,"axes": "YX","image_means": [2.0],"image_stds": [1.0],}return predic
1
8
0
41
1
174
190
174
['predic']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
0
17
0
[]
0
[]
The function (minimum_inference) defined within the public class called public.The function start at line 174 and ends at 190. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
minimum_training
def minimum_training() -> dict:"""Create a minimum training dictionary.Returns-------dictA minimum training example."""# create dictionarytraining = {"lightning_trainer_config": {"max_epochs": 1},}return training
1
5
0
21
1
194
207
194
['training']
dict
{"Assign": 1, "Expr": 1, "Return": 1}
0
14
0
[]
0
[]
The function (minimum_training) defined within the public class called public.The function start at line 194 and ends at 207. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
minimum_n2v_configuration
def minimum_n2v_configuration(minimum_algorithm_n2v: dict, minimum_data: dict, minimum_training: dict) -> dict:"""Create a minimum configuration dictionary.Parameters----------tmp_path : PathTemporary path for testing.minimum_algorithm : dictMinimum algorithm configuration.minimum_data_n2v : dictMinimum N2V data config...
2
17
3
97
2
211
249
211
minimum_algorithm_n2v,minimum_data,minimum_training
['mask_pixel_perc', 'configuration']
dict
{"Assign": 5, "Expr": 1, "If": 1, "Return": 1}
3
39
3
["np.prod", "np.ceil", "np.prod"]
0
[]
The function (minimum_n2v_configuration) defined within the public class called public.The function start at line 211 and ends at 249. It contains 17 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [211.0] and does not return any value. It declares 3.0 functions, and It has...
CAREamics_careamics
public
public
0
0
minimum_supervised_configuration
def minimum_supervised_configuration(minimum_algorithm_supervised: dict, minimum_data: dict, minimum_training: dict) -> dict:configuration = {"experiment_name": "LevitatingFrog","algorithm_config": minimum_algorithm_supervised,"training_config": minimum_training,"data_config": minimum_data,}return configuration
1
10
3
39
1
253
263
253
minimum_algorithm_supervised,minimum_data,minimum_training
['configuration']
dict
{"Assign": 1, "Return": 1}
0
11
0
[]
0
[]
The function (minimum_supervised_configuration) defined within the public class called public.The function start at line 253 and ends at 263. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [253.0] and does not return any value..
CAREamics_careamics
public
public
0
0
ordered_array._ordered_array
def _ordered_array(shape: tuple, dtype=int) -> np.ndarray:"""An array with ordered values.Parameters----------shape : tupleShape of the array.Returns-------np.ndarrayArray with ordered values."""return np.arange(np.prod(shape), dtype=dtype).reshape(shape).astype(np.float32)
1
2
2
44
0
270
283
270
null
[]
None
null
0
0
0
null
0
null
The function (ordered_array._ordered_array) defined within the public class called public.The function start at line 270 and ends at 283. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [270.0] and does not return any value..
CAREamics_careamics
public
public
0
0
ordered_array
def ordered_array() -> Callable:"""A function that returns an array with ordered values."""def _ordered_array(shape: tuple, dtype=int) -> np.ndarray:"""An array with ordered values.Parameters----------shape : tupleShape of the array.Returns-------np.ndarrayArray with ordered values."""return np.arange(np.prod(shape), d...
1
3
0
11
0
267
285
267
[]
Callable
{"Expr": 2, "Return": 2}
4
19
4
["astype", "reshape", "np.arange", "np.prod"]
39
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset.patching.test_random_patching_py.test_random_patching_unsupervised", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset.test_in_memory...
The function (ordered_array) defined within the public class called public.The function start at line 267 and ends at 285. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, It has 4.0 functions called ...
CAREamics_careamics
public
public
0
0
array_2D
def array_2D() -> np.ndarray:"""A 2D array with shape (1, 3, 10, 9).Returns-------np.ndarray2D array with shape (1, 3, 10, 9)."""return np.arange(90 * 3).reshape((1, 3, 10, 9))
1
2
0
31
0
289
297
289
[]
np.ndarray
{"Expr": 1, "Return": 1}
2
9
2
["reshape", "np.arange"]
0
[]
The function (array_2D) defined within the public class called public.The function start at line 289 and ends at 297. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called ...
CAREamics_careamics
public
public
0
0
array_3D
def array_3D() -> np.ndarray:"""A 3D array with shape (1, 3, 5, 10, 9).Returns-------np.ndarray3D array with shape (1, 3, 5, 10, 9)."""return np.arange(2048 * 3).reshape((1, 3, 8, 16, 16))
1
2
0
33
0
301
309
301
[]
np.ndarray
{"Expr": 1, "Return": 1}
2
9
2
["reshape", "np.arange"]
0
[]
The function (array_3D) defined within the public class called public.The function start at line 301 and ends at 309. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions called ...
CAREamics_careamics
public
public
0
0
patch_size
def patch_size() -> tuple[int, int]:return (64, 64)
1
2
0
17
0
313
314
313
[]
tuple[int, int]
{"Return": 1}
0
2
0
[]
0
[]
The function (patch_size) defined within the public class called public.The function start at line 313 and ends at 314. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
overlaps
def overlaps() -> tuple[int, int]:return (32, 32)
1
2
0
17
0
318
319
318
[]
tuple[int, int]
{"Return": 1}
0
2
0
[]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.78400723_sagemath_sagetrac_mirror.src.sage.rings.polynomial.complex_roots_py.intervals_disjoint", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.78400723_sagemath_sagetrac_mirror.src.sage.rings.qqbar_py.AlgebraicNumb...
The function (overlaps) defined within the public class called public.The function start at line 318 and ends at 319. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 4.0 functions calling this function which are ["_.con...
CAREamics_careamics
public
public
0
0
pre_trained
def pre_trained(tmp_path, minimum_n2v_configuration):"""Fixture to create a pre-trained CAREamics model."""# training datatrain_array = np.arange(32 * 32).reshape((32, 32)).astype(np.float32)# create configurationconfig = Configuration(**minimum_n2v_configuration)config.data_config.axes = "YX"config.data_config.batch_s...
1
12
2
114
3
323
345
323
tmp_path,minimum_n2v_configuration
['train_array', 'config', 'careamist']
Returns
{"AnnAssign": 1, "Assign": 7, "Expr": 2, "Return": 1}
7
23
7
["astype", "reshape", "np.arange", "Configuration", "CAREamist", "careamist.train", "pre_trained_path.exists"]
0
[]
The function (pre_trained) defined within the public class called public.The function start at line 323 and ends at 345. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [323.0], and this function return a value. It declares 7.0 functions, and It has 7.0 funct...
CAREamics_careamics
public
public
0
0
pre_trained_bmz
def pre_trained_bmz(tmp_path, pre_trained) -> Path:"""Fixture to create a BMZ model."""# training datatrain_array = np.ones((32, 32), dtype=np.float32)# instantiate CAREamistcareamist = CAREamist(source=pre_trained, work_dir=tmp_path)# predict (no tiling and no tta)predicted_output = careamist.predict(train_array, tta_...
1
19
2
141
5
349
376
349
tmp_path,pre_trained
['predicted', 'train_array', 'careamist', 'path', 'predicted_output']
Path
{"Assign": 5, "Expr": 2, "Return": 1}
6
28
6
["np.ones", "CAREamist", "careamist.predict", "np.concatenate", "export_to_bmz", "path.exists"]
0
[]
The function (pre_trained_bmz) defined within the public class called public.The function start at line 349 and ends at 376. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [349.0] and does not return any value. It declares 6.0 functions, and It has 6.0 funct...
CAREamics_careamics
public
public
0
0
create_dummy_noise_model
def create_dummy_noise_model(n_gaussians: int = 3,n_coeffs: int = 3,) -> None:weights = np.random.rand(3 * n_gaussians, n_coeffs)nm_dict = {"trained_weight": weights,"min_signal": np.array([0]),"max_signal": np.array([2**16 - 1]),"min_sigma": 0.125,}return nm_dict
1
12
2
74
2
380
391
380
n_gaussians,n_coeffs
['weights', 'nm_dict']
None
{"Assign": 2, "Return": 1}
3
12
3
["np.random.rand", "np.array", "np.array"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.test_LVAE_lightning_module_py.create_vae_lightning_model", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.test_LVAE_lightning_...
The function (create_dummy_noise_model) defined within the public class called public.The function start at line 380 and ends at 391. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [380.0] and does not return any value. It declares 3.0 functions, It has 3.0 f...
CAREamics_careamics
public
public
0
0
minimum_lvae_params
def minimum_lvae_params():return {"input_shape": (64, 64),"output_channels": 2,"multiscale_count": 1,"encoder_conv_strides": [2, 2],"decoder_conv_strides": [2, 2],"z_dims": [128, 128, 128, 128],"encoder_n_filters": 64,"decoder_n_filters": 64,"encoder_dropout": 0.1,"decoder_dropout": 0.1,"nonlinearity": "ELU","predict_l...
1
16
0
83
0
395
410
395
[]
Returns
{"Return": 1}
0
16
0
[]
0
[]
The function (minimum_lvae_params) defined within the public class called public.The function start at line 395 and ends at 410. It contains 16 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value..
CAREamics_careamics
public
public
0
0
random_array
def random_array(shape: tuple[int, ...], seed: int = 42):"""Return a random array with values between 0 and 255."""rng = np.random.default_rng(seed)return (rng.integers(0, 255, shape)).astype(np.float32)
1
3
2
49
1
19
22
19
shape,seed
['rng']
Returns
{"Assign": 1, "Expr": 1, "Return": 1}
3
4
3
["np.random.default_rng", "astype", "rng.integers"]
27
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.test_careamist_py.test_add_custom_callback", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.test_careamist_py.test_batched_prediction", "_.content...
The function (random_array) defined within the public class called public.The function start at line 19 and ends at 22. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [19.0], and this function return a value. It declares 3.0 functions, It has 3.0 functions cal...
CAREamics_careamics
public
public
0
0
test_no_parameters
def test_no_parameters():"""Test that CAREamics cannot be instantiated without parameters."""with pytest.raises(TypeError):CAREamist()
1
3
0
16
0
25
28
25
[]
None
{"Expr": 2, "With": 1}
2
4
2
["pytest.raises", "CAREamist"]
0
[]
The function (test_no_parameters) defined within the public class called public.The function start at line 25 and ends at 28. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions...
CAREamics_careamics
public
public
0
0
test_minimum_configuration_via_object
def test_minimum_configuration_via_object(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can be instantiated with a minimum configuration object."""# create configurationconfig = Configuration(**minimum_n2v_configuration)# instantiate CAREamistCAREamist(source=config, work_dir=tmp_path)
1
5
2
29
1
31
39
31
tmp_path,minimum_n2v_configuration
['config']
None
{"Assign": 1, "Expr": 2}
2
9
2
["Configuration", "CAREamist"]
0
[]
The function (test_minimum_configuration_via_object) defined within the public class called public.The function start at line 31 and ends at 39. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [31.0] and does not return any value. It declares 2.0 functions, and...
CAREamics_careamics
public
public
0
0
test_minimum_configuration_via_path
def test_minimum_configuration_via_path(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can be instantiated with a path to a minimumconfiguration."""# create configurationconfig = Configuration(**minimum_n2v_configuration)path_to_config = save_configuration(config, tmp_path)# instantiate CAREami...
1
6
2
33
2
42
53
42
tmp_path,minimum_n2v_configuration
['config', 'path_to_config']
None
{"Assign": 2, "Expr": 2}
3
12
3
["Configuration", "save_configuration", "CAREamist"]
0
[]
The function (test_minimum_configuration_via_path) defined within the public class called public.The function start at line 42 and ends at 53. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [42.0] and does not return any value. It declares 3.0 functions, and ...
CAREamics_careamics
public
public
0
0
test_train_error_target_unsupervised_algorithm
def test_train_error_target_unsupervised_algorithm(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that an error is raised when a target is provided for N2V."""# create configurationconfig = Configuration(**minimum_n2v_configuration)config.algorithm_config.algorithm = SupportedAlgorithm.N2V.value# train error ...
1
24
2
163
2
56
87
56
tmp_path,minimum_n2v_configuration
['config', 'careamics']
None
{"Assign": 6, "Expr": 4, "With": 3}
13
32
13
["Configuration", "CAREamist", "pytest.raises", "careamics.train", "pytest.raises", "careamics.train", "str", "str", "CAREamist", "pytest.raises", "careamics.train", "np.ones", "np.ones"]
0
[]
The function (test_train_error_target_unsupervised_algorithm) defined within the public class called public.The function start at line 56 and ends at 87. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [56.0] and does not return any value. It declares 13.0 fun...
CAREamics_careamics
public
public
0
0
test_train_single_array_no_val
def test_train_single_array_no_val(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can be trained with arrays."""# training datatrain_array = random_array((32, 32))# create configurationconfig = Configuration(**minimum_n2v_configuration)config.data_config.axes = "YX"config.data_config.batch_size...
1
19
2
149
3
91
121
91
tmp_path,minimum_n2v_configuration
['train_array', 'config', 'careamist']
None
{"Assign": 7, "Expr": 3}
8
31
8
["random_array", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_single_array_no_val) defined within the public class called public.The function start at line 91 and ends at 121. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [91.0] and does not return any value. It declares 8.0 functions, and It ...
CAREamics_careamics
public
public
0
0
test_train_array
def test_train_array(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can be trained on arrays."""# training datatrain_array = random_array((32, 32))val_array = random_array((32, 32))# create configurationconfig = Configuration(**minimum_n2v_configuration)config.data_config.axes = "YX"config.data...
4
38
2
274
7
125
183
125
tmp_path,minimum_n2v_configuration
['config', 'non_last_checkpoints', 'last_ckpt_exists', 'train_array', 'checkpoint_files', 'careamist', 'val_array']
None
{"Assign": 13, "Expr": 3}
16
59
16
["random_array", "random_array", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "list", "glob", "len", "len", "any", "len", "len", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_array) defined within the public class called public.The function start at line 125 and ends at 183. It contains 38 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [125.0] and does not return any value. It declares 16.0 functions, and It has 16.0 fu...
CAREamics_careamics
public
public
0
0
test_train_array_channel
def test_train_array_channel(tmp_path: Path, minimum_n2v_configuration: dict, independent_channels: bool):"""Test that CAREamics can be trained on arrays with channels."""# training datatrain_array = random_array((32, 32, 3))val_array = random_array((32, 32, 3))# create configurationconfig = Configuration(**minimum_n2v...
1
26
3
208
4
188
225
188
tmp_path,minimum_n2v_configuration,independent_channels
['train_array', 'config', 'careamist', 'val_array']
None
{"Assign": 11, "Expr": 3}
10
38
10
["random_array", "random_array", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists", "pytest.mark.parametrize"]
0
[]
The function (test_train_array_channel) defined within the public class called public.The function start at line 188 and ends at 225. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [188.0] and does not return any value. It declares 10.0 functions, and It has...
CAREamics_careamics
public
public
0
0
test_train_array_3d
def test_train_array_3d(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can be trained on 3D arrays."""# training datatrain_array = random_array((8, 32, 32))val_array = random_array((8, 32, 32))# create configurationminimum_n2v_configuration["data_config"]["axes"] = "ZYX"minimum_n2v_configuratio...
1
20
2
173
4
229
260
229
tmp_path,minimum_n2v_configuration
['train_array', 'config', 'careamist', 'val_array']
None
{"Assign": 8, "Expr": 3}
9
32
9
["random_array", "random_array", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_array_3d) defined within the public class called public.The function start at line 229 and ends at 260. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [229.0] and does not return any value. It declares 9.0 functions, and It has 9.0 f...
CAREamics_careamics
public
public
0
0
test_train_tiff_files_in_memory_no_val
def test_train_tiff_files_in_memory_no_val(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can be trained with tiff files in memory."""# training datatrain_array = random_array((32, 32))# save filestrain_file = tmp_path / "train.tiff"tifffile.imwrite(train_file, train_array)# create configuratio...
1
23
2
162
4
264
300
264
tmp_path,minimum_n2v_configuration
['train_array', 'train_file', 'careamist', 'config']
None
{"Assign": 8, "Expr": 4}
9
37
9
["random_array", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_tiff_files_in_memory_no_val) defined within the public class called public.The function start at line 264 and ends at 300. It contains 23 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [264.0] and does not return any value. It declares 9.0 functions...
CAREamics_careamics
public
public
0
0
test_train_tiff_files_in_memory
def test_train_tiff_files_in_memory(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can be trained with tiff files in memory."""# training datatrain_array = random_array((32, 32))val_array = random_array((32, 32))# save filestrain_file = tmp_path / "train.tiff"tifffile.imwrite(train_file, train_...
1
24
2
189
6
304
342
304
tmp_path,minimum_n2v_configuration
['train_file', 'config', 'val_file', 'train_array', 'careamist', 'val_array']
None
{"Assign": 10, "Expr": 5}
11
39
11
["random_array", "random_array", "tifffile.imwrite", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_tiff_files_in_memory) defined within the public class called public.The function start at line 304 and ends at 342. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [304.0] and does not return any value. It declares 11.0 functions, and ...
CAREamics_careamics
public
public
0
0
test_train_tiff_files
def test_train_tiff_files(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can be trained with tiff files by deactivatingthe in memory dataset."""# training datatrain_array = random_array((32, 32))val_array = random_array((32, 32))# save filestrain_file = tmp_path / "train.tiff"tifffile.imwrite(t...
1
24
2
193
6
346
386
346
tmp_path,minimum_n2v_configuration
['train_file', 'config', 'val_file', 'train_array', 'careamist', 'val_array']
None
{"Assign": 10, "Expr": 5}
11
41
11
["random_array", "random_array", "tifffile.imwrite", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_tiff_files) defined within the public class called public.The function start at line 346 and ends at 386. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [346.0] and does not return any value. It declares 11.0 functions, and It has 11...
CAREamics_careamics
public
public
0
0
test_train_array_supervised
def test_train_array_supervised(tmp_path: Path, minimum_supervised_configuration: dict):"""Test that CAREamics can be trained with arrays."""# training datatrain_array = random_array((32, 32))val_array = random_array((32, 32))train_target = random_array((32, 32))val_target = random_array((32, 32))# create configuration...
1
27
2
192
6
390
428
390
tmp_path,minimum_supervised_configuration
['config', 'train_target', 'val_target', 'train_array', 'careamist', 'val_array']
None
{"Assign": 10, "Expr": 3}
11
39
11
["random_array", "random_array", "random_array", "random_array", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_array_supervised) defined within the public class called public.The function start at line 390 and ends at 428. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [390.0] and does not return any value. It declares 11.0 functions, and It ...
CAREamics_careamics
public
public
0
0
test_train_tiff_files_in_memory_supervised
def test_train_tiff_files_in_memory_supervised(tmp_path: Path, minimum_supervised_configuration: dict):"""Test that CAREamics can be trained with tiff files in memory."""# training datatrain_array = random_array((32, 32))val_array = random_array((32, 32))train_target = random_array((32, 32))val_target = random_array((3...
1
41
2
266
12
432
489
432
tmp_path,minimum_supervised_configuration
['images', 'train_file', 'train_target', 'val_file', 'train_target_file', 'config', 'val_target', 'val_target_file', 'train_array', 'careamist', 'targets', 'val_array']
None
{"Assign": 16, "Expr": 9}
17
58
17
["random_array", "random_array", "random_array", "random_array", "images.mkdir", "tifffile.imwrite", "tifffile.imwrite", "targets.mkdir", "tifffile.imwrite", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_tiff_files_in_memory_supervised) defined within the public class called public.The function start at line 432 and ends at 489. It contains 41 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [432.0] and does not return any value. It declares 17.0 func...
CAREamics_careamics
public
public
0
0
test_train_tiff_files_supervised
def test_train_tiff_files_supervised(tmp_path: Path, minimum_supervised_configuration: dict):"""Test that CAREamics can be trained with tiff files by deactivatingthe in memory dataset."""# training datatrain_array = random_array((32, 32))val_array = random_array((32, 32))train_target = random_array((32, 32))val_target ...
1
42
2
270
12
493
553
493
tmp_path,minimum_supervised_configuration
['images', 'train_file', 'train_target', 'val_file', 'train_target_file', 'config', 'val_target', 'val_target_file', 'train_array', 'careamist', 'targets', 'val_array']
None
{"Assign": 16, "Expr": 9}
17
61
17
["random_array", "random_array", "random_array", "random_array", "images.mkdir", "tifffile.imwrite", "tifffile.imwrite", "targets.mkdir", "tifffile.imwrite", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "exists", "Path", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_train_tiff_files_supervised) defined within the public class called public.The function start at line 493 and ends at 553. It contains 42 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [493.0] and does not return any value. It declares 17.0 functions, and...
CAREamics_careamics
public
public
0
0
test_predict_on_array_tiled
def test_predict_on_array_tiled(tmp_path: Path, minimum_n2v_configuration: dict, batch_size, samples):"""Test that CAREamics can predict on arrays."""# training datatrain_array = random_array((samples, 32, 32))# create configurationconfig = Configuration(**minimum_n2v_configuration)config.data_config.axes = "SYX"config...
1
27
4
194
4
559
598
559
tmp_path,minimum_n2v_configuration,batch_size,samples
['train_array', 'config', 'careamist', 'predicted']
None
{"Assign": 8, "Expr": 3}
11
40
11
["random_array", "Configuration", "CAREamist", "careamist.train", "careamist.predict", "np.concatenate", "reshape_array", "careamist.export_to_bmz", "exists", "pytest.mark.parametrize", "pytest.mark.parametrize"]
0
[]
The function (test_predict_on_array_tiled) defined within the public class called public.The function start at line 559 and ends at 598. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [559.0] and does not return any value. It declares 11.0 functions, and It ...
CAREamics_careamics
public
public
0
0
test_predict_arrays_no_tiling
def test_predict_arrays_no_tiling(tmp_path: Path, minimum_n2v_configuration: dict, batch_size, samples):"""Test that CAREamics can predict on arrays without tiling."""# training datatrain_array = random_array((samples, 32, 32))# create configurationconfig = Configuration(**minimum_n2v_configuration)config.data_config.a...
1
25
4
178
4
604
641
604
tmp_path,minimum_n2v_configuration,batch_size,samples
['train_array', 'config', 'careamist', 'predicted']
None
{"Assign": 8, "Expr": 3}
11
38
11
["random_array", "Configuration", "CAREamist", "careamist.train", "careamist.predict", "np.concatenate", "reshape_array", "careamist.export_to_bmz", "exists", "pytest.mark.parametrize", "pytest.mark.parametrize"]
0
[]
The function (test_predict_arrays_no_tiling) defined within the public class called public.The function start at line 604 and ends at 641. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [604.0] and does not return any value. It declares 11.0 functions, and I...
CAREamics_careamics
public
public
0
0
test_batched_prediction
def test_batched_prediction(tmp_path: Path, minimum_n2v_configuration: dict):"Compare outputs when a batch size of 1 or 2 is used"tile_size = (16, 16)tile_overlap = (4, 4)shape = (32, 32)train_array = random_array(shape)# create configurationconfig = Configuration(**minimum_n2v_configuration)config.data_config.axes = "...
1
19
2
140
8
650
678
650
tmp_path,minimum_n2v_configuration
['config', 'tile_size', 'pred_bs_1', 'shape', 'tile_overlap', 'train_array', 'careamist', 'pred_bs_2']
None
{"Assign": 11, "Expr": 2}
8
29
8
["random_array", "Configuration", "CAREamist", "careamist.train", "careamist.predict", "careamist.predict", "np.array_equal", "pytest.mark.skip"]
0
[]
The function (test_batched_prediction) defined within the public class called public.The function start at line 650 and ends at 678. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [650.0] and does not return any value. It declares 8.0 functions, and It has 8...
CAREamics_careamics
public
public
0
0
test_predict_tiled_channel
def test_predict_tiled_channel(tmp_path: Path,minimum_n2v_configuration: dict,independent_channels: bool,batch_size: int,):"""Test that CAREamics can be trained on arrays with channels."""# training datatrain_array = random_array((3, 32, 32))val_array = random_array((3, 32, 32))# create configurationconfig = Configurat...
1
25
4
191
5
684
719
684
tmp_path,minimum_n2v_configuration,independent_channels,batch_size
['config', 'predicted', 'train_array', 'careamist', 'val_array']
None
{"Assign": 12, "Expr": 2}
10
36
10
["random_array", "random_array", "Configuration", "CAREamist", "careamist.train", "careamist.predict", "np.concatenate", "reshape_array", "pytest.mark.parametrize", "pytest.mark.parametrize"]
0
[]
The function (test_predict_tiled_channel) defined within the public class called public.The function start at line 684 and ends at 719. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [684.0] and does not return any value. It declares 10.0 functions, and It h...
CAREamics_careamics
public
public
0
0
test_predict_path
def test_predict_path(tmp_path: Path, minimum_n2v_configuration: dict, batch_size, n_samples, tiled):"""Test that CAREamics can predict with tiff files."""# training datatrain_array = random_array((32, 32))# save filesfor i in range(n_samples):train_file = tmp_path / f"train_{i}.tiff"tifffile.imwrite(train_file, train_...
5
40
5
249
7
726
782
726
tmp_path,minimum_n2v_configuration,batch_size,n_samples,tiled
['train_file', 'config', 'tile_size', 'predicted', 'tile_overlap', 'train_array', 'careamist']
None
{"Assign": 13, "Expr": 4, "For": 2, "If": 2}
15
57
15
["random_array", "range", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "careamist.predict", "isinstance", "p.squeeze", "predicted.squeeze", "careamist.export_to_bmz", "exists", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize"]
0
[]
The function (test_predict_path) defined within the public class called public.The function start at line 726 and ends at 782. It contains 40 lines of code and it has a cyclomatic complexity of 5. It takes 5 parameters, represented as [726.0] and does not return any value. It declares 15.0 functions, and It has 15.0 f...
CAREamics_careamics
public
public
0
0
test_predict_pretrained_checkpoint
def test_predict_pretrained_checkpoint(tmp_path: Path, pre_trained: Path):"""Test that CAREamics can be instantiated with a pre-trained network and predicton an array."""# prediction datasource_array = random_array((32, 32))# instantiate CAREamistcareamist = CAREamist(source=pre_trained, work_dir=tmp_path)assert caream...
1
10
2
90
3
786
804
786
tmp_path,pre_trained
['predicted', 'source_array', 'careamist']
None
{"Assign": 3, "Expr": 1}
5
19
5
["random_array", "CAREamist", "careamist.predict", "np.concatenate", "reshape_array"]
0
[]
The function (test_predict_pretrained_checkpoint) defined within the public class called public.The function start at line 786 and ends at 804. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [786.0] and does not return any value. It declares 5.0 functions, an...
CAREamics_careamics
public
public
0
0
test_predict_pretrained_bmz
def test_predict_pretrained_bmz(tmp_path: Path, pre_trained_bmz: Path):"""Test that CAREamics can be instantiated with a BMZ archive and predict."""# prediction datasource_array = random_array((32, 32))# instantiate CAREamistcareamist = CAREamist(source=pre_trained_bmz, work_dir=tmp_path)# predictpredicted = careamist....
1
8
2
68
3
808
823
808
tmp_path,pre_trained_bmz
['predicted', 'source_array', 'careamist']
None
{"Assign": 3, "Expr": 1}
5
16
5
["random_array", "CAREamist", "careamist.predict", "np.concatenate", "reshape_array"]
0
[]
The function (test_predict_pretrained_bmz) defined within the public class called public.The function start at line 808 and ends at 823. It contains 8 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [808.0] and does not return any value. It declares 5.0 functions, and It ha...
CAREamics_careamics
public
public
0
0
test_export_bmz_pretrained_prediction
def test_export_bmz_pretrained_prediction(tmp_path: Path, pre_trained: Path):"""Test that CAREamics can be instantiated with a pre-trained network and exportedto BMZ after prediction.In this case, the careamist extracts the BMZ test data from the predictiondatamodule."""# instantiate CAREamistcareamist = CAREamist(sour...
1
14
2
106
3
827
851
827
tmp_path,pre_trained
['_', 'source_array', 'careamist']
None
{"Assign": 3, "Expr": 2}
7
25
7
["CAREamist", "random_array", "careamist.predict", "len", "careamist.pred_datamodule.predict_dataloader", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_export_bmz_pretrained_prediction) defined within the public class called public.The function start at line 827 and ends at 851. It contains 14 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [827.0] and does not return any value. It declares 7.0 functions,...
CAREamics_careamics
public
public
0
0
test_export_bmz_pretrained_with_array
def test_export_bmz_pretrained_with_array(tmp_path: Path, pre_trained: Path):"""Test that CAREamics can be instantiated with a pre-trained network and exportedto BMZ.In this case, we provide an array to the BMZ archive test."""# instantiate CAREamistcareamist = CAREamist(source=pre_trained, work_dir=tmp_path)# alternat...
1
12
2
85
2
855
874
855
tmp_path,pre_trained
['careamist', 'array']
None
{"Assign": 2, "Expr": 2}
4
20
4
["CAREamist", "random_array", "careamist.export_to_bmz", "exists"]
0
[]
The function (test_export_bmz_pretrained_with_array) defined within the public class called public.The function start at line 855 and ends at 874. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [855.0] and does not return any value. It declares 4.0 functions,...
CAREamics_careamics
public
public
0
0
test_predict_to_disk_path_tiff
def test_predict_to_disk_path_tiff(tmp_path, minimum_n2v_configuration):"""Test predict_to_disk function with path source and tiff write type."""# prepare dummy datatrain_array = random_array((32, 32))image_dir = tmp_path / "images"image_dir.mkdir()n_samples = 2# save filesfor i in range(n_samples):train_file = image_d...
3
18
2
145
6
878
907
878
tmp_path,minimum_n2v_configuration
['train_file', 'config', 'image_dir', 'train_array', 'careamist', 'n_samples']
None
{"Assign": 10, "Expr": 5, "For": 2}
10
30
10
["random_array", "image_dir.mkdir", "range", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "careamist.predict_to_disk", "range", "is_file"]
0
[]
The function (test_predict_to_disk_path_tiff) defined within the public class called public.The function start at line 878 and ends at 907. It contains 18 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [878.0] and does not return any value. It declares 10.0 functions, and ...
CAREamics_careamics
public
public
0
0
test_predict_to_disk_datamodule_tiff
def test_predict_to_disk_datamodule_tiff(tmp_path, minimum_n2v_configuration):"""Test predict_to_disk function with datamodule source and tiff write type."""# prepare dummy datatrain_array = random_array((32, 32))image_dir = tmp_path / "images"image_dir.mkdir()n_samples = 2# save filesfor i in range(n_samples):train_fi...
3
25
2
190
7
911
948
911
tmp_path,minimum_n2v_configuration
['train_file', 'config', 'image_dir', 'train_array', 'careamist', 'datamodule', 'n_samples']
None
{"Assign": 11, "Expr": 5, "For": 2}
11
38
11
["random_array", "image_dir.mkdir", "range", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "create_predict_datamodule", "careamist.predict_to_disk", "range", "is_file"]
0
[]
The function (test_predict_to_disk_datamodule_tiff) defined within the public class called public.The function start at line 911 and ends at 948. It contains 25 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [911.0] and does not return any value. It declares 11.0 functions,...
CAREamics_careamics
public
public
0
0
test_predict_to_disk_custom.write_numpy
def write_numpy(file_path: Path, img: NDArray, *args, **kwargs) -> None:np.save(file=file_path, arr=img)
1
2
4
31
0
955
956
955
null
[]
None
null
0
0
0
null
0
null
The function (test_predict_to_disk_custom.write_numpy) defined within the public class called public.The function start at line 955 and ends at 956. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [955.0] and does not return any value..
CAREamics_careamics
public
public
0
0
test_predict_to_disk_custom
def test_predict_to_disk_custom(tmp_path, minimum_n2v_configuration):"""Test predict_to_disk function with custom write type."""def write_numpy(file_path: Path, img: NDArray, *args, **kwargs) -> None:np.save(file=file_path, arr=img)# prepare dummy datatrain_array = random_array((32, 32))image_dir = tmp_path / "images"i...
3
24
2
162
6
952
989
952
tmp_path,minimum_n2v_configuration
['train_file', 'config', 'image_dir', 'train_array', 'careamist', 'n_samples']
None
{"Assign": 10, "Expr": 6, "For": 2}
11
38
11
["np.save", "random_array", "image_dir.mkdir", "range", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "careamist.predict_to_disk", "range", "is_file"]
0
[]
The function (test_predict_to_disk_custom) defined within the public class called public.The function start at line 952 and ends at 989. It contains 24 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [952.0] and does not return any value. It declares 11.0 functions, and It ...
CAREamics_careamics
public
public
0
0
test_predict_to_disk_custom_raises.write_numpy
def write_numpy(file_path: Path, img: NDArray, *args, **kwargs) -> None:np.save(file=file_path, arr=img)
1
2
4
31
0
1,000
1,001
1,000
null
[]
None
null
0
0
0
null
0
null
The function (test_predict_to_disk_custom_raises.write_numpy) defined within the public class called public.The function start at line 1000 and ends at 1001. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [1000.0] and does not return any value..
CAREamics_careamics
public
public
0
0
test_predict_to_disk_custom_raises
def test_predict_to_disk_custom_raises(tmp_path, minimum_n2v_configuration):"""Test predict_to_disk custom write type raises ValueError.ValueError should be raised if no write_extension or no write_func is provided."""def write_numpy(file_path: Path, img: NDArray, *args, **kwargs) -> None:np.save(file=file_path, arr=im...
2
30
2
180
6
993
1,040
993
tmp_path,minimum_n2v_configuration
['train_file', 'config', 'image_dir', 'train_array', 'careamist', 'n_samples']
None
{"Assign": 10, "Expr": 7, "For": 1, "With": 2}
12
48
12
["np.save", "random_array", "image_dir.mkdir", "range", "tifffile.imwrite", "Configuration", "CAREamist", "careamist.train", "pytest.raises", "careamist.predict_to_disk", "pytest.raises", "careamist.predict_to_disk"]
0
[]
The function (test_predict_to_disk_custom_raises) defined within the public class called public.The function start at line 993 and ends at 1040. It contains 30 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [993.0] and does not return any value. It declares 12.0 functions, ...
CAREamics_careamics
public
public
0
0
test_add_custom_callback.__init__
def __init__(self):super().__init__()self.has_started = Falseself.has_ended = False
1
4
1
22
0
1,049
1,053
1,049
null
[]
None
null
0
0
0
null
0
null
The function (test_add_custom_callback.__init__) defined within the public class called public.The function start at line 1049 and ends at 1053. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
test_add_custom_callback.on_train_start
def on_train_start(self, trainer, pl_module):self.has_started = True
1
2
3
14
0
1,055
1,056
1,055
null
[]
None
null
0
0
0
null
0
null
The function (test_add_custom_callback.on_train_start) defined within the public class called public.The function start at line 1055 and ends at 1056. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [1055.0] and does not return any value..
CAREamics_careamics
public
public
0
0
test_add_custom_callback.on_train_end
def on_train_end(self, trainer, pl_module):self.has_ended = True
1
2
3
14
0
1,058
1,059
1,058
null
[]
None
null
0
0
0
null
0
null
The function (test_add_custom_callback.on_train_end) defined within the public class called public.The function start at line 1058 and ends at 1059. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [1058.0] and does not return any value..
CAREamics_careamics
public
public
0
0
test_add_custom_callback
def test_add_custom_callback(tmp_path, minimum_n2v_configuration):"""Test that custom callback can be added to the CAREamist."""# define a custom callbackclass MyCallback(Callback):def __init__(self):super().__init__()self.has_started = Falseself.has_ended = Falsedef on_train_start(self, trainer, pl_module):self.has_st...
1
20
2
132
4
1,044
1,085
1,044
tmp_path,minimum_n2v_configuration
['train_array', 'config', 'careamist', 'my_callback']
None
{"Assign": 12, "Expr": 3}
7
42
7
["__init__", "super", "MyCallback", "random_array", "Configuration", "CAREamist", "careamist.train"]
0
[]
The function (test_add_custom_callback) defined within the public class called public.The function start at line 1044 and ends at 1085. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1044.0] and does not return any value. It declares 7.0 functions, and It h...
CAREamics_careamics
public
public
0
0
test_enable_progress_bar
def test_enable_progress_bar(tmp_path: Path, minimum_n2v_configuration: dict, enable_progress_bar: bool):"""Test no error occurs when enable_progress_bar is set to True or False."""# training datatrain_array = random_array((32, 32))# create configurationconfig = Configuration(**minimum_n2v_configuration)config.data_con...
3
21
3
138
4
1,090
1,121
1,090
tmp_path,minimum_n2v_configuration,enable_progress_bar
['train_array', 'config', 'careamist', 'is_progress_bar_callback']
None
{"Assign": 8, "Expr": 2, "If": 1}
10
32
10
["random_array", "Configuration", "CAREamist", "isinstance", "any", "any", "careamist.train", "exists", "Path", "pytest.mark.parametrize"]
0
[]
The function (test_enable_progress_bar) defined within the public class called public.The function start at line 1090 and ends at 1121. It contains 21 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [1090.0] and does not return any value. It declares 10.0 functions, and It ...
CAREamics_careamics
public
public
0
0
test_error_passing_careamics_callback
def test_error_passing_careamics_callback(tmp_path, minimum_n2v_configuration):"""Test that an error is thrown if we pass known callbacks to CAREamist."""# create configurationconfig = Configuration(**minimum_n2v_configuration)config.data_config.axes = "YX"config.data_config.batch_size = 2config.data_config.data_type =...
1
23
2
181
5
1,124
1,158
1,124
tmp_path,minimum_n2v_configuration
['config', 'hyper_params', 'model_ckp', 'progress_bar', 'early_stp']
None
{"Assign": 9, "Expr": 5, "With": 4}
14
35
14
["Configuration", "ModelCheckpoint", "pytest.raises", "CAREamist", "EarlyStopping", "Trainer", "pytest.raises", "CAREamist", "ProgressBarCallback", "pytest.raises", "CAREamist", "HyperParametersCallback", "pytest.raises", "CAREamist"]
0
[]
The function (test_error_passing_careamics_callback) defined within the public class called public.The function start at line 1124 and ends at 1158. It contains 23 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1124.0] and does not return any value. It declares 14.0 functi...
CAREamics_careamics
public
public
0
0
test_stop_training._train
def _train():careamist.train(train_source=train_array)
1
2
0
12
0
1,177
1,178
1,177
null
[]
None
null
0
0
0
null
0
null
The function (test_stop_training._train) defined within the public class called public.The function start at line 1177 and ends at 1178. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value..
CAREamics_careamics
public
public
0
0
test_stop_training
def test_stop_training(tmp_path: Path, minimum_n2v_configuration: dict):"""Test that CAREamics can stop the training"""# training datatrain_array = random_array((32, 32))# create configurationconfig = Configuration(**minimum_n2v_configuration)config.training_config.lightning_trainer_config = {"max_epochs": 100}config.d...
1
15
2
119
4
1,161
1,188
1,161
tmp_path,minimum_n2v_configuration
['train_array', 'config', 'careamist', 'thread']
None
{"Assign": 9, "Expr": 5}
8
28
8
["random_array", "Configuration", "CAREamist", "careamist.train", "Thread", "thread.start", "careamist.stop_training", "thread.join"]
0
[]
The function (test_stop_training) defined within the public class called public.The function start at line 1161 and ends at 1188. It contains 15 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1161.0] and does not return any value. It declares 8.0 functions, and It has 8.0...
CAREamics_careamics
public
public
0
0
test_read_logger
def test_read_logger(tmp_path, minimum_n2v_configuration):config = Configuration(**minimum_n2v_configuration)config.training_config.lightning_trainer_config = {"max_epochs": 10}array = np.arange(32 * 32).reshape((32, 32))careamist = CAREamist(config, work_dir=tmp_path)careamist.train(train_source=array)losses = careami...
2
13
2
100
4
1,192
1,208
1,192
tmp_path,minimum_n2v_configuration
['config', 'careamist', 'losses', 'array']
None
{"Assign": 5, "Expr": 1, "For": 1}
8
17
8
["Configuration", "reshape", "np.arange", "CAREamist", "careamist.train", "careamist.get_losses", "len", "len"]
0
[]
The function (test_read_logger) defined within the public class called public.The function start at line 1192 and ends at 1208. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1192.0] and does not return any value. It declares 8.0 functions, and It has 8.0 f...
CAREamics_careamics
public
public
0
0
test_all_parameters_used
def test_all_parameters_used(tmp_path, minimum_n2v_configuration):config = Configuration(**minimum_n2v_configuration)config.training_config.lightning_trainer_config = {"max_epochs": 2}config.data_config.batch_size = 2config.data_config.patch_size = (16, 16)config.data_config.val_dataloader_params = {"num_workers": 2}# ...
2
11
2
117
2
1,211
1,224
1,211
tmp_path,minimum_n2v_configuration
['config', 'careamist']
None
{"Assign": 6}
3
14
3
["Configuration", "CAREamist", "all"]
0
[]
The function (test_all_parameters_used) defined within the public class called public.The function start at line 1211 and ends at 1224. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [1211.0] and does not return any value. It declares 3.0 functions, and It h...
CAREamics_careamics
public
public
0
0
test_trainer_parameters_passed_correctly
def test_trainer_parameters_passed_correctly(tmp_path: Path, minimum_n2v_configuration: dict):"""Limit_train_batches and num_epochs are passed to Lightning trainer."""# training datatrain_array = random_array((32, 32))# Test limit_train_batches parameterlimit_train_batches = 5# create configuration with limit_train_bat...
1
24
2
161
4
1,228
1,267
1,228
tmp_path,minimum_n2v_configuration
['train_array', 'config', 'careamist', 'limit_train_batches']
None
{"Assign": 9, "Expr": 2}
6
40
6
["random_array", "Configuration", "CAREamist", "careamist.train", "exists", "Path"]
0
[]
The function (test_trainer_parameters_passed_correctly) defined within the public class called public.The function start at line 1228 and ends at 1267. It contains 24 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1228.0] and does not return any value. It declares 6.0 func...
CAREamics_careamics
public
public
0
0
test_minimum_algorithm
def test_minimum_algorithm(minimum_algorithm_n2v):# create algorithm configurationUNetBasedAlgorithm(**minimum_algorithm_n2v)
1
2
1
10
0
10
12
10
minimum_algorithm_n2v
[]
None
{"Expr": 1}
1
3
1
["UNetBasedAlgorithm"]
0
[]
The function (test_minimum_algorithm) defined within the public class called public.The function start at line 10 and ends at 12. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 functio...
CAREamics_careamics
public
public
0
0
test_minimum_data
def test_minimum_data(minimum_data):# create data configurationDataConfig(**minimum_data)
1
2
1
10
0
15
17
15
minimum_data
[]
None
{"Expr": 1}
1
3
1
["DataConfig"]
0
[]
The function (test_minimum_data) defined within the public class called public.The function start at line 15 and ends at 17. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 function cal...
CAREamics_careamics
public
public
0
0
test_minimum_prediction
def test_minimum_prediction(minimum_inference):# create prediction configurationInferenceConfig(**minimum_inference)
1
2
1
10
0
20
22
20
minimum_inference
[]
None
{"Expr": 1}
1
3
1
["InferenceConfig"]
0
[]
The function (test_minimum_prediction) defined within the public class called public.The function start at line 20 and ends at 22. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 functi...
CAREamics_careamics
public
public
0
0
test_minimum_training
def test_minimum_training(minimum_training):# create training configurationTrainingConfig(**minimum_training)
1
2
1
10
0
25
27
25
minimum_training
[]
None
{"Expr": 1}
1
3
1
["TrainingConfig"]
0
[]
The function (test_minimum_training) defined within the public class called public.The function start at line 25 and ends at 27. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 function...
CAREamics_careamics
public
public
0
0
test_minimum_n2v_configuration
def test_minimum_n2v_configuration(minimum_n2v_configuration):# create configurationConfiguration(**minimum_n2v_configuration)
1
2
1
10
0
30
32
30
minimum_n2v_configuration
[]
None
{"Expr": 1}
1
3
1
["Configuration"]
0
[]
The function (test_minimum_n2v_configuration) defined within the public class called public.The function start at line 30 and ends at 32. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0...
CAREamics_careamics
public
public
0
0
test_minimum_configuration
def test_minimum_configuration(minimum_supervised_configuration):# create configurationConfiguration(**minimum_supervised_configuration)
1
2
1
10
0
35
37
35
minimum_supervised_configuration
[]
None
{"Expr": 1}
1
3
1
["Configuration"]
0
[]
The function (test_minimum_configuration) defined within the public class called public.The function start at line 35 and ends at 37. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 fun...
CAREamics_careamics
public
public
0
0
test_conf
def test_conf(tmp_path: Path, algorithm: str):config_path = tmp_path / "config.yaml"result = runner.invoke(app,["conf","-d",str(tmp_path),algorithm,"--experiment-name","LevitatingFrog","--axes","YX","--patch-size","64","64","-1","--batch-size","1","--num-epochs","1",],)assert config_path.is_file()assert result.exit_cod...
1
25
2
75
2
12
36
12
tmp_path,algorithm
['result', 'config_path']
None
{"Assign": 2}
4
25
4
["runner.invoke", "str", "config_path.is_file", "pytest.mark.parametrize"]
0
[]
The function (test_conf) defined within the public class called public.The function start at line 12 and ends at 36. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [12.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions call...
CAREamics_careamics
public
public
0
0
test_train
def test_train(tmp_path: Path, minimum_n2v_configuration: dict):# create & save configconfig_path = tmp_path / "config.yaml"config = Configuration(**minimum_n2v_configuration)config.data_config.data_type = SupportedData.TIFF.valuesave_configuration(config, config_path)# training datatrain_array = np.random.rand(32, 32)...
1
22
2
133
5
18
46
18
tmp_path,minimum_n2v_configuration
['train_file', 'config', 'config_path', 'train_array', 'result']
None
{"Assign": 6, "Expr": 2}
12
29
12
["Configuration", "save_configuration", "np.random.rand", "tifffile.imwrite", "runner.invoke", "str", "str", "str", "is_dir", "len", "list", "glob"]
0
[]
The function (test_train) defined within the public class called public.The function start at line 18 and ends at 46. It contains 22 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [18.0] and does not return any value. It declares 12.0 functions, and It has 12.0 functions c...
CAREamics_careamics
public
public
0
0
test_predict_single_file
def test_predict_single_file(tmp_path: Path, minimum_n2v_configuration: dict):# create & save configconfig_path = tmp_path / "config.yaml"config = Configuration(**minimum_n2v_configuration)config.data_config.data_type = SupportedData.TIFF.valuesave_configuration(config, config_path)# dummy datatrain_array = np.random.r...
1
17
2
158
7
49
73
49
tmp_path,minimum_n2v_configuration
['train_file', 'config', 'checkpoint_path', 'config_path', 'train_array', 'careamist', 'result']
None
{"Assign": 8, "Expr": 3}
15
25
15
["Configuration", "save_configuration", "np.random.rand", "tifffile.imwrite", "CAREamist", "careamist.train", "next", "iter", "glob", "runner.invoke", "str", "str", "str", "is_dir", "is_file"]
0
[]
The function (test_predict_single_file) defined within the public class called public.The function start at line 49 and ends at 73. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [49.0] and does not return any value. It declares 15.0 functions, and It has 15...
CAREamics_careamics
public
public
0
0
test_predict_directory
def test_predict_directory(tmp_path: Path, minimum_n2v_configuration: dict):# create & save configconfig_path = tmp_path / "config.yaml"config = Configuration(**minimum_n2v_configuration)config.data_config.data_type = SupportedData.TIFF.valuesave_configuration(config, config_path)n_files = 2data_dir = tmp_path / "data"...
3
22
2
189
9
76
106
76
tmp_path,minimum_n2v_configuration
['config', 'train_file', 'checkpoint_path', 'config_path', 'n_files', 'train_array', 'careamist', 'result', 'data_dir']
None
{"Assign": 10, "Expr": 4, "For": 2}
18
31
18
["Configuration", "save_configuration", "data_dir.mkdir", "range", "np.random.rand", "tifffile.imwrite", "CAREamist", "careamist.train", "next", "iter", "glob", "runner.invoke", "str", "str", "str", "is_dir", "range", "is_file"]
0
[]
The function (test_predict_directory) defined within the public class called public.The function start at line 76 and ends at 106. It contains 22 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [76.0] and does not return any value. It declares 18.0 functions, and It has 18....
CAREamics_careamics
public
public
0
0
test_defaults_checkpoint
def test_defaults_checkpoint():"""Test that a default CheckpointModel can initialize a ModelCheckpoint callback."""config = CheckpointModel()ModelCheckpoint(**config.model_dump())
1
3
0
19
1
6
9
6
['config']
None
{"Assign": 1, "Expr": 2}
3
4
3
["CheckpointModel", "ModelCheckpoint", "config.model_dump"]
0
[]
The function (test_defaults_checkpoint) defined within the public class called public.The function start at line 6 and ends at 9. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 funct...
CAREamics_careamics
public
public
0
0
test_defaults_early_stopping
def test_defaults_early_stopping():"""Test that a default EarlyStoppingModel can initialize an EarlyStoppingcallback."""config = EarlyStoppingModel()EarlyStopping(**config.model_dump())
1
3
0
19
1
12
16
12
['config']
None
{"Assign": 1, "Expr": 2}
3
5
3
["EarlyStoppingModel", "EarlyStopping", "config.model_dump"]
0
[]
The function (test_defaults_early_stopping) defined within the public class called public.The function start at line 12 and ends at 16. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0...
CAREamics_careamics
public
public
0
0
test_valid_names
def test_valid_names(minimum_supervised_configuration: dict, name: str):"""Test valid names (letters, numbers, spaces, dashes and underscores)."""minimum_supervised_configuration["experiment_name"] = namemyconf = Configuration(**minimum_supervised_configuration)assert myconf.experiment_name == name
1
4
2
31
1
8
12
8
minimum_supervised_configuration,name
['myconf']
None
{"Assign": 2, "Expr": 1}
2
5
2
["Configuration", "pytest.mark.parametrize"]
0
[]
The function (test_valid_names) defined within the public class called public.The function start at line 8 and ends at 12. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [8.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions ...
CAREamics_careamics
public
public
0
0
test_invalid_names
def test_invalid_names(minimum_supervised_configuration: dict, name: str):"""Test that invalid names raise an error."""minimum_supervised_configuration["experiment_name"] = namewith pytest.raises(ValueError):Configuration(**minimum_supervised_configuration)
1
4
2
31
0
16
20
16
minimum_supervised_configuration,name
[]
None
{"Assign": 1, "Expr": 2, "With": 1}
3
5
3
["pytest.raises", "Configuration", "pytest.mark.parametrize"]
0
[]
The function (test_invalid_names) defined within the public class called public.The function start at line 16 and ends at 20. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [16.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functi...
CAREamics_careamics
public
public
0
0
test_3D_algorithm_and_data_compatibility
def test_3D_algorithm_and_data_compatibility(minimum_supervised_configuration: dict):"""Test that errors are raised if algorithm `is_3D` and data axes areincompatible."""# 3D but no Z in axesminimum_supervised_configuration["algorithm_config"]["model"]["conv_dims"] = 3config = Configuration(**minimum_supervised_configu...
1
9
1
90
1
23
37
23
minimum_supervised_configuration
['config']
None
{"Assign": 6, "Expr": 1}
2
15
2
["Configuration", "Configuration"]
0
[]
The function (test_3D_algorithm_and_data_compatibility) defined within the public class called public.The function start at line 23 and ends at 37. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and...
CAREamics_careamics
public
public
0
0
test_set_3D
def test_set_3D(minimum_supervised_configuration: dict):"""Test the set 3D method."""conf = Configuration(**minimum_supervised_configuration)# set to 3Dconf.set_3D(True, "ZYX", [64, 64, 64])assert conf.data_config.axes == "ZYX"assert conf.data_config.patch_size == [64, 64, 64]assert conf.algorithm_config.model.conv_dim...
1
10
1
107
1
40
54
40
minimum_supervised_configuration
['conf']
None
{"Assign": 1, "Expr": 3}
3
15
3
["Configuration", "conf.set_3D", "conf.set_3D"]
0
[]
The function (test_set_3D) defined within the public class called public.The function start at line 40 and ends at 54. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 functions calle...
CAREamics_careamics
public
public
0
0
test_validate_n2v_mask_pixel_perc
def test_validate_n2v_mask_pixel_perc(minimum_n2v_configuration):minimum_n2v_configuration["data_config"]["patch_size"] = [16, 16]minimum_n2v_configuration["algorithm_config"]["n2v_config"]["masked_pixel_percentage"] = 0.2with pytest.raises(ValidationError):Configuration(**minimum_n2v_configuration)
1
7
1
45
0
57
65
57
minimum_n2v_configuration
[]
None
{"Assign": 2, "Expr": 1, "With": 1}
2
9
2
["pytest.raises", "Configuration"]
0
[]
The function (test_validate_n2v_mask_pixel_perc) defined within the public class called public.The function start at line 57 and ends at 65. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It ha...
CAREamics_careamics
public
public
0
0
test_careamics_config_n2v
def test_careamics_config_n2v(minimum_n2v_configuration):"""Test that the N2V configuration is created correctly."""config = Configuration(**minimum_n2v_configuration)assert config.algorithm_config.algorithm == SupportedAlgorithm.N2V.value
1
3
1
25
1
37
40
37
minimum_n2v_configuration
['config']
None
{"Assign": 1, "Expr": 1}
1
4
1
["Configuration"]
0
[]
The function (test_careamics_config_n2v) defined within the public class called public.The function start at line 37 and ends at 40. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 func...
CAREamics_careamics
public
public
0
0
test_careamics_config_supervised
def test_careamics_config_supervised(minimum_supervised_configuration, algorithm):"""Test that the supervised configuration is created correctly."""min_config = minimum_supervised_configurationmin_config["algorithm_config"]["algorithm"] = algorithmconfig = Configuration(**min_config)assert config.algorithm_config.algor...
1
5
2
35
2
46
53
46
minimum_supervised_configuration,algorithm
['min_config', 'config']
None
{"Assign": 3, "Expr": 1}
2
8
2
["Configuration", "pytest.mark.parametrize"]
0
[]
The function (test_careamics_config_supervised) defined within the public class called public.The function start at line 46 and ends at 53. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [46.0] and does not return any value. It declares 2.0 functions, and It ...
CAREamics_careamics
public
public
0
0
test_algorithm_factory_n2v
def test_algorithm_factory_n2v(minimum_algorithm_n2v):"""Test that the N2V configuration is created correctly."""algorithm = algorithm_factory(minimum_algorithm_n2v)assert isinstance(algorithm, N2VAlgorithm)
1
3
1
19
1
56
59
56
minimum_algorithm_n2v
['algorithm']
None
{"Assign": 1, "Expr": 1}
2
4
2
["algorithm_factory", "isinstance"]
0
[]
The function (test_algorithm_factory_n2v) defined within the public class called public.The function start at line 56 and ends at 59. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 f...
CAREamics_careamics
public
public
0
0
test_algorithm_factory_supervised
def test_algorithm_factory_supervised(minimum_algorithm_supervised, algorithm):"""Test that the supervised configuration is created correctly."""min_config = minimum_algorithm_supervisedmin_config["algorithm"] = algorithmalgorithm_config = algorithm_factory(min_config)exp_class = N2NAlgorithm if algorithm == "n2n" else...
2
6
2
39
3
63
71
63
minimum_algorithm_supervised,algorithm
['min_config', 'algorithm_config', 'exp_class']
None
{"Assign": 4, "Expr": 1}
3
9
3
["algorithm_factory", "isinstance", "pytest.mark.parametrize"]
0
[]
The function (test_algorithm_factory_supervised) defined within the public class called public.The function start at line 63 and ends at 71. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [63.0] and does not return any value. It declares 3.0 functions, and It...
CAREamics_careamics
public
public
0
0
test_list_aug_default
def test_list_aug_default():"""Test that the default augmentations are present."""list_aug = _list_spatial_augmentations(augmentations=None)assert len(list_aug) == 2assert list_aug[0].name == SupportedTransform.XY_FLIP.valueassert list_aug[1].name == SupportedTransform.XY_RANDOM_ROTATE90.value
1
5
0
46
1
74
80
74
['list_aug']
None
{"Assign": 1, "Expr": 1}
2
7
2
["_list_spatial_augmentations", "len"]
0
[]
The function (test_list_aug_default) defined within the public class called public.The function start at line 74 and ends at 80. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functi...
CAREamics_careamics
public
public
0
0
test_list_aug_no_aug
def test_list_aug_no_aug():"""Test that disabling augmentation results in empty transform list."""list_aug = _list_spatial_augmentations(augmentations=[])assert len(list_aug) == 0
1
3
0
21
1
83
86
83
['list_aug']
None
{"Assign": 1, "Expr": 1}
2
4
2
["_list_spatial_augmentations", "len"]
0
[]
The function (test_list_aug_no_aug) defined within the public class called public.The function start at line 83 and ends at 86. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functio...
CAREamics_careamics
public
public
0
0
test_list_aug_error_duplicate_transforms
def test_list_aug_error_duplicate_transforms():"""Test that an error is raised when there are duplicate transforms."""with pytest.raises(ValueError):_list_spatial_augmentations(augmentations=[XYFlipModel(), XYRandomRotate90Model(), XYFlipModel()],)
1
5
0
32
0
89
94
89
[]
None
{"Expr": 2, "With": 1}
5
6
5
["pytest.raises", "_list_spatial_augmentations", "XYFlipModel", "XYRandomRotate90Model", "XYFlipModel"]
0
[]
The function (test_list_aug_error_duplicate_transforms) defined within the public class called public.The function start at line 89 and ends at 94. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 5.0 functions, and...
CAREamics_careamics
public
public
0
0
test_list_aug_error_wrong_transform
def test_list_aug_error_wrong_transform():"""Test that an error is raised when the wrong transform is passed."""with pytest.raises(ValueError):_list_spatial_augmentations(augmentations=[XYFlipModel(), N2VManipulateModel()],)
1
5
0
28
0
97
102
97
[]
None
{"Expr": 2, "With": 1}
4
6
4
["pytest.raises", "_list_spatial_augmentations", "XYFlipModel", "N2VManipulateModel"]
0
[]
The function (test_list_aug_error_wrong_transform) defined within the public class called public.The function start at line 97 and ends at 102. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It...
CAREamics_careamics
public
public
0
0
test_create_data_configuration_train_dataloader_params
def test_create_data_configuration_train_dataloader_params(minimum_data):"""Test that shuffle is added silently to the train_dataloader_params."""config_dict = minimum_dataconfig_dict["train_dataloader_params"] = {"num_workers": 4}config = _create_data_configuration(batch_size=1, augmentations=[], **config_dict)assert ...
1
6
1
48
2
105
112
105
minimum_data
['config', 'config_dict']
None
{"Assign": 3, "Expr": 1}
1
8
1
["_create_data_configuration"]
0
[]
The function (test_create_data_configuration_train_dataloader_params) defined within the public class called public.The function start at line 105 and ends at 112. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0...
CAREamics_careamics
public
public
0
0
test_supervised_configuration_passing_transforms
def test_supervised_configuration_passing_transforms():"""Test that transforms can be passed to the configuration."""config_dict = _create_supervised_config_dict(algorithm="n2n",experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,augmentations=[XYFlipModel()],)config = Configuration(**con...
1
13
0
81
2
115
129
115
['config', 'config_dict']
None
{"Assign": 2, "Expr": 1}
4
15
4
["_create_supervised_config_dict", "XYFlipModel", "Configuration", "len"]
0
[]
The function (test_supervised_configuration_passing_transforms) defined within the public class called public.The function start at line 115 and ends at 129. It contains 13 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 fun...
CAREamics_careamics
public
public
0
0
test_model_creation
def test_model_creation():"""Test that the correct parameters are passed to the model."""model_kwargs = {"depth": 4,"conv_dims": 2,"n2v2": False,"in_channels": 2,"num_classes": 5,"independent_channels": False,}# choose different parametersaxes = "XYZ"conv_dims = 3in_channels = 3num_classes = 4independent_channels = Tru...
1
29
0
119
8
132
165
132
['use_n2v2', 'in_channels', 'model', 'model_kwargs', 'axes', 'independent_channels', 'num_classes', 'conv_dims']
None
{"Assign": 8, "Expr": 1}
1
34
1
["_create_unet_configuration"]
0
[]
The function (test_model_creation) defined within the public class called public.The function start at line 132 and ends at 165. It contains 29 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 functio...
CAREamics_careamics
public
public
0
0
test_create_configuration
def test_create_configuration():"""Test that the methods correctly passes all parameters."""algorithm = "care"experiment_name = "test"data_type = "tiff"axes = "CYX"patch_size = [128, 128]batch_size = 8transform_list = [XYFlipModel(), XYRandomRotate90Model()]independent_channels = Falseloss = "mse"n_channels_in = 2n_cha...
1
81
0
386
21
168
252
168
['config', 'lr_scheduler_params', 'model_params', 'loss', 'independent_channels', 'lr_scheduler', 'algorithm', 'batch_size', 'experiment_name', 'data_type', 'optimizer', 'patch_size', 'optimizer_params', 'n_channels_in', 'n_channels_out', 'logger', 'val_dataloader_params', 'transform_list', 'axes', 'checkpoint_params',...
None
{"Assign": 21, "Expr": 1}
4
85
4
["XYFlipModel", "XYRandomRotate90Model", "Configuration", "_create_supervised_config_dict"]
0
[]
The function (test_create_configuration) defined within the public class called public.The function start at line 168 and ends at 252. It contains 81 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0...
CAREamics_careamics
public
public
0
0
test_supervised_configuration_error_with_channel_axes
def test_supervised_configuration_error_with_channel_axes():"""Test that an error is raised if channels are in axes, but the input channelnumber is not specified."""with pytest.raises(ValueError):_create_supervised_config_dict(algorithm="n2n",experiment_name="test",data_type="tiff",axes="CYX",patch_size=[64, 64],batch_...
1
10
0
44
0
255
266
255
[]
None
{"Expr": 2, "With": 1}
2
12
2
["pytest.raises", "_create_supervised_config_dict"]
0
[]
The function (test_supervised_configuration_error_with_channel_axes) defined within the public class called public.The function start at line 255 and ends at 266. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2....