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
test_supervised_configuration_singleton_channel
def test_supervised_configuration_singleton_channel():"""Test that no error is raised if channels are in axes, and the input channel is1."""_create_supervised_config_dict(algorithm="n2n",experiment_name="test",data_type="tiff",axes="CYX",patch_size=[64, 64],batch_size=8,n_channels_in=1,)
1
10
0
40
0
269
280
269
[]
None
{"Expr": 2}
1
12
1
["_create_supervised_config_dict"]
0
[]
The function (test_supervised_configuration_singleton_channel) defined within the public class called public.The function start at line 269 and ends at 280. 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 declare 1.0 funct...
CAREamics_careamics
public
public
0
0
test_supervised_configuration_no_channel
def test_supervised_configuration_no_channel():"""Test that no error is raised without channel and number of inputs."""_create_supervised_config_dict(algorithm="n2n",experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,)
1
9
0
36
0
283
292
283
[]
None
{"Expr": 2}
1
10
1
["_create_supervised_config_dict"]
0
[]
The function (test_supervised_configuration_no_channel) defined within the public class called public.The function start at line 283 and ends at 292. 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 declare 1.0 function, and...
CAREamics_careamics
public
public
0
0
test_supervised_configuration_error_without_channel_axes
def test_supervised_configuration_error_without_channel_axes():"""Test that an error is raised if channels are not in axes, but the input channelnumber is specified and greater than 1."""with pytest.raises(ValueError):_create_supervised_config_dict(algorithm="n2n",experiment_name="test",data_type="tiff",axes="YX",patch...
1
11
0
48
0
295
307
295
[]
None
{"Expr": 2, "With": 1}
2
13
2
["pytest.raises", "_create_supervised_config_dict"]
0
[]
The function (test_supervised_configuration_error_without_channel_axes) defined within the public class called public.The function start at line 295 and ends at 307. It contains 11 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...
CAREamics_careamics
public
public
0
0
test_supervised_configuration_channels
def test_supervised_configuration_channels():"""Test that no error is raised if channels are in axes and the input channelare specified."""_create_supervised_config_dict(algorithm="n2n",experiment_name="test",data_type="tiff",axes="CYX",patch_size=[64, 64],batch_size=8,n_channels_in=4,)
1
10
0
40
0
310
321
310
[]
None
{"Expr": 2}
1
12
1
["_create_supervised_config_dict"]
0
[]
The function (test_supervised_configuration_channels) defined within the public class called public.The function start at line 310 and ends at 321. 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 declare 1.0 function, and ...
CAREamics_careamics
public
public
0
0
test_n2n_configuration
def test_n2n_configuration():"""Test that N2N configuration can be created."""config = create_n2n_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,train_dataloader_params={"num_workers": 2},)assert config.algorithm_config.algorithm == "n2n"
1
10
0
50
1
324
334
324
['config']
None
{"Assign": 1, "Expr": 1}
1
11
1
["create_n2n_configuration"]
0
[]
The function (test_n2n_configuration) defined within the public class called public.The function start at line 324 and ends at 334. 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 declare 1.0 function, and It has 1.0 func...
CAREamics_careamics
public
public
0
0
test_n2n_configuration_n_channels
def test_n2n_configuration_n_channels():"""Test the behaviour of the number of channels in and out."""n_channels_in = 4n_channels_out = 5# n_channels_out not specifiedconfig = create_n2n_configuration(experiment_name="test",data_type="tiff",axes="CYX",patch_size=[64, 64],batch_size=8,n_channels_in=n_channels_in,)assert...
1
24
0
121
3
337
365
337
['config', 'n_channels_out', 'n_channels_in']
None
{"Assign": 4, "Expr": 1}
2
29
2
["create_n2n_configuration", "create_n2n_configuration"]
0
[]
The function (test_n2n_configuration_n_channels) defined within the public class called public.The function start at line 337 and ends at 365. It contains 24 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...
CAREamics_careamics
public
public
0
0
test_n2n_configuration_limit_train_batches
def test_n2n_configuration_limit_train_batches():"""Num_steps parameter is passed to trainer config as limit_train_batches."""num_steps = 15config = create_n2n_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,num_steps=num_steps,)assert (config.training_config.lightning_t...
1
35
0
143
3
368
408
368
['config', 'num_steps', 'num_steps_float']
None
{"Assign": 5, "Expr": 1}
3
41
3
["create_n2n_configuration", "create_n2n_configuration", "create_n2n_configuration"]
0
[]
The function (test_n2n_configuration_limit_train_batches) defined within the public class called public.The function start at line 368 and ends at 408. It contains 35 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...
CAREamics_careamics
public
public
0
0
test_care_configuration
def test_care_configuration():"""Test that CARE configuration can be created."""config = create_care_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,train_dataloader_params={"num_workers": 2},)assert config.algorithm_config.algorithm == "care"
1
10
0
50
1
411
421
411
['config']
None
{"Assign": 1, "Expr": 1}
1
11
1
["create_care_configuration"]
0
[]
The function (test_care_configuration) defined within the public class called public.The function start at line 411 and ends at 421. 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 declare 1.0 function, and It has 1.0 fun...
CAREamics_careamics
public
public
0
0
test_care_configuration_n_channels
def test_care_configuration_n_channels():"""Test the behaviour of the number of channels in and out."""n_channels_in = 4n_channels_out = 5# n_channels_out not specifiedconfig = create_care_configuration(experiment_name="test",data_type="tiff",axes="CYX",patch_size=[64, 64],batch_size=8,n_channels_in=n_channels_in,)asse...
1
24
0
121
3
424
452
424
['config', 'n_channels_out', 'n_channels_in']
None
{"Assign": 4, "Expr": 1}
2
29
2
["create_care_configuration", "create_care_configuration"]
0
[]
The function (test_care_configuration_n_channels) defined within the public class called public.The function start at line 424 and ends at 452. It contains 24 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 I...
CAREamics_careamics
public
public
0
0
test_care_configuration_limit_train_batches
def test_care_configuration_limit_train_batches():"""Num_steps parameter is passed to trainer config as limit_train_batches."""num_steps = 10config = create_care_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,num_steps=num_steps,)assert (config.training_config.lightning...
1
35
0
143
3
455
495
455
['config', 'num_steps', 'num_steps_float']
None
{"Assign": 5, "Expr": 1}
3
41
3
["create_care_configuration", "create_care_configuration", "create_care_configuration"]
0
[]
The function (test_care_configuration_limit_train_batches) defined within the public class called public.The function start at line 455 and ends at 495. It contains 35 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 function...
CAREamics_careamics
public
public
0
0
test_care_configuration_trainer_params
def test_care_configuration_trainer_params():"""Test that trainer_params are correctly passed to CARE trainer config."""num_epochs = 40trainer_params = {"accelerator": "gpu","devices": 1,"precision": "16-mixed","gradient_clip_val": 0.8,"check_val_every_n_epoch": 3,"deterministic": True,}config = create_care_configurati...
2
22
0
108
3
498
522
498
['trainer_params', 'num_epochs', 'config']
None
{"Assign": 3, "Expr": 1, "For": 1}
2
25
2
["create_care_configuration", "trainer_params.items"]
0
[]
The function (test_care_configuration_trainer_params) defined within the public class called public.The function start at line 498 and ends at 522. It contains 22 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, an...
CAREamics_careamics
public
public
0
0
test_care_configuration_trainer_params_override
def test_care_configuration_trainer_params_override():"""Test that explicit parameters override trainer_params in CARE configuration."""num_epochs = 35num_steps = 750trainer_params = {"max_epochs": 200,"limit_train_batches": 3000,"precision": "32-true",}config = create_care_configuration(experiment_name="test",data_typ...
1
24
0
103
4
525
554
525
['trainer_params', 'num_steps', 'num_epochs', 'config']
None
{"Assign": 4, "Expr": 1}
1
30
1
["create_care_configuration"]
0
[]
The function (test_care_configuration_trainer_params_override) defined within the public class called public.The function start at line 525 and ends at 554. It contains 24 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 funct...
CAREamics_careamics
public
public
0
0
test_n2v_configuration
def test_n2v_configuration():"""Test that N2V configuration can be created."""config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,train_dataloader_params={"num_workers": 2},)assert isinstance(config.algorithm_config, N2VAlgorithm)
1
10
0
51
1
557
567
557
['config']
None
{"Assign": 1, "Expr": 1}
2
11
2
["create_n2v_configuration", "isinstance"]
0
[]
The function (test_n2v_configuration) defined within the public class called public.The function start at line 557 and ends at 567. 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.0 functions, and It has 2.0 fu...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_no_aug
def test_n2v_configuration_no_aug():"""Test the default n2v transforms."""config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,augmentations=[],)assert config.data_config.transforms == []
1
10
0
48
1
570
580
570
['config']
None
{"Assign": 1, "Expr": 1}
1
11
1
["create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_no_aug) defined within the public class called public.The function start at line 570 and ends at 580. 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 declare 1.0 function, and It has 1...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_n2v2_structn2v
def test_n2v_configuration_n2v2_structn2v():"""Test that N2V manipulate is ignored when explicitely passed."""use_n2v2 = Trueroi_size = 15masked_pixel_percentage = 0.5struct_mask_axis = SupportedStructAxis.HORIZONTAL.valuestruct_n2v_span = 15config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes...
1
29
0
133
6
583
613
583
['use_n2v2', 'config', 'roi_size', 'masked_pixel_percentage', 'struct_n2v_span', 'struct_mask_axis']
None
{"Assign": 6, "Expr": 1}
1
31
1
["create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_n2v2_structn2v) defined within the public class called public.The function start at line 583 and ends at 613. 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 ...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_limit_train_batches
def test_n2v_configuration_limit_train_batches():"""Num_steps parameter is passed to trainer config as limit_train_batches."""num_steps = 20config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,num_steps=num_steps,)assert (config.training_config.lightning_t...
1
35
0
143
3
616
656
616
['config', 'num_steps', 'num_steps_float']
None
{"Assign": 5, "Expr": 1}
3
41
3
["create_n2v_configuration", "create_n2v_configuration", "create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_limit_train_batches) defined within the public class called public.The function start at line 616 and ends at 656. It contains 35 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...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_num_epochs
def test_n2v_configuration_num_epochs():"""Test that num_epochs parameter is correctly passed to trainer config."""num_epochs = 50config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,num_epochs=num_epochs,)assert config.training_config.lightning_trainer_co...
1
20
0
94
2
659
682
659
['config', 'num_epochs']
None
{"Assign": 3, "Expr": 1}
2
24
2
["create_n2v_configuration", "create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_num_epochs) defined within the public class called public.The function start at line 659 and ends at 682. It contains 20 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...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_num_steps
def test_n2v_configuration_num_steps():"""Test that num_steps parameter is correctly passed to trainer config."""num_steps = 1000config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,num_steps=num_steps,)assert (config.training_config.lightning_trainer_conf...
1
22
0
92
2
685
710
685
['config', 'num_steps']
None
{"Assign": 3, "Expr": 1}
2
26
2
["create_n2v_configuration", "create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_num_steps) defined within the public class called public.The function start at line 685 and ends at 710. It contains 22 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 ...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_num_epochs_and_num_steps
def test_n2v_configuration_num_epochs_and_num_steps():"""Test that both num_epochs and num_steps can be set simultaneously."""num_epochs = 25num_steps = 500config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,num_epochs=num_epochs,num_steps=num_steps,)asse...
1
17
0
72
3
713
731
713
['config', 'num_steps', 'num_epochs']
None
{"Assign": 3, "Expr": 1}
1
19
1
["create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_num_epochs_and_num_steps) defined within the public class called public.The function start at line 713 and ends at 731. It contains 17 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 funct...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_trainer_params
def test_n2v_configuration_trainer_params():"""Test that various trainer_params are correctly passed to trainer config."""trainer_params = {"accelerator": "gpu","devices": 2,"precision": 16,"gradient_clip_val": 0.5,"accumulate_grad_batches": 4,"check_val_every_n_epoch": 5,"log_every_n_steps": 10,"enable_checkpointing":...
2
23
0
106
2
734
759
734
['trainer_params', 'config']
None
{"Assign": 2, "Expr": 1, "For": 1}
2
26
2
["create_n2v_configuration", "trainer_params.items"]
0
[]
The function (test_n2v_configuration_trainer_params) defined within the public class called public.The function start at line 734 and ends at 759. It contains 23 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, and...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_trainer_params_with_timing
def test_n2v_configuration_trainer_params_with_timing():"""Test trainer_params with timing-related parameters."""trainer_params = {"min_epochs": 5,"min_steps": 100,"max_time": "00:01:00:00",# 1 hour"val_check_interval": 0.25,}config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size...
2
17
0
82
2
762
781
762
['trainer_params', 'config']
None
{"Assign": 2, "Expr": 1, "For": 1}
2
20
2
["create_n2v_configuration", "trainer_params.items"]
0
[]
The function (test_n2v_configuration_trainer_params_with_timing) defined within the public class called public.The function start at line 762 and ends at 781. It contains 17 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 fu...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_trainer_params_override
def test_n2v_configuration_trainer_params_override():"""Test that explicit parameters override trainer_params."""num_epochs = 30num_steps = 800# trainer_params has conflicting valuestrainer_params = {"max_epochs": 100,"limit_train_batches": 0.5,"accelerator": "cpu",}config = create_n2v_configuration(experiment_name="te...
1
24
0
105
4
784
815
784
['trainer_params', 'num_steps', 'num_epochs', 'config']
None
{"Assign": 4, "Expr": 1}
1
32
1
["create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_trainer_params_override) defined within the public class called public.The function start at line 784 and ends at 815. It contains 24 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 functi...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_trainer_params_profiler
def test_n2v_configuration_trainer_params_profiler():"""Test trainer_params with profiler settings."""trainer_params = {"profiler": "simple","detect_anomaly": True,"benchmark": False,"deterministic": True,}config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size...
2
17
0
80
2
818
837
818
['trainer_params', 'config']
None
{"Assign": 2, "Expr": 1, "For": 1}
2
20
2
["create_n2v_configuration", "trainer_params.items"]
0
[]
The function (test_n2v_configuration_trainer_params_profiler) defined within the public class called public.The function start at line 818 and ends at 837. It contains 17 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 funct...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_trainer_params_distributed
def test_n2v_configuration_trainer_params_distributed():"""Test trainer_params with distributed training settings."""trainer_params = {"strategy": "ddp","num_nodes": 2,"sync_batchnorm": True,"use_distributed_sampler": True,}config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[...
2
17
0
80
2
840
859
840
['trainer_params', 'config']
None
{"Assign": 2, "Expr": 1, "For": 1}
2
20
2
["create_n2v_configuration", "trainer_params.items"]
0
[]
The function (test_n2v_configuration_trainer_params_distributed) defined within the public class called public.The function start at line 840 and ends at 859. It contains 17 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 fu...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_all_trainer_combinations
def test_n2v_configuration_all_trainer_combinations():"""Test comprehensive combination of all trainer parameters."""num_epochs = 15num_steps = 300trainer_params = {"accelerator": "auto","devices": "auto","precision": "32-true","gradient_clip_val": 1.0,"gradient_clip_algorithm": "norm","accumulate_grad_batches": 2,"che...
2
41
0
182
4
862
909
862
['trainer_params', 'num_steps', 'num_epochs', 'config']
None
{"Assign": 4, "Expr": 1, "For": 1}
2
48
2
["create_n2v_configuration", "trainer_params.items"]
0
[]
The function (test_n2v_configuration_all_trainer_combinations) defined within the public class called public.The function start at line 862 and ends at 909. It contains 41 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 func...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_empty_trainer_params
def test_n2v_configuration_empty_trainer_params():"""Test that empty trainer_params dict works correctly."""config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,num_epochs=None,trainer_params={},)# Should have empty dict (no trainer params)assert config.tr...
1
11
0
52
1
912
925
912
['config']
None
{"Assign": 1, "Expr": 1}
1
14
1
["create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_empty_trainer_params) defined within the public class called public.The function start at line 912 and ends at 925. It contains 11 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,...
CAREamics_careamics
public
public
0
0
test_n2v_configuration_trainer_params_none
def test_n2v_configuration_trainer_params_none():"""Test that trainer_params=None works correctly (default behavior)."""config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,num_epochs=None,trainer_params=None,)# Should have empty dict when trainer_params i...
1
11
0
51
1
928
941
928
['config']
None
{"Assign": 1, "Expr": 1}
1
14
1
["create_n2v_configuration"]
0
[]
The function (test_n2v_configuration_trainer_params_none) defined within the public class called public.The function start at line 928 and ends at 941. It contains 11 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, ...
CAREamics_careamics
public
public
0
0
test_checkpoint_model_save_top_k_default
def test_checkpoint_model_save_top_k_default():"""CheckpointModel's default save_top_k=3 doesn't conflict with trainer params."""from careamics.config.callback_model import CheckpointModel# Test default save_top_k valuecheckpoint_model = CheckpointModel()assert checkpoint_model.save_top_k == 3# Test that default works ...
1
14
0
75
2
944
963
944
['config', 'checkpoint_model']
None
{"Assign": 2, "Expr": 1}
2
20
2
["CheckpointModel", "create_n2v_configuration"]
0
[]
The function (test_checkpoint_model_save_top_k_default) defined within the public class called public.The function start at line 944 and ends at 963. 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. It declares 2.0 functions, ...
CAREamics_careamics
public
public
0
0
test_checkpoint_model_comprehensive_checkpoint_params
def test_checkpoint_model_comprehensive_checkpoint_params():"""Test comprehensive checkpoint parameters with save_top_k=3 default."""checkpoint_params = {"save_top_k": 3,# explicit default"monitor": "val_loss","mode": "min","save_weights_only": False,"save_last": True,"every_n_epochs": 1,"verbose": True,}config = creat...
1
27
0
123
3
966
996
966
['config', 'checkpoint_callback', 'checkpoint_params']
None
{"Assign": 3, "Expr": 1}
1
31
1
["create_n2v_configuration"]
0
[]
The function (test_checkpoint_model_comprehensive_checkpoint_params) defined within the public class called public.The function start at line 966 and ends at 996. It contains 27 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_checkpoint_model_save_top_k_with_resource_constraints
def test_checkpoint_model_save_top_k_with_resource_constraints():"""Test checkpoint save_top_k behavior with resource constraint scenarios."""# Test with limited training steps - checkpointing should still workconfig = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_...
1
13
0
81
1
999
1,014
999
['config']
None
{"Assign": 1, "Expr": 1}
1
16
1
["create_n2v_configuration"]
0
[]
The function (test_checkpoint_model_save_top_k_with_resource_constraints) defined within the public class called public.The function start at line 999 and ends at 1014. 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 decla...
CAREamics_careamics
public
public
0
0
test_checkpoint_model_save_top_k_edge_cases
def test_checkpoint_model_save_top_k_edge_cases():"""Test edge cases for save_top_k parameter."""import pytestfrom careamics.config.callback_model import CheckpointModel# Test that save_top_k accepts valid range (-1 to 100)checkpoint_model = CheckpointModel(save_top_k=-1)# Save allassert checkpoint_model.save_top_k == ...
1
13
0
88
1
1,017
1,039
1,017
['checkpoint_model']
None
{"Assign": 3, "Expr": 3, "With": 2}
7
23
7
["CheckpointModel", "CheckpointModel", "CheckpointModel", "pytest.raises", "CheckpointModel", "pytest.raises", "CheckpointModel"]
0
[]
The function (test_checkpoint_model_save_top_k_edge_cases) defined within the public class called public.The function start at line 1017 and ends at 1039. 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 7.0 functi...
CAREamics_careamics
public
public
0
0
test_checkpoint_model_save_top_k_with_development_modes
def test_checkpoint_model_save_top_k_with_development_modes():"""Test checkpoint save_top_k with various development and debugging modes."""# Test with overfit_batches (overfitting mode)config = create_n2v_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch_size=8,trainer_params={"...
1
34
0
207
1
1,042
1,081
1,042
['config']
None
{"Assign": 3, "Expr": 1}
3
40
3
["create_n2v_configuration", "create_n2v_configuration", "create_n2v_configuration"]
0
[]
The function (test_checkpoint_model_save_top_k_with_development_modes) defined within the public class called public.The function start at line 1042 and ends at 1081. It contains 34 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...
CAREamics_careamics
public
public
0
0
test_checkpoint_model_save_top_k_cross_algorithm_consistency
def test_checkpoint_model_save_top_k_cross_algorithm_consistency():"""Test that save_top_k behavior is consistent across all three algorithms."""checkpoint_params = {"save_top_k": 5, "monitor": "val_loss"}# Test N2Vn2v_config = create_n2v_configuration(experiment_name="test_n2v",data_type="tiff",axes="YX",patch_size=[6...
1
35
0
187
4
1,084
1,128
1,084
['n2n_config', 'n2v_config', 'checkpoint_params', 'care_config']
None
{"Assign": 4, "Expr": 1}
3
45
3
["create_n2v_configuration", "create_care_configuration", "create_n2n_configuration"]
0
[]
The function (test_checkpoint_model_save_top_k_cross_algorithm_consistency) defined within the public class called public.The function start at line 1084 and ends at 1128. It contains 35 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 de...
CAREamics_careamics
public
public
0
0
test_microsplit_configuration
def test_microsplit_configuration(tmp_path: Path, create_dummy_noise_model):"""Test that MicroSplit configuration can be created."""np.savez(tmp_path / "dummy_noise_model.npz", **create_dummy_noise_model)config = create_microsplit_configuration(experiment_name="test",data_type="tiff",axes="YX",patch_size=[64, 64],batch...
1
18
2
118
1
1,131
1,150
1,131
tmp_path,create_dummy_noise_model
['config']
None
{"Assign": 1, "Expr": 2}
3
20
3
["np.savez", "create_microsplit_configuration", "isinstance"]
0
[]
The function (test_microsplit_configuration) defined within the public class called public.The function start at line 1131 and ends at 1150. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [1131.0] and does not return any value. It declares 3.0 functions, and ...
CAREamics_careamics
public
public
0
0
test_config_to_yaml
def test_config_to_yaml(tmp_path: Path, minimum_supervised_configuration: dict):"""Test that we can export a config to yaml and load it back"""# test that we can instantiate a configmyconf = Configuration(**minimum_supervised_configuration)# export to yamlyaml_path = save_configuration(myconf, tmp_path)assert yaml_path...
1
6
2
43
3
12
24
12
tmp_path,minimum_supervised_configuration
['yaml_path', 'myconf', 'my_other_conf']
None
{"Assign": 3, "Expr": 1}
4
13
4
["Configuration", "save_configuration", "yaml_path.exists", "load_configuration"]
0
[]
The function (test_config_to_yaml) defined within the public class called public.The function start at line 12 and ends at 24. It contains 6 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 funct...
CAREamics_careamics
public
public
0
0
test_config_to_yaml_wrong_path
def test_config_to_yaml_wrong_path(tmp_path: Path, minimum_supervised_configuration: dict):"""Test that an error is raised when the path is not a directory and not a .yml"""# test that we can instantiate a configmyconf = Configuration(**minimum_supervised_configuration)# export to yamlyaml_path = tmp_path / "tmp.txt"wi...
1
10
2
57
2
27
43
27
tmp_path,minimum_supervised_configuration
['yaml_path', 'myconf']
None
{"Assign": 2, "Expr": 4, "With": 2}
6
17
6
["Configuration", "pytest.raises", "save_configuration", "yaml_path.touch", "pytest.raises", "save_configuration"]
0
[]
The function (test_config_to_yaml_wrong_path) defined within the public class called public.The function start at line 27 and ends at 43. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [27.0] and does not return any value. It declares 6.0 functions, and It h...
CAREamics_careamics
public
public
0
0
test_wrong_extensions
def test_wrong_extensions(minimum_inference: dict, ext: str):"""Test that supported model raises ValueError for unsupported extensions."""minimum_inference["data_type"] = ext# instantiate InferenceModel modelwith pytest.raises(ValueError):InferenceConfig(**minimum_inference)
1
4
2
31
0
7
13
7
minimum_inference,ext
[]
None
{"Assign": 1, "Expr": 2, "With": 1}
3
7
3
["pytest.raises", "InferenceConfig", "pytest.mark.parametrize"]
0
[]
The function (test_wrong_extensions) defined within the public class called public.The function start at line 7 and ends at 13. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [7.0] and does not return any value. It declares 3.0 functions, and It has 3.0 funct...
CAREamics_careamics
public
public
0
0
test_mean_std_both_specified_or_none
def test_mean_std_both_specified_or_none(minimum_inference: dict):"""Test error raising when setting mean and std."""# Errors if both are Noneminimum_inference["image_means"] = []minimum_inference["image_stds"] = []with pytest.raises(ValueError):InferenceConfig(**minimum_inference)# Error if only mean is definedminimum...
1
15
1
112
0
16
38
16
minimum_inference
[]
None
{"Assign": 6, "Expr": 6, "With": 3}
8
23
8
["pytest.raises", "InferenceConfig", "pytest.raises", "InferenceConfig", "minimum_inference.pop", "pytest.raises", "InferenceConfig", "InferenceConfig"]
0
[]
The function (test_mean_std_both_specified_or_none) defined within the public class called public.The function start at line 16 and ends at 38. 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. It declares 8.0 functions, and I...
CAREamics_careamics
public
public
0
0
test_tile_size
def test_tile_size(minimum_inference: dict):"""Test that non-zero even patch size are accepted."""# no tilingprediction_model = InferenceConfig(**minimum_inference)# 2Dminimum_inference["tile_size"] = [16, 8]minimum_inference["tile_overlap"] = [2, 2]minimum_inference["axes"] = "YX"prediction_model = InferenceConfig(**m...
1
14
1
121
1
41
62
41
minimum_inference
['prediction_model']
None
{"Assign": 9, "Expr": 1}
3
22
3
["InferenceConfig", "InferenceConfig", "InferenceConfig"]
0
[]
The function (test_tile_size) defined within the public class called public.The function start at line 41 and ends at 62. 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. It declares 3.0 functions, and It has 3.0 functions ca...
CAREamics_careamics
public
public
0
0
test_wrong_tile_size
def test_wrong_tile_size(minimum_inference: dict, tile_size):"""Test that wrong patch sizes are not accepted (zero or odd, dims 1 or > 3)."""minimum_inference["axes"] = "ZYX" if len(tile_size) == 3 else "YX"minimum_inference["tile_size"] = tile_sizewith pytest.raises(ValueError):InferenceConfig(**minimum_inference)
2
5
2
44
0
68
74
68
minimum_inference,tile_size
[]
None
{"Assign": 2, "Expr": 2, "With": 1}
4
7
4
["len", "pytest.raises", "InferenceConfig", "pytest.mark.parametrize"]
0
[]
The function (test_wrong_tile_size) defined within the public class called public.The function start at line 68 and ends at 74. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [68.0] and does not return any value. It declares 4.0 functions, and It has 4.0 func...
CAREamics_careamics
public
public
0
0
test_wrong_tile_overlap
def test_wrong_tile_overlap(minimum_inference: dict, tile_size, tile_overlap):"""Test that wrong patch sizes are not accepted (zero or odd, dims 1 or > 3)."""minimum_inference["axes"] = "ZYX" if len(tile_size) == 3 else "YX"minimum_inference["tile_size"] = tile_sizeminimum_inference["tile_overlap"] = tile_overlapwith p...
2
6
3
52
0
80
87
80
minimum_inference,tile_size,tile_overlap
[]
None
{"Assign": 3, "Expr": 2, "With": 1}
4
8
4
["len", "pytest.raises", "InferenceConfig", "pytest.mark.parametrize"]
0
[]
The function (test_wrong_tile_overlap) defined within the public class called public.The function start at line 80 and ends at 87. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [80.0] and does not return any value. It declares 4.0 functions, and It has 4.0 f...
CAREamics_careamics
public
public
0
0
test_set_3d
def test_set_3d(minimum_inference: dict):"""Test that 3D can be set."""minimum_inference["tile_size"] = [64, 64]minimum_inference["tile_overlap"] = [32, 32]pred = InferenceConfig(**minimum_inference)assert "Z" not in pred.axesassert len(pred.tile_size) == 2assert len(pred.tile_overlap) == 2# error if changing Z manuall...
1
19
1
171
1
90
117
90
minimum_inference
['pred']
None
{"Assign": 8, "Expr": 2, "With": 3}
11
28
11
["InferenceConfig", "len", "len", "pytest.raises", "InferenceConfig", "pytest.raises", "pytest.raises", "InferenceConfig", "pred.set_3D", "len", "len"]
0
[]
The function (test_set_3d) defined within the public class called public.The function start at line 90 and ends at 117. It contains 19 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 11.0 functions, and It has 11.0 functions ca...
CAREamics_careamics
public
public
0
0
test_correct_transform_parameters
def test_correct_transform_parameters(minimum_algorithm_n2v: dict):"""Test that the transforms have the correct parameters.This is important to know that the transforms are not all instantiated asa generic transform."""model = N2VAlgorithm(**minimum_algorithm_n2v)# N2VManipulateparams = model.n2v_config.model_dump()ass...
1
8
1
44
2
14
28
14
minimum_algorithm_n2v
['params', 'model']
None
{"Assign": 2, "Expr": 1}
2
15
2
["N2VAlgorithm", "model.n2v_config.model_dump"]
0
[]
The function (test_correct_transform_parameters) defined within the public class called public.The function start at line 14 and ends at 28. 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. It declares 2.0 functions, and It ha...
CAREamics_careamics
public
public
0
0
test_passing_incorrect_element
def test_passing_incorrect_element(minimum_algorithm_n2v: dict):"""Test that incorrect element in the list of transforms raises an error (e.g. passing un object rather than a string)."""minimum_algorithm_n2v["n2v_config"] = {"name": get_all_transforms()[SupportedTransform.XY_FLIP.value]()}with pytest.raises(ValueError)...
1
6
1
42
0
31
38
31
minimum_algorithm_n2v
[]
None
{"Assign": 1, "Expr": 2, "With": 1}
3
8
3
["get_all_transforms", "pytest.raises", "N2VAlgorithm"]
0
[]
The function (test_passing_incorrect_element) defined within the public class called public.The function start at line 31 and ends at 38. 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 declares 3.0 functions, and It has 3...
CAREamics_careamics
public
public
0
0
test_set_struct_mask
def test_set_struct_mask(minimum_algorithm_n2v: dict):"""Test that the struct mask can be set."""none = SupportedStructAxis.NONE.valuevertical = SupportedStructAxis.VERTICAL.valuehorizontal = SupportedStructAxis.HORIZONTAL.valuemodel = N2VAlgorithm(**minimum_algorithm_n2v)assert model.n2v_config.name == SupportedTransf...
1
20
1
154
4
41
65
41
minimum_algorithm_n2v
['horizontal', 'none', 'vertical', 'model']
None
{"Assign": 10, "Expr": 1}
1
25
1
["N2VAlgorithm"]
0
[]
The function (test_set_struct_mask) defined within the public class called public.The function start at line 41 and ends at 65. It contains 20 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_set_struct_mask_wrong_value
def test_set_struct_mask_wrong_value(minimum_algorithm_n2v: dict):"""Test that passing a wrong struct mask axis raises an error."""model = N2VAlgorithm(**minimum_algorithm_n2v)with pytest.raises(ValueError):model.n2v_config.struct_mask_axis = "wrong_value"with pytest.raises(ValueError):model.n2v_config.struct_mask_span...
1
6
1
45
1
68
75
68
minimum_algorithm_n2v
['model']
None
{"Assign": 3, "Expr": 1, "With": 2}
3
8
3
["N2VAlgorithm", "pytest.raises", "pytest.raises"]
0
[]
The function (test_set_struct_mask_wrong_value) defined within the public class called public.The function start at line 68 and ends at 75. 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 declares 3.0 functions, and It has...
CAREamics_careamics
public
public
0
0
test_optimizer_parameters
def test_optimizer_parameters(optimizer_name: SupportedOptimizer, parameters: dict):"""Test optimizer parameters filtering.For parameters, see:https://pytorch.org/docs/stable/optim.html#algorithms"""# add non valid parameternew_parameters = parameters.copy()new_parameters["some_random_one"] = 42# create optimizer and c...
1
5
2
43
2
35
47
35
optimizer_name,parameters
['optimizer', 'new_parameters']
None
{"Assign": 3, "Expr": 1}
3
13
3
["parameters.copy", "OptimizerModel", "pytest.mark.parametrize"]
0
[]
The function (test_optimizer_parameters) defined within the public class called public.The function start at line 35 and ends at 47. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [35.0] and does not return any value. It declares 3.0 functions, and It has 3.0...
CAREamics_careamics
public
public
0
0
test_sgd_missing_parameter
def test_sgd_missing_parameter():"""Test that SGD optimizer fails if `lr` is not provided.Note: The SGD optimizer requires the `lr` parameter."""with pytest.raises(ValueError):OptimizerModel(name=SupportedOptimizer.SGD.value, parameters={})# test that it works if lr is providedoptimizer = OptimizerModel(name=SupportedO...
1
7
0
62
1
50
62
50
['optimizer']
None
{"Assign": 1, "Expr": 2, "With": 1}
3
13
3
["pytest.raises", "OptimizerModel", "OptimizerModel"]
0
[]
The function (test_sgd_missing_parameter) defined within the public class called public.The function start at line 50 and ends at 62. 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 3.0 functions, and It has 3.0 f...
CAREamics_careamics
public
public
0
0
test_optimizer_wrong_values_by_assignments
def test_optimizer_wrong_values_by_assignments():"""Test that wrong values cause an error during assignment."""optimizer = OptimizerModel(name=SupportedOptimizer.ADAM.value, parameters={"lr": 0.08})# nameoptimizer.name = SupportedOptimizer.SGD.valuewith pytest.raises(ValueError):optimizer.name = "MyOptim"# parametersop...
1
10
0
73
1
65
79
65
['optimizer']
None
{"Assign": 5, "Expr": 1, "With": 2}
3
15
3
["OptimizerModel", "pytest.raises", "pytest.raises"]
0
[]
The function (test_optimizer_wrong_values_by_assignments) defined within the public class called public.The function start at line 65 and ends at 79. 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, ...
CAREamics_careamics
public
public
0
0
test_optimizer_to_dict_optional
def test_optimizer_to_dict_optional():""" "Test that export to dict includes optional values."""config = {"name": "Adam","parameters": {"lr": 0.1,"betas": (0.1, 0.11),},}optim_minimum = OptimizerModel(**config).model_dump()assert optim_minimum == config
1
10
0
51
2
82
93
82
['optim_minimum', 'config']
None
{"Assign": 2, "Expr": 1}
2
12
2
["model_dump", "OptimizerModel"]
0
[]
The function (test_optimizer_to_dict_optional) defined within the public class called public.The function start at line 82 and ends at 93. 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.0 functions, and It has...
CAREamics_careamics
public
public
0
0
test_scheduler_parameters
def test_scheduler_parameters(lr_scheduler_name: SupportedScheduler, parameters: dict):"""Test lr scheduler parameters filtering.For parameters, see:https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate"""# add non valid parameternew_parameters = parameters.copy()new_parameters["some_random_one"] = 42#...
1
5
2
43
2
122
134
122
lr_scheduler_name,parameters
['lr_scheduler', 'new_parameters']
None
{"Assign": 3, "Expr": 1}
3
13
3
["parameters.copy", "LrSchedulerModel", "pytest.mark.parametrize"]
0
[]
The function (test_scheduler_parameters) defined within the public class called public.The function start at line 122 and ends at 134. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [122.0] and does not return any value. It declares 3.0 functions, and It has ...
CAREamics_careamics
public
public
0
0
test_scheduler_missing_parameter
def test_scheduler_missing_parameter():"""Test that StepLR scheduler fails if `step_size` is not provided"""with pytest.raises(ValueError):LrSchedulerModel(name=SupportedScheduler.STEP_LR.value, parameters={})# test that it works if lr is providedlr_scheduler = LrSchedulerModel(name=SupportedScheduler.STEP_LR.value, pa...
1
7
0
58
1
137
146
137
['lr_scheduler']
None
{"Assign": 1, "Expr": 2, "With": 1}
3
10
3
["pytest.raises", "LrSchedulerModel", "LrSchedulerModel"]
0
[]
The function (test_scheduler_missing_parameter) defined within the public class called public.The function start at line 137 and ends at 146. 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 3.0 functions, and It h...
CAREamics_careamics
public
public
0
0
test_defaults
def test_defaults():"""Test instantiating time information with defaults."""tile_info = TileInformation(array_shape=np.zeros((1, 6, 6)).shape,overlap_crop_coords=((1, 2),),stitch_coords=((3, 4),),sample_id=0,)assert tile_info.array_shape == (1, 6, 6)assert not tile_info.last_tile
1
9
0
70
1
7
17
7
['tile_info']
None
{"Assign": 1, "Expr": 1}
2
11
2
["TileInformation", "np.zeros"]
0
[]
The function (test_defaults) defined within the public class called public.The function start at line 7 and ends at 17. 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 It has 2.0 functions calle...
CAREamics_careamics
public
public
0
0
test_error_on_coords
def test_error_on_coords():"""Test than an error is raised if no coordinates are given."""with pytest.raises(ValueError):TileInformation(array_shape=(1, 6, 6))
1
3
0
25
0
20
23
20
[]
None
{"Expr": 2, "With": 1}
2
4
2
["pytest.raises", "TileInformation"]
0
[]
The function (test_error_on_coords) defined within the public class called public.The function start at line 20 and ends at 23. 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_error_n_dims
def test_error_n_dims(array_shape):"""Test that an error is raised if the array shape does not have 3 or 4 dimensions."""with pytest.raises(ValueError):TileInformation(array_shape=array_shape,overlap_crop_coords=((1, 2),),stitch_coords=((3, 4),),sample_id=0,)
1
8
1
47
0
27
37
27
array_shape
[]
None
{"Expr": 2, "With": 1}
3
11
3
["pytest.raises", "TileInformation", "pytest.mark.parametrize"]
0
[]
The function (test_error_n_dims) defined within the public class called public.The function start at line 27 and ends at 37. 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. It declares 3.0 functions, and It has 3.0 functions ...
CAREamics_careamics
public
public
0
0
test_tile_equality
def test_tile_equality():"""Test whether two tile information objects are equal."""t1 = TileInformation(array_shape=(1, 6, 6),last_tile=True,overlap_crop_coords=((1, 2),),stitch_coords=((3, 4),),sample_id=0,)t2 = TileInformation(array_shape=(1, 6, 6),last_tile=True,overlap_crop_coords=((1, 2),),stitch_coords=((3, 4),),...
1
27
0
179
2
40
72
40
['t1', 't2']
None
{"Assign": 9, "Expr": 1}
2
33
2
["TileInformation", "TileInformation"]
0
[]
The function (test_tile_equality) defined within the public class called public.The function start at line 40 and ends at 72. It contains 27 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 function...
CAREamics_careamics
public
public
0
0
test_all_algorithms_are_supported
def test_all_algorithms_are_supported():"""Test that all algorithms defined in the Literal are supported."""# list of supported algorithmsalgorithms = list(SupportedAlgorithm)# Algorithm json schema to extract the literal valueschema = UNetBasedAlgorithm.model_json_schema()# check that all algorithms are supportedfor a...
2
5
0
36
2
8
18
8
['schema', 'algorithms']
None
{"Assign": 2, "Expr": 1, "For": 1}
2
11
2
["list", "UNetBasedAlgorithm.model_json_schema"]
0
[]
The function (test_all_algorithms_are_supported) defined within the public class called public.The function start at line 8 and ends at 18. It contains 5 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, and It has...
CAREamics_careamics
public
public
0
0
test_all_losses_are_supported
def test_all_losses_are_supported():"""Test that all losses defined in the Literal are supported."""# list of supported losseslosses = list(SupportedLoss)# Algorithm json schemaschema = UNetBasedAlgorithm.model_json_schema()# check that all losses are supportedfor loss in schema["properties"]["loss"]["enum"]:assert los...
2
5
0
36
2
22
32
22
['losses', 'schema']
None
{"Assign": 2, "Expr": 1, "For": 1}
2
11
2
["list", "UNetBasedAlgorithm.model_json_schema"]
0
[]
The function (test_all_losses_are_supported) defined within the public class called public.The function start at line 22 and ends at 32. It contains 5 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, and It has 2....
CAREamics_careamics
public
public
0
0
test_all_losses_are_supported
def test_all_losses_are_supported():"""Test that all losses defined in the Literal are supported."""# list of supported losseslosses = list(SupportedLoss)# Algorithm json schemaschema = VAEBasedAlgorithm.model_json_schema()# check that all losses are supportedfor loss in schema["properties"]["loss"]["enum"]:assert loss...
2
5
0
36
2
23
33
23
['losses', 'schema']
None
{"Assign": 2, "Expr": 1, "For": 1}
3
11
3
["list", "VAEBasedAlgorithm.model_json_schema", "pytest.mark.skip"]
0
[]
The function (test_all_losses_are_supported) defined within the public class called public.The function start at line 23 and ends at 33. It contains 5 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 3.0 functions, and It has 3....
CAREamics_careamics
public
public
0
0
test_noise_model_usplit
def test_noise_model_usplit(minimum_algorithm_musplit):"""Test that the noise model is correctly provided."""config = VAEBasedAlgorithm(**minimum_algorithm_musplit)assert config.noise_model is None
1
3
1
19
1
37
40
37
minimum_algorithm_musplit
['config']
None
{"Assign": 1, "Expr": 1}
2
4
2
["VAEBasedAlgorithm", "pytest.mark.skip"]
0
[]
The function (test_noise_model_usplit) 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 declares 2.0 functions, and It has 2.0 func...
CAREamics_careamics
public
public
0
0
test_noise_model_denoisplit
def test_noise_model_denoisplit(tmp_path: Path, create_dummy_noise_model):"""Test that the noise model is correctly provided."""# TODO this construct with the minimum_config dicts is increasingly annoying# Create a dummy noise modelnp.savez(tmp_path / "dummy_noise_model.npz", **create_dummy_noise_model)# Instantiate th...
1
13
2
76
2
44
63
44
tmp_path,create_dummy_noise_model
['gmm', 'config']
None
{"Assign": 2, "Expr": 2}
6
20
6
["np.savez", "GaussianMixtureNMConfig", "VAEBasedAlgorithm", "LVAEModel", "MultiChannelNMConfig", "pytest.mark.skip"]
0
[]
The function (test_noise_model_denoisplit) defined within the public class called public.The function start at line 44 and ends at 63. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [44.0] and does not return any value. It declares 6.0 functions, and It has ...
CAREamics_careamics
public
public
0
0
test_no_noise_model_error_denoisplit
def test_no_noise_model_error_denoisplit(minimum_algorithm_denoisplit):"""Test that the noise model is correctly provided."""minimum_algorithm_denoisplit["noise_model"] = Nonewith pytest.raises(ValueError):VAEBasedAlgorithm(**minimum_algorithm_denoisplit)
1
4
1
25
0
66
70
66
minimum_algorithm_denoisplit
[]
None
{"Assign": 1, "Expr": 2, "With": 1}
2
5
2
["pytest.raises", "VAEBasedAlgorithm"]
0
[]
The function (test_no_noise_model_error_denoisplit) defined within the public class called public.The function start at line 66 and ends at 70. 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, and It...
CAREamics_careamics
public
public
0
0
test_microsplit_algorithm
def test_microsplit_algorithm(minimum_algorithm_microsplit):"""Test that the MicroSplit algorithm can be instantiated correctly."""loss = LVAELossConfig(loss_type="denoisplit_musplit", denoisplit_weight=0.9, musplit_weight=0.1)# TODO losses need to be refactored! This is just for exampleminimum_algorithm_microsplit["lo...
1
9
1
60
2
73
82
73
minimum_algorithm_microsplit
['config', 'loss']
None
{"Assign": 3, "Expr": 1}
2
10
2
["LVAELossConfig", "VAEBasedAlgorithm"]
0
[]
The function (test_microsplit_algorithm) defined within the public class called public.The function start at line 73 and ends at 82. 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 It has 2.0 fu...
CAREamics_careamics
public
public
0
0
test_instantiation
def test_instantiation():"""Test the instantiation of the CAREAlgorithm class."""model = {"architecture": "UNet",}CAREAlgorithm(model=model)
1
5
0
19
1
6
11
6
['model']
None
{"Assign": 1, "Expr": 2}
1
6
1
["CAREAlgorithm"]
0
[]
The function (test_instantiation) defined within the public class called public.The function start at line 6 and ends at 11. 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 declare 1.0 function, and It has 1.0 function cal...
CAREamics_careamics
public
public
0
0
test_no_n2v2
def test_no_n2v2():"""Check that an error is raised if the model is set for n2v2."""model = {"architecture": "UNet","n2v2": True,}with pytest.raises(ValueError):CAREAlgorithm(model=model)
1
7
0
31
1
14
22
14
['model']
None
{"Assign": 1, "Expr": 2, "With": 1}
2
9
2
["pytest.raises", "CAREAlgorithm"]
0
[]
The function (test_no_n2v2) defined within the public class called public.The function start at line 14 and ends at 22. 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 has 2.0 functions calle...
CAREamics_careamics
public
public
0
0
test_no_final_activation
def test_no_final_activation(minimum_algorithm_supervised: dict):"""Check that an error is raised if the model has a final activation."""minimum_algorithm_supervised["model"] = {"architecture": "UNet","final_activation": "ReLU",}with pytest.raises(ValueError):CAREAlgorithm(**minimum_algorithm_supervised)
1
7
1
36
0
25
32
25
minimum_algorithm_supervised
[]
None
{"Assign": 1, "Expr": 2, "With": 1}
2
8
2
["pytest.raises", "CAREAlgorithm"]
0
[]
The function (test_no_final_activation) defined within the public class called public.The function start at line 25 and ends at 32. 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 has 2.0 fun...
CAREamics_careamics
public
public
0
0
test_instantiation
def test_instantiation():"""Test the instantiation of the N2NAlgorithm class."""model = {"architecture": "UNet",}N2NAlgorithm(model=model)
1
5
0
19
1
6
11
6
['model']
None
{"Assign": 1, "Expr": 2}
1
6
1
["N2NAlgorithm"]
0
[]
The function (test_instantiation) defined within the public class called public.The function start at line 6 and ends at 11. 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 declare 1.0 function, and It has 1.0 function cal...
CAREamics_careamics
public
public
0
0
test_no_n2v2
def test_no_n2v2():"""Check that an error is raised if the model is set for n2v2."""model = {"architecture": "UNet","n2v2": True,}with pytest.raises(ValueError):N2NAlgorithm(model=model)
1
7
0
31
1
14
22
14
['model']
None
{"Assign": 1, "Expr": 2, "With": 1}
2
9
2
["pytest.raises", "N2NAlgorithm"]
0
[]
The function (test_no_n2v2) defined within the public class called public.The function start at line 14 and ends at 22. 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 has 2.0 functions calle...
CAREamics_careamics
public
public
0
0
test_no_final_activation
def test_no_final_activation(minimum_algorithm_supervised: dict):"""Check that an error is raised if the model has a final activation."""minimum_algorithm_supervised["model"] = {"architecture": "UNet","final_activation": "ReLU",}with pytest.raises(ValueError):N2NAlgorithm(**minimum_algorithm_supervised)
1
7
1
36
0
25
32
25
minimum_algorithm_supervised
[]
None
{"Assign": 1, "Expr": 2, "With": 1}
2
8
2
["pytest.raises", "N2NAlgorithm"]
0
[]
The function (test_no_final_activation) defined within the public class called public.The function start at line 25 and ends at 32. 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 has 2.0 fun...
CAREamics_careamics
public
public
0
0
test_n_channels_n2v
def test_n_channels_n2v():"""Check that an error is raised if n2v has different number of channels ininput and output."""model = {"architecture": "UNet","in_channels": 1,"num_classes": 2,"n2v2": False,}loss = "n2v"with pytest.raises(ValueError):N2VAlgorithm(algorithm="n2v", loss=loss, model=model)
1
10
0
50
2
7
19
7
['loss', 'model']
None
{"Assign": 2, "Expr": 2, "With": 1}
2
13
2
["pytest.raises", "N2VAlgorithm"]
0
[]
The function (test_n_channels_n2v) defined within the public class called public.The function start at line 7 and ends at 19. 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.0 functions, and It has 2.0 function...
CAREamics_careamics
public
public
0
0
test_channels
def test_channels(minimum_algorithm_n2v: dict):"""Check that error is thrown if the number of channels are different."""minimum_algorithm_n2v["model"] = {"architecture": "UNet","in_channels": 2,"num_classes": 2,"n2v2": False,}N2VAlgorithm(**minimum_algorithm_n2v)minimum_algorithm_n2v["model"]["num_classes"] = 3with pyt...
1
11
1
58
0
22
34
22
minimum_algorithm_n2v
[]
None
{"Assign": 2, "Expr": 3, "With": 1}
3
13
3
["N2VAlgorithm", "pytest.raises", "N2VAlgorithm"]
0
[]
The function (test_channels) defined within the public class called public.The function start at line 22 and ends at 34. It contains 11 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 cal...
CAREamics_careamics
public
public
0
0
test_no_final_activation
def test_no_final_activation(minimum_algorithm_n2v: dict):"""Check that an error is raised if the model has a final activation."""minimum_algorithm_n2v["model"] = {"architecture": "UNet","final_activation": "ReLU",}with pytest.raises(ValueError):N2VAlgorithm(**minimum_algorithm_n2v)
1
7
1
36
0
37
44
37
minimum_algorithm_n2v
[]
None
{"Assign": 1, "Expr": 2, "With": 1}
2
8
2
["pytest.raises", "N2VAlgorithm"]
0
[]
The function (test_no_final_activation) defined within the public class called public.The function start at line 37 and ends at 44. 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 has 2.0 fun...
CAREamics_careamics
public
public
0
0
test_set_n2v_strategy
def test_set_n2v_strategy(minimum_algorithm_n2v: dict):"""Test that the N2V2 can be set."""uniform = SupportedPixelManipulation.UNIFORM.valuemedian = SupportedPixelManipulation.MEDIAN.value# Test defaultcfg = N2VAlgorithm(**minimum_algorithm_n2v)assert cfg.n2v_config.strategy == uniform# Test setting to n2v2cfg.set_n2v...
1
11
1
81
3
47
64
47
minimum_algorithm_n2v
['cfg', 'uniform', 'median']
None
{"Assign": 3, "Expr": 3}
3
18
3
["N2VAlgorithm", "cfg.set_n2v2", "cfg.set_n2v2"]
0
[]
The function (test_set_n2v_strategy) defined within the public class called public.The function start at line 47 and ends at 64. It contains 11 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_model_dump
def test_model_dump():"""Test that architecture keyword is removed from the model dump."""model_params = {"architecture": "LeCorbusier"}model = ArchitectureModel(**model_params)# dump modelmodel_dict = model.model_dump()assert model_dict == {}
1
5
0
31
3
4
11
4
['model_dict', 'model_params', 'model']
None
{"Assign": 3, "Expr": 1}
2
8
2
["ArchitectureModel", "model.model_dump"]
0
[]
The function (test_model_dump) defined within the public class called public.The function start at line 4 and ends at 11. 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 functions cal...
CAREamics_careamics
public
public
0
0
test_instantiation
def test_instantiation():"""Test that LVAEModel can be instantiated."""model_params = {"architecture": "LVAE",}# instantiate modelLVAEModel(**model_params)
1
5
0
18
1
9
16
9
['model_params']
None
{"Assign": 1, "Expr": 2}
1
8
1
["LVAEModel"]
0
[]
The function (test_instantiation) defined within the public class called public.The function start at line 9 and ends at 16. 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 declare 1.0 function, and It has 1.0 function cal...
CAREamics_careamics
public
public
0
0
test_architecture_missing
def test_architecture_missing():"""Test that LVAEModel requires architecture."""model_params = {"input_shape": 64,}with pytest.raises(ValueError):LVAEModel(**model_params)
1
6
0
26
1
19
26
19
['model_params']
None
{"Assign": 1, "Expr": 2, "With": 1}
2
8
2
["pytest.raises", "LVAEModel"]
0
[]
The function (test_architecture_missing) 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 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 fu...
CAREamics_careamics
public
public
0
0
test_encoder_n_filters
def test_encoder_n_filters(encoder_n_filters: int):"""Test that LVAEModel accepts num_channels_init as an even number andminimum 8."""model_params = {"architecture": "LVAE", "encoder_n_filters": encoder_n_filters}# instantiate modelLVAEModel(**model_params)
1
3
1
24
1
30
36
30
encoder_n_filters
['model_params']
None
{"Assign": 1, "Expr": 2}
2
7
2
["LVAEModel", "pytest.mark.parametrize"]
0
[]
The function (test_encoder_n_filters) defined within the public class called public.The function start at line 30 and ends at 36. 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 funct...
CAREamics_careamics
public
public
0
0
test_decoder_n_filters
def test_decoder_n_filters(decoder_n_filters: int):"""Test that LVAEModel accepts num_channels_init as an even number andminimum 8."""model_params = {"architecture": "LVAE", "decoder_n_filters": decoder_n_filters}# instantiate modelLVAEModel(**model_params)
1
3
1
24
1
40
46
40
decoder_n_filters
['model_params']
None
{"Assign": 1, "Expr": 2}
2
7
2
["LVAEModel", "pytest.mark.parametrize"]
0
[]
The function (test_decoder_n_filters) defined within the public class called public.The function start at line 40 and ends at 46. 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 funct...
CAREamics_careamics
public
public
0
0
test_wrong_num_filters
def test_wrong_num_filters(n_filters: int):"""Test that wrong num_channels_init causes an error."""model_params = {"architecture": "LVAE", "encoder_n_filters": n_filters}with pytest.raises(ValueError):LVAEModel(**model_params)model_params = {"architecture": "LVAE", "decoder_n_filters": n_filters}with pytest.raises(Valu...
1
7
1
56
1
50
58
50
n_filters
['model_params']
None
{"Assign": 2, "Expr": 3, "With": 2}
5
9
5
["pytest.raises", "LVAEModel", "pytest.raises", "LVAEModel", "pytest.mark.parametrize"]
0
[]
The function (test_wrong_num_filters) defined within the public class called public.The function start at line 50 and ends at 58. 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 5.0 functions, and It has 5.0 funct...
CAREamics_careamics
public
public
0
0
test_activations
def test_activations():"""Test that LVAEModel accepts all activations."""for act in SupportedActivation:model_params = {"architecture": "LVAE","nonlinearity": act.value,}# instantiate modelLVAEModel(**model_params)
2
7
0
29
1
61
70
61
['model_params']
None
{"Assign": 1, "Expr": 2, "For": 1}
1
10
1
["LVAEModel"]
0
[]
The function (test_activations) defined within the public class called public.The function start at line 61 and ends at 70. It contains 7 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 declare 1.0 function, and It has 1.0 function call...
CAREamics_careamics
public
public
0
0
test_all_activations_are_supported
def test_all_activations_are_supported():"""Test that all activations defined in the Literal are supported."""# list of supported activationsactivations = list(SupportedActivation)# Algorithm json schemaschema = LVAEModel.model_json_schema()# check that all activations are supportedfor act in schema["properties"]["nonl...
2
5
0
36
2
73
83
73
['schema', 'activations']
None
{"Assign": 2, "Expr": 1, "For": 1}
2
11
2
["list", "LVAEModel.model_json_schema"]
0
[]
The function (test_all_activations_are_supported) defined within the public class called public.The function start at line 73 and ends at 83. It contains 5 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, and It h...
CAREamics_careamics
public
public
0
0
test_activation_wrong_values
def test_activation_wrong_values():"""Test that wrong values are not accepted."""model_params = {"architecture": "LVAE","nonlinearity": "wrong",}with pytest.raises(ValueError):LVAEModel(**model_params)
1
7
0
30
1
86
94
86
['model_params']
None
{"Assign": 1, "Expr": 2, "With": 1}
2
9
2
["pytest.raises", "LVAEModel"]
0
[]
The function (test_activation_wrong_values) defined within the public class called public.The function start at line 86 and ends at 94. 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 has 2.0...
CAREamics_careamics
public
public
0
0
test_parameters_wrong_values_by_assigment
def test_parameters_wrong_values_by_assigment():"""Test that wrong values are not accepted through assignment."""model_params = {"architecture": "LVAE","z_dims": (128, 128, 128),"multiscale_count": 2,"encoder_n_filters": 32,}model = LVAEModel(**model_params)# z_dimsmodel.z_dims = model_params["z_dims"]with pytest.raise...
1
14
0
81
2
97
115
97
['model_params', 'model']
None
{"Assign": 6, "Expr": 1, "With": 2}
3
19
3
["LVAEModel", "pytest.raises", "pytest.raises"]
0
[]
The function (test_parameters_wrong_values_by_assigment) defined within the public class called public.The function start at line 97 and ends at 115. 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. It declares 3.0 functions, ...
CAREamics_careamics
public
public
0
0
test_instantiation
def test_instantiation():"""Test that UNetModel can be instantiated."""model_params = {"architecture": "UNet","conv_dim": 2,"num_channels_init": 16,}# instantiate modelUNetModel(**model_params)
1
7
0
26
1
7
16
7
['model_params']
None
{"Assign": 1, "Expr": 2}
1
10
1
["UNetModel"]
0
[]
The function (test_instantiation) defined within the public class called public.The function start at line 7 and ends at 16. 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 declare 1.0 function, and It has 1.0 function cal...
CAREamics_careamics
public
public
0
0
test_architecture_missing
def test_architecture_missing():"""Test that UNetModel requires architecture."""model_params = {"depth": 2,"num_channels_init": 16,}with pytest.raises(ValueError):UNetModel(**model_params)
1
7
0
30
1
19
27
19
['model_params']
None
{"Assign": 1, "Expr": 2, "With": 1}
2
9
2
["pytest.raises", "UNetModel"]
0
[]
The function (test_architecture_missing) defined within the public class called public.The function start at line 19 and ends at 27. 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 has 2.0 fu...
CAREamics_careamics
public
public
0
0
test_num_channels_init
def test_num_channels_init(num_channels_init: int):"""Test that UNetModel accepts num_channels_init as an even number andminimum 8."""model_params = {"architecture": "UNet", "num_channels_init": num_channels_init}# instantiate modelUNetModel(**model_params)
1
3
1
24
1
31
37
31
num_channels_init
['model_params']
None
{"Assign": 1, "Expr": 2}
2
7
2
["UNetModel", "pytest.mark.parametrize"]
0
[]
The function (test_num_channels_init) defined within the public class called public.The function start at line 31 and ends at 37. 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 funct...
CAREamics_careamics
public
public
0
0
test_wrong_num_channels_init
def test_wrong_num_channels_init(num_channels_init: int):"""Test that wrong num_channels_init causes an error."""model_params = {"architecture": "UNet", "num_channels_init": num_channels_init}with pytest.raises(ValueError):UNetModel(**model_params)
1
4
1
32
1
41
46
41
num_channels_init
['model_params']
None
{"Assign": 1, "Expr": 2, "With": 1}
3
6
3
["pytest.raises", "UNetModel", "pytest.mark.parametrize"]
0
[]
The function (test_wrong_num_channels_init) defined within the public class called public.The function start at line 41 and ends at 46. 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 3.0 functions, and It has 3.0...
CAREamics_careamics
public
public
0
0
test_activations
def test_activations():"""Test that UNetModel accepts all activations."""for act in SupportedActivation:if act != SupportedActivation.ELU:model_params = {"architecture": "UNet","num_channels_init": 16,"final_activation": act.value,}# instantiate modelUNetModel(**model_params)
3
9
0
40
1
49
60
49
['model_params']
None
{"Assign": 1, "Expr": 2, "For": 1, "If": 1}
1
12
1
["UNetModel"]
0
[]
The function (test_activations) defined within the public class called public.The function start at line 49 and ends at 60. It contains 9 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 function call...
CAREamics_careamics
public
public
0
0
test_all_activations_are_supported
def test_all_activations_are_supported():"""Test that all activations defined in the Literal are supported."""# list of supported activationsactivations = list(SupportedActivation)# Algorithm json schemaschema = UNetModel.model_json_schema()# check that all activations are supportedfor act in schema["properties"]["fina...
2
5
0
36
2
63
73
63
['schema', 'activations']
None
{"Assign": 2, "Expr": 1, "For": 1}
2
11
2
["list", "UNetModel.model_json_schema"]
0
[]
The function (test_all_activations_are_supported) defined within the public class called public.The function start at line 63 and ends at 73. It contains 5 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, and It h...
CAREamics_careamics
public
public
0
0
test_activation_wrong_values
def test_activation_wrong_values():"""Test that wrong values are not accepted."""model_params = {"architecture": "UNet","num_channels_init": 16,"final_activation": "wrong",}with pytest.raises(ValueError):UNetModel(**model_params)
1
8
0
34
1
76
85
76
['model_params']
None
{"Assign": 1, "Expr": 2, "With": 1}
2
10
2
["pytest.raises", "UNetModel"]
0
[]
The function (test_activation_wrong_values) defined within the public class called public.The function start at line 76 and ends at 85. 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. It declares 2.0 functions, and It has 2.0...
CAREamics_careamics
public
public
0
0
test_parameters_wrong_values_by_assigment
def test_parameters_wrong_values_by_assigment():"""Test that wrong values are not accepted through assignment."""model_params = {"architecture": "UNet", "num_channels_init": 16, "depth": 2}model = UNetModel(**model_params)# depthmodel.depth = model_params["depth"]with pytest.raises(ValueError):model.depth = -1# number ...
1
9
0
70
2
88
101
88
['model_params', 'model']
None
{"Assign": 6, "Expr": 1, "With": 2}
3
14
3
["UNetModel", "pytest.raises", "pytest.raises"]
0
[]
The function (test_parameters_wrong_values_by_assigment) defined within the public class called public.The function start at line 88 and ends at 101. 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 3.0 functions, a...
CAREamics_careamics
public
public
0
0
test_model_dump
def test_model_dump():"""Test that default values are excluded from model dump."""model_params = {"architecture": "UNet","num_channels_init": 16,# non-default value"final_activation": "ReLU",# non-default value}model = UNetModel(**model_params)# dump modelmodel_dict = model.model_dump(exclude_defaults=True)# check that...
1
12
0
75
3
104
122
104
['model_dict', 'model_params', 'model']
None
{"Assign": 4, "Expr": 1}
7
19
7
["UNetModel", "model.model_dump", "len", "model.model_dump", "len", "len", "dict"]
0
[]
The function (test_model_dump) defined within the public class called public.The function start at line 104 and ends at 122. It contains 12 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 7.0 functions, and It has 7.0 functions...
CAREamics_careamics
public
public
0
0
test_wrong_extensions
def test_wrong_extensions(minimum_data: dict, ext: str):"""Test that supported model raises ValueError for unsupported extensions."""minimum_data["data_type"] = ext# instantiate DataModel modelwith pytest.raises(ValueError):DataConfig(**minimum_data)
1
4
2
31
0
14
20
14
minimum_data,ext
[]
None
{"Assign": 1, "Expr": 2, "With": 1}
3
7
3
["pytest.raises", "DataConfig", "pytest.mark.parametrize"]
0
[]
The function (test_wrong_extensions) defined within the public class called public.The function start at line 14 and ends at 20. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [14.0] and does not return any value. It declares 3.0 functions, and It has 3.0 fun...
CAREamics_careamics
public
public
0
0
test_mean_std_non_negative
def test_mean_std_non_negative(minimum_data: dict, mean, std):"""Test that non negative mean and std are accepted."""minimum_data["image_means"] = [mean]minimum_data["image_stds"] = [std]minimum_data["target_means"] = [mean]minimum_data["target_stds"] = [std]data_model = DataConfig(**minimum_data)assert data_model.imag...
1
10
3
83
1
24
35
24
minimum_data,mean,std
['data_model']
None
{"Assign": 5, "Expr": 1}
2
12
2
["DataConfig", "pytest.mark.parametrize"]
0
[]
The function (test_mean_std_non_negative) defined within the public class called public.The function start at line 24 and ends at 35. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [24.0] and does not return any value. It declares 2.0 functions, and It has 2...
CAREamics_careamics
public
public
0
0
test_mean_std_both_specified_or_none
def test_mean_std_both_specified_or_none(minimum_data: dict):"""Test an error is raised if std is specified but mean is None."""# No error if both are NoneDataConfig(**minimum_data)# Error if only mean is definedminimum_data["image_means"] = [10.4]with pytest.raises(ValueError):DataConfig(**minimum_data)# Error if only...
1
15
1
115
0
38
62
38
minimum_data
[]
None
{"Assign": 5, "Expr": 7, "With": 3}
9
25
9
["DataConfig", "pytest.raises", "DataConfig", "minimum_data.pop", "pytest.raises", "DataConfig", "DataConfig", "pytest.raises", "DataConfig"]
0
[]
The function (test_mean_std_both_specified_or_none) defined within the public class called public.The function start at line 38 and ends at 62. 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. It declares 9.0 functions, and I...
CAREamics_careamics
public
public
0
0
test_set_mean_and_std
def test_set_mean_and_std(minimum_data: dict):"""Test that mean and std can be set after initialization."""# they can be set both, when they Nonemean = [4.07]std = [14.07]data = DataConfig(**minimum_data)data.set_means_and_stds(mean, std)assert data.image_means == meanassert data.image_stds == std# Set also target mean...
1
10
1
73
3
65
78
65
minimum_data
['mean', 'std', 'data']
None
{"Assign": 3, "Expr": 3}
3
14
3
["DataConfig", "data.set_means_and_stds", "data.set_means_and_stds"]
0
[]
The function (test_set_mean_and_std) defined within the public class called public.The function start at line 65 and ends at 78. 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 funct...
CAREamics_careamics
public
public
0
0
test_normalize_not_accepted
def test_normalize_not_accepted(minimum_data: dict):"""Test that normalize is not accepted, because it is mandatory and applied elsewhere."""minimum_data["image_means"] = [10.4]minimum_data["image_stds"] = [3.2]minimum_data["transforms"] = [NormalizeModel(image_means=[0.485], image_stds=[0.229])]with pytest.raises(Valu...
1
8
1
66
0
81
91
81
minimum_data
[]
None
{"Assign": 3, "Expr": 2, "With": 1}
3
11
3
["NormalizeModel", "pytest.raises", "DataConfig"]
0
[]
The function (test_normalize_not_accepted) defined within the public class called public.The function start at line 81 and ends at 91. 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. It declares 3.0 functions, and It has 3.0 ...
CAREamics_careamics
public
public
0
0
test_patch_size
def test_patch_size(minimum_data: dict):"""Test that non-zero even patch size are accepted."""# 2Ddata_model = DataConfig(**minimum_data)# 3Dminimum_data["patch_size"] = [16, 8, 8]minimum_data["axes"] = "ZYX"data_model = DataConfig(**minimum_data)assert data_model.patch_size == minimum_data["patch_size"]
1
6
1
49
1
94
104
94
minimum_data
['data_model']
None
{"Assign": 4, "Expr": 1}
2
11
2
["DataConfig", "DataConfig"]
0
[]
The function (test_patch_size) defined within the public class called public.The function start at line 94 and ends at 104. 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 declares 2.0 functions, and It has 2.0 functions c...
CAREamics_careamics
public
public
0
0
test_wrong_patch_size
def test_wrong_patch_size(minimum_data: dict, patch_size):"""Test that wrong patch sizes are not accepted (zero or odd, dims 1 or > 3)."""minimum_data["axes"] = "ZYX" if len(patch_size) == 3 else "YX"minimum_data["patch_size"] = patch_sizewith pytest.raises(ValueError):DataConfig(**minimum_data)
2
5
2
44
0
110
116
110
minimum_data,patch_size
[]
None
{"Assign": 2, "Expr": 2, "With": 1}
4
7
4
["len", "pytest.raises", "DataConfig", "pytest.mark.parametrize"]
0
[]
The function (test_wrong_patch_size) defined within the public class called public.The function start at line 110 and ends at 116. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [110.0] and does not return any value. It declares 4.0 functions, and It has 4.0 ...
CAREamics_careamics
public
public
0
0
test_set_3d
def test_set_3d(minimum_data: dict):"""Test that 3D can be set."""data = DataConfig(**minimum_data)assert "Z" not in data.axesassert len(data.patch_size) == 2# error if changing Z manuallywith pytest.raises(ValueError):data.axes = "ZYX"# or patch sizedata = DataConfig(**minimum_data)with pytest.raises(ValueError):data....
1
13
1
106
1
119
138
119
minimum_data
['data']
None
{"Assign": 5, "Expr": 2, "With": 2}
8
20
8
["DataConfig", "len", "pytest.raises", "DataConfig", "pytest.raises", "DataConfig", "data.set_3D", "len"]
0
[]
The function (test_set_3d) defined within the public class called public.The function start at line 119 and ends at 138. 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 8.0 functions, and It has 8.0 functions cal...