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_passing_empty_transforms | def test_passing_empty_transforms(minimum_data: dict):"""Test that empty list of transforms can be passed."""minimum_data["transforms"] = []DataConfig(**minimum_data) | 1 | 3 | 1 | 20 | 0 | 141 | 144 | 141 | minimum_data | [] | None | {"Assign": 1, "Expr": 2} | 1 | 4 | 1 | ["DataConfig"] | 0 | [] | The function (test_passing_empty_transforms) defined within the public class called public.The function start at line 141 and ends at 144. 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.... |
CAREamics_careamics | public | public | 0 | 0 | test_passing_incorrect_element | def test_passing_incorrect_element(minimum_data: dict):"""Test that incorrect element in the list of transforms raises an error (e.g. passing un object rather than a string)."""minimum_data["transforms"] = [{"name": get_all_transforms()[SupportedTransform.XY_FLIP.value]()},]with pytest.raises(ValueError):DataConfig(**m... | 1 | 6 | 1 | 45 | 0 | 147 | 154 | 147 | minimum_data | [] | None | {"Assign": 1, "Expr": 2, "With": 1} | 3 | 8 | 3 | ["get_all_transforms", "pytest.raises", "DataConfig"] | 0 | [] | The function (test_passing_incorrect_element) defined within the public class called public.The function start at line 147 and ends at 154. 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_no_shuffle_in_train_dataloader_params | def test_no_shuffle_in_train_dataloader_params(minimum_data: dict):"""Test that an error is raised if there is no "shuffle" value in`train_dataloader_params`."""minimum_data["train_dataloader_params"] = {"num_workers": 4}with pytest.raises(ValueError):DataConfig(**minimum_data) | 1 | 4 | 1 | 31 | 0 | 157 | 164 | 157 | minimum_data | [] | None | {"Assign": 1, "Expr": 2, "With": 1} | 2 | 8 | 2 | ["pytest.raises", "DataConfig"] | 0 | [] | The function (test_no_shuffle_in_train_dataloader_params) defined within the public class called public.The function start at line 157 and ends at 164. 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,... |
CAREamics_careamics | public | public | 0 | 0 | test_export_to_yaml_float32_stats | def test_export_to_yaml_float32_stats(tmp_path, minimum_data: dict):"""Test exporting and loading the pydantic model when the statistics arenp.float32."""data = DataConfig(**minimum_data)# set np.float32 stats valuesdata.set_means_and_stds([np.float32(1234.5678)], [np.float32(21.73)])# export to yamlconfig_path = tmp_p... | 1 | 9 | 2 | 116 | 4 | 167 | 184 | 167 | tmp_path,minimum_data | ['config_path', 'read_data', 'data', 'dictionary'] | None | {"Assign": 4, "Expr": 3, "With": 1} | 12 | 18 | 12 | ["DataConfig", "data.set_means_and_stds", "np.float32", "np.float32", "open", "yaml.dump", "data.model_dump", "yaml.load", "config_path.open", "DataConfig", "read_data.model_dump", "data.model_dump"] | 0 | [] | The function (test_export_to_yaml_float32_stats) defined within the public class called public.The function start at line 167 and ends at 184. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [167.0] and does not return any value. It declares 12.0 functions, and... |
CAREamics_careamics | public | public | 0 | 0 | test_ng_data_model_strategy | def test_ng_data_model_strategy(patching_strategy):# Test the DataModel classdata_model = NGDataConfig(data_type="array",axes="YX",patching=patching_strategy,)assert data_model.patching.name == patching_strategy["name"] | 1 | 7 | 1 | 33 | 1 | 28 | 37 | 28 | patching_strategy | ['data_model'] | None | {"Assign": 1} | 2 | 10 | 2 | ["NGDataConfig", "pytest.mark.parametrize"] | 0 | [] | The function (test_ng_data_model_strategy) defined within the public class called public.The function start at line 28 and ends at 37. 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_ng_dataset_invalid_axes_patch | def test_ng_dataset_invalid_axes_patch(axes, patching_strategy):with pytest.raises(ValueError):NGDataConfig(data_type="array",axes=axes,patching=patching_strategy,) | 1 | 7 | 2 | 30 | 0 | 63 | 70 | 63 | axes,patching_strategy | [] | None | {"Expr": 1, "With": 1} | 3 | 8 | 3 | ["pytest.raises", "NGDataConfig", "pytest.mark.parametrize"] | 0 | [] | The function (test_ng_dataset_invalid_axes_patch) defined within the public class called public.The function start at line 63 and ends at 70. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [63.0] and does not return any value. It declares 3.0 functions, and I... |
CAREamics_careamics | public | public | 0 | 0 | test_patch_sizes_error | def test_patch_sizes_error(patch_size):"""Test that the random patching"""with pytest.raises(ValueError):_PatchedModel(patch_size=patch_size) | 1 | 3 | 1 | 20 | 0 | 18 | 21 | 18 | patch_size | [] | None | {"Expr": 2, "With": 1} | 3 | 4 | 3 | ["pytest.raises", "_PatchedModel", "pytest.mark.parametrize"] | 0 | [] | The function (test_patch_sizes_error) defined within the public class called public.The function start at line 18 and ends at 21. 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_patch_overlaps_error | def test_patch_overlaps_error(patch_size, overlap):"""Test that the random patching"""with pytest.raises(ValueError):_OverlappingPatchedModel(patch_size=patch_size, overlaps=overlap) | 1 | 3 | 2 | 26 | 0 | 32 | 35 | 32 | patch_size,overlap | [] | None | {"Expr": 2, "With": 1} | 3 | 4 | 3 | ["pytest.raises", "_OverlappingPatchedModel", "pytest.mark.parametrize"] | 0 | [] | The function (test_patch_overlaps_error) defined within the public class called public.The function start at line 32 and ends at 35. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [32.0] and does not return any value. It declares 3.0 functions, and It has 3.0... |
CAREamics_careamics | public | public | 0 | 0 | test_extension_pattern_tiff_fnmatch | def test_extension_pattern_tiff_fnmatch(tmp_path: Path):"""Test that the TIFF extension is compatible with fnmatch."""path = tmp_path / "test.tif"# test as strassert fnmatch(str(path), SupportedData.get_extension_pattern(SupportedData.TIFF))# test as Pathassert fnmatch(path, SupportedData.get_extension_pattern(Supporte... | 1 | 4 | 1 | 44 | 1 | 11 | 19 | 11 | tmp_path | ['path'] | None | {"Assign": 1, "Expr": 1} | 5 | 9 | 5 | ["fnmatch", "str", "SupportedData.get_extension_pattern", "fnmatch", "SupportedData.get_extension_pattern"] | 0 | [] | The function (test_extension_pattern_tiff_fnmatch) defined within the public class called public.The function start at line 11 and ends at 19. 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 5.0 functions, and It ... |
CAREamics_careamics | public | public | 0 | 0 | test_extension_pattern_tiff_rglob | def test_extension_pattern_tiff_rglob(tmp_path: Path):"""Test that the TIFF extension is compatible with Path.rglob."""# create text filetext_path = tmp_path / "test.txt"text_path.write_text("test")# create imagepath = tmp_path / "test.tif"image = np.ones((10, 10))tifffile.imwrite(path, image)# search for filesfiles = ... | 1 | 11 | 1 | 76 | 4 | 22 | 38 | 22 | tmp_path | ['image', 'files', 'path', 'text_path'] | None | {"Assign": 4, "Expr": 3} | 7 | 17 | 7 | ["text_path.write_text", "np.ones", "tifffile.imwrite", "list", "tmp_path.rglob", "SupportedData.get_extension_pattern", "len"] | 0 | [] | The function (test_extension_pattern_tiff_rglob) defined within the public class called public.The function start at line 22 and ends at 38. 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 7.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | test_extension_pattern_custom_fnmatch | def test_extension_pattern_custom_fnmatch(tmp_path: Path):"""Test that the custom extension is compatible with fnmatch."""path = tmp_path / "test.czi"# test as strassert fnmatch(str(path), SupportedData.get_extension_pattern(SupportedData.CUSTOM))# test as Pathassert fnmatch(path, SupportedData.get_extension_pattern(Su... | 1 | 4 | 1 | 44 | 1 | 41 | 49 | 41 | tmp_path | ['path'] | None | {"Assign": 1, "Expr": 1} | 5 | 9 | 5 | ["fnmatch", "str", "SupportedData.get_extension_pattern", "fnmatch", "SupportedData.get_extension_pattern"] | 0 | [] | The function (test_extension_pattern_custom_fnmatch) defined within the public class called public.The function start at line 41 and ends at 49. 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 5.0 functions, and I... |
CAREamics_careamics | public | public | 0 | 0 | test_extension_pattern_custom_rglob | def test_extension_pattern_custom_rglob(tmp_path: Path):"""Test that the custom extension is compatible with Path.rglob."""# create text filetext_path = tmp_path / "test.txt"text_path.write_text("test")# create imagepath = tmp_path / "test.npy"image = np.ones((10, 10))np.save(path, image)# search for filesfiles = list(... | 1 | 11 | 1 | 80 | 4 | 52 | 68 | 52 | tmp_path | ['image', 'files', 'path', 'text_path'] | None | {"Assign": 4, "Expr": 3} | 8 | 17 | 8 | ["text_path.write_text", "np.ones", "np.save", "list", "tmp_path.rglob", "SupportedData.get_extension_pattern", "len", "set"] | 0 | [] | The function (test_extension_pattern_custom_rglob) defined within the public class called public.The function start at line 52 and ends at 68. 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 8.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_extension_pattern_array_error | def test_extension_pattern_array_error():"""Test that the array extension raises NotImplementedError."""with pytest.raises(NotImplementedError):SupportedData.get_extension_pattern(SupportedData.ARRAY) | 1 | 3 | 0 | 21 | 0 | 71 | 74 | 71 | [] | None | {"Expr": 2, "With": 1} | 2 | 4 | 2 | ["pytest.raises", "SupportedData.get_extension_pattern"] | 0 | [] | The function (test_extension_pattern_array_error) defined within the public class called public.The function start at line 71 and ends at 74. 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 h... | |
CAREamics_careamics | public | public | 0 | 0 | test_extension_pattern_any_error | def test_extension_pattern_any_error():"""Test that any extension raises ValueError."""with pytest.raises(ValueError):SupportedData.get_extension_pattern("some random") | 1 | 3 | 0 | 19 | 0 | 77 | 80 | 77 | [] | None | {"Expr": 2, "With": 1} | 2 | 4 | 2 | ["pytest.raises", "SupportedData.get_extension_pattern"] | 0 | [] | The function (test_extension_pattern_any_error) defined within the public class called public.The function start at line 77 and ends at 80. 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... | |
CAREamics_careamics | public | public | 0 | 0 | test_extension_array_error | def test_extension_array_error():"""Test that the array extension raises NotImplementedError."""with pytest.raises(NotImplementedError):SupportedData.get_extension(SupportedData.ARRAY) | 1 | 3 | 0 | 21 | 0 | 83 | 86 | 83 | [] | None | {"Expr": 2, "With": 1} | 2 | 4 | 2 | ["pytest.raises", "SupportedData.get_extension"] | 0 | [] | The function (test_extension_array_error) 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 f... | |
CAREamics_careamics | public | public | 0 | 0 | test_extension_tiff | def test_extension_tiff():"""Test that the tiff extension is .tiff."""assert SupportedData.get_extension(SupportedData.TIFF) == ".tiff" | 1 | 2 | 0 | 16 | 0 | 89 | 91 | 89 | [] | None | {"Expr": 1} | 1 | 3 | 1 | ["SupportedData.get_extension"] | 0 | [] | The function (test_extension_tiff) defined within the public class called public.The function start at line 89 and ends at 91. 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 c... | |
CAREamics_careamics | public | public | 0 | 0 | test_extension_custom_error | def test_extension_custom_error():"""Test that the custom extension returns NotImplementedError."""with pytest.raises(NotImplementedError):SupportedData.get_extension(SupportedData.CUSTOM) | 1 | 3 | 0 | 21 | 0 | 94 | 97 | 94 | [] | None | {"Expr": 2, "With": 1} | 2 | 4 | 2 | ["pytest.raises", "SupportedData.get_extension"] | 0 | [] | The function (test_extension_custom_error) defined within the public class called public.The function start at line 94 and ends at 97. 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 ... | |
CAREamics_careamics | public | public | 0 | 0 | test_extension_any_error | def test_extension_any_error():"""Test that any extension raises ValueError."""with pytest.raises(ValueError):SupportedData.get_extension("some random") | 1 | 3 | 0 | 19 | 0 | 100 | 103 | 100 | [] | None | {"Expr": 2, "With": 1} | 2 | 4 | 2 | ["pytest.raises", "SupportedData.get_extension"] | 0 | [] | The function (test_extension_any_error) defined within the public class called public.The function start at line 100 and ends at 103. 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_schedulers_exist | def test_schedulers_exist():"""Test that `SupportedScheduler` contains existing torch schedulers."""for scheduler in SupportedScheduler:assert hasattr(optim.lr_scheduler, scheduler) | 2 | 3 | 0 | 19 | 0 | 9 | 12 | 9 | [] | None | {"Expr": 1, "For": 1} | 1 | 4 | 1 | ["hasattr"] | 0 | [] | The function (test_schedulers_exist) defined within the public class called public.The function start at line 9 and ends at 12. It contains 3 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 ... | |
CAREamics_careamics | public | public | 0 | 0 | test_optimizers_exist | def test_optimizers_exist():"""Test that `SupportedOptimizer` contains existing torch optimizers."""for optimizer in SupportedOptimizer:assert hasattr(optim, optimizer) | 2 | 3 | 0 | 17 | 0 | 15 | 18 | 15 | [] | None | {"Expr": 1, "For": 1} | 1 | 4 | 1 | ["hasattr"] | 0 | [] | The function (test_optimizers_exist) defined within the public class called public.The function start at line 15 and ends at 18. It contains 3 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... | |
CAREamics_careamics | public | public | 0 | 0 | test_odd_roi_and_mask | def test_odd_roi_and_mask():"""Test that errors are thrown if we pass even roi and mask sizes."""# no errormodel = N2VManipulateModel(roi_size=3, struct_mask_span=7)assert model.roi_size == 3assert model.struct_mask_span == 7# errorswith pytest.raises(ValueError):N2VManipulateModel(roi_size=4, struct_mask_span=7)with p... | 1 | 8 | 0 | 65 | 1 | 7 | 19 | 7 | ['model'] | None | {"Assign": 1, "Expr": 3, "With": 2} | 5 | 13 | 5 | ["N2VManipulateModel", "pytest.raises", "N2VManipulateModel", "pytest.raises", "N2VManipulateModel"] | 0 | [] | The function (test_odd_roi_and_mask) defined within the public class called public.The function start at line 7 and ends at 19. 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 5.0 functions, and It has 5.0 functio... | |
CAREamics_careamics | public | public | 0 | 0 | test_extra_parameters | def test_extra_parameters():"""Test that errors are thrown if we pass extra parameters."""with pytest.raises(ValueError):N2VManipulateModel(roi_size=3, struct_mask_span=7, extra_param=1) | 1 | 3 | 0 | 27 | 0 | 22 | 25 | 22 | [] | None | {"Expr": 2, "With": 1} | 2 | 4 | 2 | ["pytest.raises", "N2VManipulateModel"] | 0 | [] | The function (test_extra_parameters) defined within the public class called public.The function start at line 22 and ends at 25. 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 functi... | |
CAREamics_careamics | public | public | 0 | 0 | test_comptatibility_with_transform | def test_comptatibility_with_transform():"""Test that the model allows instantiating a transform."""model = N2VManipulateModel(roi_size=3, struct_mask_span=7, strategy="median")# instantiate transformN2VManipulate(**model.model_dump()) | 1 | 3 | 0 | 30 | 1 | 28 | 33 | 28 | ['model'] | None | {"Assign": 1, "Expr": 2} | 3 | 6 | 3 | ["N2VManipulateModel", "N2VManipulate", "model.model_dump"] | 0 | [] | The function (test_comptatibility_with_transform) defined within the public class called public.The function start at line 28 and ends at 33. 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 h... | |
CAREamics_careamics | public | public | 0 | 0 | test_setting_image_means_std | def test_setting_image_means_std():"""Test that we can set the image_means and std values."""model = NormalizeModel(image_means=[0.5], image_stds=[0.5])assert model.image_means == [0.5]assert model.image_stds == [0.5]model.image_means = [0.6]model.image_stds = [0.6]assert model.image_means == [0.6]assert model.image_st... | 1 | 26 | 0 | 236 | 1 | 7 | 37 | 7 | ['model'] | None | {"Assign": 8, "Expr": 1} | 2 | 31 | 2 | ["NormalizeModel", "NormalizeModel"] | 0 | [] | The function (test_setting_image_means_std) defined within the public class called public.The function start at line 7 and ends at 37. It contains 26 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_error_different_length_means_stds | def test_error_different_length_means_stds():"""Test that an error is raised if the image_means and stds have differentlengths."""with pytest.raises(ValueError):NormalizeModel(image_means=[0.5], image_stds=[0.5, 0.6])with pytest.raises(ValueError):NormalizeModel(image_means=[0.5, 0.6], image_stds=[0.5])with pytest.rais... | 1 | 31 | 0 | 229 | 0 | 40 | 77 | 40 | [] | None | {"Expr": 7, "With": 6} | 12 | 38 | 12 | ["pytest.raises", "NormalizeModel", "pytest.raises", "NormalizeModel", "pytest.raises", "NormalizeModel", "pytest.raises", "NormalizeModel", "pytest.raises", "NormalizeModel", "pytest.raises", "NormalizeModel"] | 0 | [] | The function (test_error_different_length_means_stds) defined within the public class called public.The function start at line 40 and ends at 77. It contains 31 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 12.0 functions, and... | |
CAREamics_careamics | public | public | 0 | 0 | test_comptatibility_with_transform | def test_comptatibility_with_transform():"""Test that the model allows instantiating a transform."""model = NormalizeModel(image_means=[0.5], image_stds=[0.5])# instantiate transformNormalize(**model.model_dump()) | 1 | 3 | 0 | 34 | 1 | 80 | 85 | 80 | ['model'] | None | {"Assign": 1, "Expr": 2} | 3 | 6 | 3 | ["NormalizeModel", "Normalize", "model.model_dump"] | 0 | [] | The function (test_comptatibility_with_transform) defined within the public class called public.The function start at line 80 and ends at 85. 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 h... | |
CAREamics_careamics | public | public | 0 | 0 | test_comptatibility_with_transform | def test_comptatibility_with_transform():"""Test that the model allows instantiating a transform."""model = XYFlipModel(flip_y=False, p=0.3)# instantiate transformXYFlip(**model.model_dump()) | 1 | 3 | 0 | 28 | 1 | 5 | 10 | 5 | ['model'] | None | {"Assign": 1, "Expr": 2} | 3 | 6 | 3 | ["XYFlipModel", "XYFlip", "model.model_dump"] | 0 | [] | The function (test_comptatibility_with_transform) defined within the public class called public.The function start at line 5 and ends at 10. 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 ha... | |
CAREamics_careamics | public | public | 0 | 0 | test_comptatibility_with_transform | def test_comptatibility_with_transform():"""Test that the model allows instantiating a transform."""model = XYRandomRotate90Model(p=0.3)# instantiate transformXYRandomRotate90(**model.model_dump()) | 1 | 3 | 0 | 24 | 1 | 5 | 10 | 5 | ['model'] | None | {"Assign": 1, "Expr": 2} | 3 | 6 | 3 | ["XYRandomRotate90Model", "XYRandomRotate90", "model.model_dump"] | 0 | [] | The function (test_comptatibility_with_transform) defined within the public class called public.The function start at line 5 and ends at 10. 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 ha... | |
CAREamics_careamics | public | public | 0 | 0 | test_model_without_n2v2 | def test_model_without_n2v2():"""Test the validation of the model without the `n2v2` attribute."""model = UNetModel(architecture="UNet", final_activation="None", n2v2=False)assert model_without_n2v2(model) == modelmodel = UNetModel(architecture="UNet", final_activation="None", n2v2=True)with pytest.raises(ValueError):m... | 1 | 6 | 0 | 56 | 1 | 11 | 18 | 11 | ['model'] | None | {"Assign": 2, "Expr": 2, "With": 1} | 5 | 8 | 5 | ["UNetModel", "model_without_n2v2", "UNetModel", "pytest.raises", "model_without_n2v2"] | 0 | [] | The function (test_model_without_n2v2) defined within the public class called public.The function start at line 11 and ends at 18. 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 5.0 functions, and It has 5.0 func... | |
CAREamics_careamics | public | public | 0 | 0 | test_model_without_final_activation | def test_model_without_final_activation():"""Test the validation of the model without the `final_activation` attribute."""model = UNetModel(architecture="UNet",final_activation="None",)assert model_without_final_activation(model) == modelmodel = UNetModel(architecture="UNet",final_activation="ReLU",)with pytest.raises(... | 1 | 12 | 0 | 50 | 1 | 21 | 34 | 21 | ['model'] | None | {"Assign": 2, "Expr": 2, "With": 1} | 5 | 14 | 5 | ["UNetModel", "model_without_final_activation", "UNetModel", "pytest.raises", "model_without_final_activation"] | 0 | [] | The function (test_model_without_final_activation) defined within the public class called public.The function start at line 21 and ends at 34. 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 5.0 functions, and It... | |
CAREamics_careamics | public | public | 0 | 0 | test_model_matching_in_out_channels | def test_model_matching_in_out_channels():"""Test the validation of the model with matching in and out channels."""model = UNetModel(architecture="UNet",in_channels=1,num_classes=1,)assert model_matching_in_out_channels(model) == modelmodel = UNetModel(architecture="UNet",in_channels=1,num_classes=2,)with pytest.raises... | 1 | 14 | 0 | 58 | 1 | 37 | 52 | 37 | ['model'] | None | {"Assign": 2, "Expr": 2, "With": 1} | 5 | 16 | 5 | ["UNetModel", "model_matching_in_out_channels", "UNetModel", "pytest.raises", "model_matching_in_out_channels"] | 0 | [] | The function (test_model_matching_in_out_channels) defined within the public class called public.The function start at line 37 and ends at 52. 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 5.0 functions, and It... | |
CAREamics_careamics | public | public | 0 | 0 | test_are_axes_valid | def test_are_axes_valid(axes, valid):"""Test if axes are valid"""if valid:check_axes_validity(axes)else:with pytest.raises((ValueError, NotImplementedError)):check_axes_validity(axes) | 2 | 6 | 2 | 33 | 0 | 42 | 48 | 42 | axes,valid | [] | None | {"Expr": 3, "If": 1, "With": 1} | 4 | 7 | 4 | ["check_axes_validity", "pytest.raises", "check_axes_validity", "pytest.mark.parametrize"] | 0 | [] | The function (test_are_axes_valid) defined within the public class called public.The function start at line 42 and ends at 48. It contains 6 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 4.0 functions, and It has 4.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_patch_size | def test_patch_size(patch_size, error):"""Test if patch size is valid."""if error:with pytest.raises(ValueError):patch_size_ge_than_8_power_of_2(patch_size)else:patch_size_ge_than_8_power_of_2(patch_size) | 2 | 6 | 2 | 29 | 0 | 64 | 70 | 64 | patch_size,error | [] | None | {"Expr": 3, "If": 1, "With": 1} | 4 | 7 | 4 | ["pytest.raises", "patch_size_ge_than_8_power_of_2", "patch_size_ge_than_8_power_of_2", "pytest.mark.parametrize"] | 0 | [] | The function (test_patch_size) defined within the public class called public.The function start at line 64 and ends at 70. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [64.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions... |
CAREamics_careamics | public | public | 0 | 0 | test_number_of_patches | def test_number_of_patches(ordered_array):"""Test the number of patches extracted from InMemoryDataset."""# create arrayarray = ordered_array((20, 20))# create configconfig_dict = {"data_type": SupportedData.ARRAY.value,"patch_size": [8, 8],"axes": "YX",}config = DataConfig(**config_dict)# create datasetdataset = InMem... | 1 | 13 | 1 | 74 | 4 | 10 | 30 | 10 | ordered_array | ['dataset', 'config', 'config_dict', 'array'] | None | {"Assign": 4, "Expr": 1} | 4 | 21 | 4 | ["ordered_array", "DataConfig", "InMemoryDataset", "len"] | 0 | [] | The function (test_number_of_patches) defined within the public class called public.The function start at line 10 and ends at 30. 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 functions, and It has 4.0 func... |
CAREamics_careamics | public | public | 0 | 0 | test_extracting_val_array | def test_extracting_val_array(ordered_array, percentage):"""Test extracting a validation set patches from InMemoryDataset."""# create arrayarray = ordered_array((32, 32))# create configconfig_dict = {"data_type": SupportedData.ARRAY.value,"patch_size": [8, 8],"axes": "YX",}config = DataConfig(**config_dict)# create dat... | 1 | 19 | 2 | 129 | 8 | 34 | 66 | 34 | ordered_array,percentage | ['config', 'array', 'minimum_patches', 'config_dict', 'n_patches', 'dataset', 'valset', 'total_n_patches'] | None | {"Assign": 8, "Expr": 1} | 12 | 33 | 12 | ["ordered_array", "DataConfig", "InMemoryDataset", "len", "max", "round", "dataset.split_dataset", "len", "len", "sum", "np.in1d", "pytest.mark.parametrize"] | 0 | [] | The function (test_extracting_val_array) defined within the public class called public.The function start at line 34 and ends at 66. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [34.0] and does not return any value. It declares 12.0 functions, and It has 1... |
CAREamics_careamics | public | public | 0 | 0 | test_extracting_val_files | def test_extracting_val_files(tmp_path, ordered_array, percentage):"""Test extracting a validation set patches from InMemoryDataset."""# create arrayarray = ordered_array((32, 32))# save array to filefile_path = tmp_path / "array.tif"tifffile.imwrite(file_path, array)# create configconfig_dict = {"data_type": Supported... | 1 | 21 | 3 | 146 | 9 | 70 | 106 | 70 | tmp_path,ordered_array,percentage | ['config', 'array', 'minimum_patches', 'config_dict', 'n_patches', 'dataset', 'valset', 'file_path', 'total_n_patches'] | None | {"Assign": 9, "Expr": 2} | 13 | 37 | 13 | ["ordered_array", "tifffile.imwrite", "DataConfig", "InMemoryDataset", "len", "max", "round", "dataset.split_dataset", "len", "len", "sum", "np.in1d", "pytest.mark.parametrize"] | 0 | [] | The function (test_extracting_val_files) defined within the public class called public.The function start at line 70 and ends at 106. It contains 21 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [70.0] and does not return any value. It declares 13.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_correct_normalized_outputs | def test_correct_normalized_outputs(shape, axes, expected_shape):"""Test that the dataset returns normalized images with singletonsample dimension."""rng = np.random.default_rng(42)# check expected lengthif "S" in axes:# find index of S and check shapeidx = axes.index("S")n_patches = shape[idx]else:n_patches = 1# check... | 5 | 29 | 3 | 229 | 9 | 20 | 72 | 20 | shape,axes,expected_shape | ['config', 'img', 'array', 'img2', 'n_patches', 'rng', 'dataset', 'idx', 'n_channels'] | None | {"Assign": 12, "Expr": 1, "For": 2, "If": 2} | 19 | 53 | 19 | ["np.random.default_rng", "axes.index", "axes.index", "rng.random", "InferenceConfig", "np.mean", "np.std", "InMemoryPredDataset", "len", "range", "len", "np.isclose", "np.mean", "np.isclose", "np.std", "range", "len", "np.allclose", "pytest.mark.parametrize"] | 0 | [] | The function (test_correct_normalized_outputs) defined within the public class called public.The function start at line 20 and ends at 72. It contains 29 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [20.0] and does not return any value. It declares 19.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_correct_normalized_outputs | def test_correct_normalized_outputs(shape, axes, expected_shape):"""Test that the dataset returns normalized images with singletonsample dimension."""rng = np.random.default_rng(42)tile_size = (8, 8, 8) if "Z" in axes else (8, 8)tile_overlap = (4, 4, 4) if "Z" in axes else (4, 4)# check expected lengthn_tiles = np.prod... | 7 | 40 | 3 | 336 | 11 | 21 | 86 | 21 | shape,axes,expected_shape | ['n_channels', 'config', 'tile_size', 'array', 'img', 'n_tiles', 'tile_overlap', 'rng', 'dataset', 'idx', 'n_samples'] | None | {"Assign": 16, "Expr": 1, "For": 2, "If": 2} | 25 | 66 | 25 | ["np.random.default_rng", "astype", "np.prod", "np.ceil", "np.array", "np.array", "np.array", "axes.index", "axes.index", "rng.random", "InferenceConfig", "np.mean", "np.std", "InMemoryTiledPredDataset", "len", "range", "len", "np.isclose", "np.mean", "np.isclose", "np.std", "range", "len", "np.allclose", "pytest.mark.... | 0 | [] | The function (test_correct_normalized_outputs) defined within the public class called public.The function start at line 21 and ends at 86. It contains 40 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [21.0] and does not return any value. It declares 25.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_number_of_files | def test_number_of_files(tmp_path, ordered_array, shape, axes, patch_size):"""Test number of files in PathIterableDataset."""# create arrayarray_size = 32n_files = 3factor = 3 if axes == "ZYX" else 2array = ordered_array(shape)# save three filesfiles = []for i in range(n_files):file = tmp_path / f"array{i}.tif"tifffile... | 3 | 22 | 5 | 140 | 10 | 21 | 54 | 21 | tmp_path,ordered_array,shape,axes,patch_size | ['factor', 'config', 'patches', 'array', 'file', 'array_size', 'files', 'n_files', 'config_dict', 'dataset'] | None | {"Assign": 10, "Expr": 3, "For": 1} | 9 | 34 | 9 | ["ordered_array", "range", "tifffile.imwrite", "files.append", "DataConfig", "PathIterableDataset", "list", "len", "pytest.mark.parametrize"] | 0 | [] | The function (test_number_of_files) defined within the public class called public.The function start at line 21 and ends at 54. It contains 22 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [21.0] and does not return any value. It declares 9.0 functions, and It has 9.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_read_function.read_npy | def read_npy(file_path, *args, **kwargs):return np.load(file_path) | 1 | 2 | 3 | 18 | 0 | 61 | 62 | 61 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_read_function.read_npy) defined within the public class called public.The function start at line 61 and ends at 62. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [61.0] and does not return any value.. |
CAREamics_careamics | public | public | 0 | 0 | test_read_function | def test_read_function(tmp_path, ordered_array):"""Test reading files in PathIterableDataset using a custom read function."""# read function for .npy filesdef read_npy(file_path, *args, **kwargs):return np.load(file_path)array_size = 32patch_size = 8n_files = 3patch_sizes = [patch_size] * 2# create arrayarray: np.ndarr... | 2 | 26 | 2 | 153 | 10 | 57 | 97 | 57 | tmp_path,ordered_array | ['patch_sizes', 'config', 'patches', 'files', 'array_size', 'n_files', 'config_dict', 'patch_size', 'dataset', 'file_path'] | Returns | {"AnnAssign": 1, "Assign": 10, "Expr": 3, "For": 1, "Return": 1} | 9 | 41 | 9 | ["np.load", "ordered_array", "range", "np.save", "files.append", "DataConfig", "PathIterableDataset", "list", "len"] | 0 | [] | The function (test_read_function) defined within the public class called public.The function start at line 57 and ends at 97. It contains 26 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [57.0], and this function return a value. It declares 9.0 functions, and It has 9.0 f... |
CAREamics_careamics | public | public | 0 | 0 | test_extracting_val_files | def test_extracting_val_files(tmp_path, ordered_array, percentage):"""Test extracting a validation set patches from PathIterableDataset."""# create arrayarray = ordered_array((20, 20))# save array to 25 filesfiles = []for i in range(25):file_path = tmp_path / f"array{i}.tif"tifffile.imwrite(file_path, array)files.appen... | 2 | 23 | 3 | 167 | 10 | 101 | 139 | 101 | tmp_path,ordered_array,percentage | ['config', 'array', 'minimum_files', 'total_n_files', 'files', 'n_files', 'config_dict', 'valset', 'dataset', 'file_path'] | None | {"Assign": 10, "Expr": 3, "For": 1} | 16 | 39 | 16 | ["ordered_array", "range", "tifffile.imwrite", "files.append", "DataConfig", "PathIterableDataset", "dataset.get_number_of_files", "max", "round", "dataset.split_dataset", "valset.get_number_of_files", "dataset.get_number_of_files", "isdisjoint", "set", "set", "pytest.mark.parametrize"] | 0 | [] | The function (test_extracting_val_files) defined within the public class called public.The function start at line 101 and ends at 139. It contains 23 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [101.0] and does not return any value. It declares 16.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_mean_std_transform_welford | def test_compute_mean_std_transform_welford(tmp_path, shape, axes, patch_size):"""Test that mean and std are computed and correctly added to the configurationand transform."""n_files = 10files = []array = np.random.randint(0, np.iinfo(np.uint16).max, (n_files, *shape))for i in range(n_files):file = tmp_path / f"array{i... | 3 | 21 | 4 | 200 | 8 | 150 | 181 | 150 | tmp_path,shape,axes,patch_size | ['config', 'array', 'file', 'files', 'n_files', 'config_dict', 'dataset', 'stats_axes'] | None | {"Assign": 9, "Expr": 3, "For": 1} | 15 | 32 | 15 | ["np.random.randint", "np.iinfo", "range", "tifffile.imwrite", "files.append", "DataConfig", "PathIterableDataset", "tuple", "np.delete", "np.arange", "np.allclose", "array.mean", "np.allclose", "array.std", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_mean_std_transform_welford) defined within the public class called public.The function start at line 150 and ends at 181. It contains 21 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [150.0] and does not return any value. It declares 15.0 functio... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_mean_std_transform_welford_with_targets | def test_compute_mean_std_transform_welford_with_targets(tmp_path, shape, axes, patch_size):"""Test that mean and std are computed and correctly added to the configurationand transform."""n_files = 10files = []target_files = []array = np.random.randint(0, np.iinfo(np.uint16).max, (n_files, *shape))target_array = np.ran... | 4 | 38 | 4 | 307 | 11 | 192 | 240 | 192 | tmp_path,shape,axes,patch_size | ['config', 'target_file', 'array', 'file', 'files', 'n_files', 'target_files', 'config_dict', 'dataset', 'stats_axes', 'target_array'] | None | {"Assign": 13, "Expr": 7, "For": 1} | 21 | 49 | 21 | ["np.random.randint", "np.iinfo", "np.random.randint", "np.iinfo", "range", "os.makedirs", "os.makedirs", "tifffile.imwrite", "tifffile.imwrite", "files.append", "target_files.append", "DataConfig", "PathIterableDataset", "tuple", "np.delete", "np.arange", "np.allclose", "target_array.mean", "np.allclose", "target_arra... | 0 | [] | The function (test_compute_mean_std_transform_welford_with_targets) defined within the public class called public.The function start at line 192 and ends at 240. It contains 38 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [192.0] and does not return any value. It declares... |
CAREamics_careamics | public | public | 0 | 0 | test_correct_normalized_outputs | def test_correct_normalized_outputs(tmp_path, n_files, shape, axes, expected_shape):"""Test that the dataset returns normalized images with singletonsample dimension."""rng = np.random.default_rng(42)# check expected lengthif "S" in axes:# find index of S and check shapeidx = axes.index("S")n_patches = shape[idx]else:n... | 6 | 36 | 5 | 284 | 12 | 28 | 90 | 28 | tmp_path,n_files,shape,axes,expected_shape | ['config', 'img', 'array', 'file', 'new_shape', 'files', 'img2', 'n_patches', 'rng', 'dataset', 'idx', 'n_channels'] | None | {"Assign": 16, "Expr": 3, "For": 3, "If": 2} | 23 | 63 | 23 | ["np.random.default_rng", "axes.index", "axes.index", "rng.random", "InferenceConfig", "np.mean", "np.std", "range", "tifffile.imwrite", "files.append", "IterablePredDataset", "list", "len", "range", "len", "np.isclose", "np.mean", "np.isclose", "np.std", "range", "len", "np.allclose", "pytest.mark.parametrize"] | 0 | [] | The function (test_correct_normalized_outputs) defined within the public class called public.The function start at line 28 and ends at 90. It contains 36 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [28.0] and does not return any value. It declares 23.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_correct_normalized_outputs | def test_correct_normalized_outputs(tmp_path, n_files, shape, axes, expected_shape):"""Test that the dataset returns normalized images with singletonsample dimension."""rng = np.random.default_rng(42)tile_size = (8, 8, 8) if "Z" in axes else (8, 8)tile_overlap = (4, 4, 4) if "Z" in axes else (4, 4)# check expected leng... | 8 | 47 | 5 | 391 | 14 | 29 | 104 | 29 | tmp_path,n_files,shape,axes,expected_shape | ['n_channels', 'config', 'tile_size', 'array', 'img', 'file', 'n_tiles', 'new_shape', 'files', 'tile_overlap', 'rng', 'dataset', 'idx', 'n_samples'] | None | {"Assign": 20, "Expr": 3, "For": 3, "If": 2} | 29 | 76 | 29 | ["np.random.default_rng", "astype", "np.prod", "np.ceil", "np.array", "np.array", "np.array", "axes.index", "axes.index", "rng.random", "InferenceConfig", "np.mean", "np.std", "range", "tifffile.imwrite", "files.append", "IterableTiledPredDataset", "list", "len", "range", "len", "np.isclose", "np.mean", "np.isclose", "... | 0 | [] | The function (test_correct_normalized_outputs) defined within the public class called public.The function start at line 29 and ends at 104. It contains 47 lines of code and it has a cyclomatic complexity of 8. It takes 5 parameters, represented as [29.0] and does not return any value. It declares 29.0 functions, and I... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_normalization_stats | def test_compute_normalization_stats(samples, channels):"""Test the compute_normalization_stats function."""# Create dataarray = np.arange(100 * samples * channels).reshape((samples, channels, 10, 10))# Compute mean and stdmean, std = compute_normalization_stats(image=array)for ch in range(array.shape[1]):assert np.isc... | 3 | 13 | 2 | 198 | 1 | 8 | 28 | 8 | samples,channels | ['array'] | None | {"Assign": 4, "Expr": 1, "For": 2} | 17 | 21 | 17 | ["reshape", "np.arange", "compute_normalization_stats", "range", "np.isclose", "mean", "np.isclose", "std", "reshape", "np.arange", "compute_normalization_stats", "range", "np.isclose", "mean", "np.isclose", "std", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_normalization_stats) defined within the public class called public.The function start at line 8 and ends at 28. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [8.0] and does not return any value. It declares 17.0 functions, and It ... |
CAREamics_careamics | public | public | 0 | 0 | test_get_files_size_tiff | def test_get_files_size_tiff(tmp_path: Path):"""Test getting size of multiple TIFF files."""# create arrayimage = np.ones((10, 10))# save array to tiffpath1 = tmp_path / "test1.tif"tifffile.imwrite(path1, image)path2 = tmp_path / "test2.tiff"tifffile.imwrite(path2, image)# save text filepath3 = tmp_path / "test3.txt"pa... | 1 | 15 | 1 | 99 | 8 | 15 | 42 | 15 | tmp_path | ['path3', 'path4', 'files', 'path1', 'subdirectory', 'image', 'path2', 'size'] | None | {"Assign": 8, "Expr": 6} | 7 | 28 | 7 | ["np.ones", "tifffile.imwrite", "tifffile.imwrite", "path3.write_text", "subdirectory.mkdir", "tifffile.imwrite", "get_files_size"] | 0 | [] | The function (test_get_files_size_tiff) defined within the public class called public.The function start at line 15 and ends at 42. 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 7.0 functions, and It has 7.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_list_single_file_tiff | def test_list_single_file_tiff(tmp_path: Path):"""Test listing a single TIFF file."""# create arrayimage = np.ones((10, 10))# save array to tiffpath = tmp_path / "test.tif"tifffile.imwrite(path, image)# list file using parent directoryfiles = list_files(tmp_path, SupportedData.TIFF)assert len(files) == 1assert files[0]... | 1 | 10 | 1 | 81 | 3 | 45 | 62 | 45 | tmp_path | ['files', 'path', 'image'] | None | {"Assign": 4, "Expr": 2} | 6 | 18 | 6 | ["np.ones", "tifffile.imwrite", "list_files", "len", "list_files", "len"] | 0 | [] | The function (test_list_single_file_tiff) defined within the public class called public.The function start at line 45 and ends at 62. 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 6.0 functions, and It has 6.0 ... |
CAREamics_careamics | public | public | 0 | 0 | test_list_multiple_files_tiff | def test_list_multiple_files_tiff(tmp_path: Path):"""Test listing multiple TIFF files in subdirectories with additional files."""# create arrayimage = np.ones((10, 10))# save array to /npypath1 = tmp_path / "test1.tif"tifffile.imwrite(path1, image)path2 = tmp_path / "test2.tif"tifffile.imwrite(path2, image)# save text ... | 1 | 18 | 1 | 127 | 8 | 65 | 97 | 65 | tmp_path | ['path3', 'path4', 'files', 'ref_files', 'path1', 'subdirectory', 'image', 'path2'] | None | {"Assign": 8, "Expr": 6} | 11 | 33 | 11 | ["np.ones", "tifffile.imwrite", "tifffile.imwrite", "path3.write_text", "subdirectory.mkdir", "tifffile.imwrite", "list_files", "len", "set", "set", "sorted"] | 0 | [] | The function (test_list_multiple_files_tiff) defined within the public class called public.The function start at line 65 and ends at 97. It contains 18 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 ... |
CAREamics_careamics | public | public | 0 | 0 | test_list_single_file_custom | def test_list_single_file_custom(tmp_path):"""Test listing a single custom file."""# create arrayimage = np.ones((10, 10))# save as .npypath = tmp_path / "custom.npy"np.save(path, image)# list files using parent directoryfiles = list_files(tmp_path, SupportedData.CUSTOM)assert len(files) == 1assert files[0] == path# li... | 1 | 10 | 1 | 79 | 3 | 100 | 117 | 100 | tmp_path | ['files', 'path', 'image'] | None | {"Assign": 4, "Expr": 2} | 6 | 18 | 6 | ["np.ones", "np.save", "list_files", "len", "list_files", "len"] | 0 | [] | The function (test_list_single_file_custom) defined within the public class called public.The function start at line 100 and ends at 117. 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 6.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_list_multiple_files_custom | def test_list_multiple_files_custom(tmp_path: Path):"""Test listing multiple custom files in subdirectories with additional files."""# create arrayimage = np.ones((10, 10))# save array to /npypath1 = tmp_path / "test1.npy"np.save(path1, image)path2 = tmp_path / "test2.npy"np.save(path2, image)# save text filepath3 = tm... | 1 | 19 | 1 | 150 | 8 | 120 | 153 | 120 | tmp_path | ['path3', 'path4', 'files', 'ref_files', 'path1', 'subdirectory', 'image', 'path2'] | None | {"Assign": 9, "Expr": 6} | 13 | 34 | 13 | ["np.ones", "np.save", "np.save", "path3.write_text", "subdirectory.mkdir", "np.save", "list_files", "len", "set", "set", "list_files", "len", "set"] | 0 | [] | The function (test_list_multiple_files_custom) defined within the public class called public.The function start at line 120 and ends at 153. 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 13.0 functions, and It ... |
CAREamics_careamics | public | public | 0 | 0 | test_validate_source_target_files | def test_validate_source_target_files(tmp_path: Path):"""Test that it passes for two folders with same number of files and same names."""# create two subfolderssrc = tmp_path / "src"src.mkdir()tar = tmp_path / "tar"tar.mkdir()# populate with filesfilename_1 = "test1.txt"filename_2 = "test2.txt"(tmp_path / "src" / filen... | 1 | 14 | 1 | 108 | 6 | 156 | 180 | 156 | tmp_path | ['filename_1', 'filename_2', 'src_files', 'tar_files', 'tar', 'src'] | None | {"Assign": 6, "Expr": 8} | 9 | 25 | 9 | ["src.mkdir", "tar.mkdir", "write_text", "write_text", "write_text", "write_text", "list_files", "list_files", "validate_source_target_files"] | 0 | [] | The function (test_validate_source_target_files) defined within the public class called public.The function start at line 156 and ends at 180. 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 9.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_validate_source_target_files_wrong_names | def test_validate_source_target_files_wrong_names(tmp_path: Path):"""Test that an error is raised if filenames are different."""# create two subfolderssrc = tmp_path / "src"src.mkdir()tar = tmp_path / "tar"tar.mkdir()# populate with filesfilename_1 = "test1.txt"filename_2 = "test2.txt"filename_3 = "test3.txt"(tmp_path ... | 1 | 16 | 1 | 119 | 7 | 183 | 209 | 183 | tmp_path | ['filename_3', 'filename_1', 'filename_2', 'src_files', 'tar_files', 'tar', 'src'] | None | {"Assign": 7, "Expr": 8, "With": 1} | 10 | 27 | 10 | ["src.mkdir", "tar.mkdir", "write_text", "write_text", "write_text", "write_text", "list_files", "list_files", "pytest.raises", "validate_source_target_files"] | 0 | [] | The function (test_validate_source_target_files_wrong_names) defined within the public class called public.The function start at line 183 and ends at 209. 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. It declares 10.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_validate_source_target_files_wrong_number | def test_validate_source_target_files_wrong_number(tmp_path: Path):"""Test that an error is raised if filenames are different."""# create two subfolderssrc = tmp_path / "src"src.mkdir()tar = tmp_path / "tar"tar.mkdir()# populate with filesfilename_1 = "test1.txt"filename_2 = "test2.txt"(tmp_path / "src" / filename_1).w... | 1 | 14 | 1 | 104 | 6 | 212 | 236 | 212 | tmp_path | ['filename_1', 'filename_2', 'src_files', 'tar_files', 'tar', 'src'] | None | {"Assign": 6, "Expr": 7, "With": 1} | 9 | 25 | 9 | ["src.mkdir", "tar.mkdir", "write_text", "write_text", "write_text", "list_files", "list_files", "pytest.raises", "validate_source_target_files"] | 0 | [] | The function (test_validate_source_target_files_wrong_number) defined within the public class called public.The function start at line 212 and ends at 236. 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 9.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_patches_sanity_check | def test_patches_sanity_check(arr_shape, patch_size):arr = np.zeros(arr_shape)is_3d_patch = len(patch_size) == 3# check if the patch is 2D or 3D. Subtract 1 because the first dimension is samplevalidate_patch_dimensions(arr, patch_size, is_3d_patch) | 1 | 4 | 2 | 31 | 2 | 16 | 20 | 16 | arr_shape,patch_size | ['is_3d_patch', 'arr'] | None | {"Assign": 2, "Expr": 1} | 4 | 5 | 4 | ["np.zeros", "len", "validate_patch_dimensions", "pytest.mark.parametrize"] | 0 | [] | The function (test_patches_sanity_check) 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 4.0 functions, and It has 4.0... |
CAREamics_careamics | public | public | 0 | 0 | test_patches_sanity_check_invalid_cases | def test_patches_sanity_check_invalid_cases(arr_shape, patch_size):arr = np.zeros(arr_shape)is_3d_patch = len(patch_size) == 3# check if the patch is 2D or 3D. Subtract 1 because the first dimension is samplewith pytest.raises(ValueError):validate_patch_dimensions(arr, patch_size, is_3d_patch) | 1 | 5 | 2 | 39 | 2 | 39 | 44 | 39 | arr_shape,patch_size | ['is_3d_patch', 'arr'] | None | {"Assign": 2, "Expr": 1, "With": 1} | 5 | 6 | 5 | ["np.zeros", "len", "pytest.raises", "validate_patch_dimensions", "pytest.mark.parametrize"] | 0 | [] | The function (test_patches_sanity_check_invalid_cases) defined within the public class called public.The function start at line 39 and ends at 44. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [39.0] and does not return any value. It declares 5.0 functions, a... |
CAREamics_careamics | public | public | 0 | 0 | test_random_patching_unsupervised | def test_random_patching_unsupervised(ordered_array, shape, patch_size):"""Check that the patches are extracted correctly.Since extract patches is called on already shaped array, dimensions S and C arepresent."""# create arrayarray = ordered_array(shape)is_3D = len(patch_size) == 3# minimum number of unique patches to ... | 6 | 25 | 3 | 247 | 9 | 20 | 63 | 20 | ordered_array,shape,patch_size | ['patches', 'array', 'seeds', 'is_3D', 'patch_generator', 'min_unique_patches', 'ind', 'top_left', 'coords'] | None | {"Assign": 11, "Expr": 2, "For": 2, "If": 2} | 21 | 44 | 21 | ["ordered_array", "len", "np.prod", "np.prod", "np.prod", "np.prod", "range", "extract_patches_random", "np.where", "np.where", "top_left.append", "np.array", "squeeze", "np.array", "coords.min", "coords.max", "max", "max", "len", "np.unique", "pytest.mark.parametrize"] | 0 | [] | The function (test_random_patching_unsupervised) defined within the public class called public.The function start at line 20 and ends at 63. It contains 25 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [20.0] and does not return any value. It declares 21.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | check_extract_patches_sequential | def check_extract_patches_sequential(array: np.ndarray, patch_size: tuple):"""Check that the patches are extracted correctly.The array should have been generated using np.arange and np.reshape."""patches, _ = extract_patches_sequential(array, patch_size=patch_size)# check patch shapeassert patches.shape[2:] == patch_si... | 1 | 6 | 2 | 66 | 2 | 13 | 25 | 13 | array,patch_size | ['n_max', 'unique'] | None | {"Assign": 3, "Expr": 1} | 5 | 13 | 5 | ["extract_patches_sequential", "np.prod", "np.unique", "np.array", "len"] | 2 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset.patching.test_sequential_patching_py.test_extract_patches_sequential_2d", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset.patching.... | The function (check_extract_patches_sequential) defined within the public class called public.The function start at line 13 and ends at 25. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [13.0] and does not return any value. It declares 5.0 functions, It has 5... |
CAREamics_careamics | public | public | 0 | 0 | test_extract_patches_sequential_2d | def test_extract_patches_sequential_2d(array_2D, patch_size):"""Test extracting patches sequentially in 2D."""check_extract_patches_sequential(array_2D, patch_size) | 1 | 2 | 2 | 14 | 0 | 37 | 39 | 37 | array_2D,patch_size | [] | None | {"Expr": 2} | 2 | 3 | 2 | ["check_extract_patches_sequential", "pytest.mark.parametrize"] | 0 | [] | The function (test_extract_patches_sequential_2d) defined within the public class called public.The function start at line 37 and ends at 39. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [37.0] and does not return any value. It declares 2.0 functions, and I... |
CAREamics_careamics | public | public | 0 | 0 | test_extract_patches_sequential_3d | def test_extract_patches_sequential_3d(array_3D, patch_size):"""Test extracting patches sequentially in 3D.The 3D array is a fixture of shape (1, 8, 16, 16)."""# TODO changed the fixture to (1, 8, 16, 16), uneven shape doesnt work. We need to# discuss the function or the test casescheck_extract_patches_sequential(array... | 1 | 2 | 2 | 14 | 0 | 51 | 57 | 51 | array_3D,patch_size | [] | None | {"Expr": 2} | 2 | 7 | 2 | ["check_extract_patches_sequential", "pytest.mark.parametrize"] | 0 | [] | The function (test_extract_patches_sequential_3d) defined within the public class called public.The function start at line 51 and ends at 57. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [51.0] and does not return any value. It declares 2.0 functions, and I... |
CAREamics_careamics | public | public | 0 | 0 | test_extract_patches_sequential_2d_supervised | def test_extract_patches_sequential_2d_supervised(array_2D, patch_size):"""Test extracting patches sequentially in 2D with target."""patches, targets = extract_patches_sequential(array_2D, patch_size=patch_size, target=array_2D)# Check that the same region is extracted in the patches and targetsassert np.array_equal(pa... | 1 | 5 | 2 | 33 | 0 | 67 | 74 | 67 | array_2D,patch_size | [] | None | {"Assign": 1, "Expr": 1} | 3 | 8 | 3 | ["extract_patches_sequential", "np.array_equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_extract_patches_sequential_2d_supervised) defined within the public class called public.The function start at line 67 and ends at 74. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [67.0] and does not return any value. It declares 3.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_number_of_patches | def test_compute_number_of_patches(shape, patch_sizes, expected):"""Test computing number of patches"""assert _compute_number_of_patches(shape, patch_sizes) == expected | 1 | 2 | 3 | 19 | 0 | 86 | 88 | 86 | shape,patch_sizes,expected | [] | None | {"Expr": 1} | 2 | 3 | 2 | ["_compute_number_of_patches", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_number_of_patches) defined within the public class called public.The function start at line 86 and ends at 88. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [86.0] and does not return any value. It declares 2.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_overlap | def test_compute_overlap(shape, patch_sizes, expected):"""Test computing overlap between patches"""assert _compute_overlap(shape, patch_sizes) == expected | 1 | 2 | 3 | 19 | 0 | 99 | 101 | 99 | shape,patch_sizes,expected | [] | None | {"Expr": 1} | 2 | 3 | 2 | ["_compute_overlap", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_overlap) defined within the public class called public.The function start at line 99 and ends at 101. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [99.0] and does not return any value. It declares 2.0 functions, and It has 2.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_patch_steps | def test_compute_patch_steps(dims, patch_size, overlap):"""Test computing patch steps"""patch_sizes = (patch_size,) * dimsoverlaps = (overlap,) * dimsexpected = (min(patch_size - overlap, patch_size),) * dimsassert _compute_patch_steps(patch_sizes, overlaps) == expected | 1 | 5 | 3 | 50 | 3 | 107 | 113 | 107 | dims,patch_size,overlap | ['patch_sizes', 'expected', 'overlaps'] | None | {"Assign": 3, "Expr": 1} | 5 | 7 | 5 | ["min", "_compute_patch_steps", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_patch_steps) defined within the public class called public.The function start at line 107 and ends at 113. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [107.0] and does not return any value. It declares 5.0 functions, and It has 5... |
CAREamics_careamics | public | public | 0 | 0 | check_compute_reshaped_view | def check_compute_reshaped_view(array: np.ndarray, window_shape, steps):"""Check the number of patches"""output_shape = (-1, *window_shape)# compute viewsoutput = _compute_patch_views(array, window_shape, steps, output_shape)# check the number of patchesn_patches = [np.ceil((array.shape[i] - window_shape[i] + 1) / step... | 2 | 8 | 3 | 95 | 3 | 116 | 129 | 116 | array,window_shape,steps | ['output', 'output_shape', 'n_patches'] | None | {"Assign": 3, "Expr": 1} | 6 | 14 | 6 | ["_compute_patch_views", "astype", "np.ceil", "range", "len", "np.prod"] | 2 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset.patching.test_sequential_patching_py.test_compute_reshaped_view_2d", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset.patching.test_... | The function (check_compute_reshaped_view) defined within the public class called public.The function start at line 116 and ends at 129. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [116.0] and does not return any value. It declares 6.0 functions, It has 6.0... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_reshaped_view_2d | def test_compute_reshaped_view_2d(array_2D, window_shape, steps):"""Test computing reshaped view of an array of shape (1, 10, 9)."""check_compute_reshaped_view(array_2D, window_shape, steps) | 1 | 2 | 3 | 18 | 0 | 140 | 142 | 140 | array_2D,window_shape,steps | [] | None | {"Expr": 2} | 2 | 3 | 2 | ["check_compute_reshaped_view", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_reshaped_view_2d) defined within the public class called public.The function start at line 140 and ends at 142. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [140.0] and does not return any value. It declares 2.0 functions, and It ... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_reshaped_view_3d | def test_compute_reshaped_view_3d(array_3D, window_shape, steps):"""Test computing reshaped view of an array of shape (1, 5, 10, 9)."""check_compute_reshaped_view(array_3D, window_shape, steps) | 1 | 2 | 3 | 18 | 0 | 153 | 155 | 153 | array_3D,window_shape,steps | [] | None | {"Expr": 2} | 2 | 3 | 2 | ["check_compute_reshaped_view", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_reshaped_view_3d) defined within the public class called public.The function start at line 153 and ends at 155. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [153.0] and does not return any value. It declares 2.0 functions, and It ... |
CAREamics_careamics | public | public | 0 | 0 | test_collate_tiles_2d | def test_collate_tiles_2d(ordered_array, n_channels, batch):"""Test that the collate tiles function collates tile information correctly."""tile_size = (4, 4)tile_overlap = (2, 2)shape = (1, n_channels, 8, 8)# create arrayarray = ordered_array(shape)# extract tilestiles = list(extract_tiles(array, tile_size=tile_size, o... | 4 | 18 | 3 | 151 | 10 | 8 | 39 | 8 | ordered_array,n_channels,batch | ['tile_size', 'array', 'tiles_used', 'n_tiles', 'shape', 'tile_infos', 'batch_tiles', 'tile_overlap', 'tiles', 'collated_tiles'] | None | {"Assign": 10, "AugAssign": 1, "Expr": 1, "For": 2, "While": 1} | 11 | 32 | 11 | ["ordered_array", "list", "extract_tiles", "len", "collate_tiles", "len", "enumerate", "range", "len", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_collate_tiles_2d) defined within the public class called public.The function start at line 8 and ends at 39. It contains 18 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [8.0] and does not return any value. It declares 11.0 functions, and It has 11.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_collate_tiles_3d | def test_collate_tiles_3d(ordered_array, n_channels, batch):"""Test that the collate tiles function collates tile information correctly."""tile_size = (4, 4, 4)tile_overlap = (2, 2, 2)shape = (1, n_channels, 8, 8, 8)# create arrayarray = ordered_array(shape)# extract tilestiles = list(extract_tiles(array, tile_size=til... | 4 | 18 | 3 | 157 | 10 | 44 | 75 | 44 | ordered_array,n_channels,batch | ['tile_size', 'array', 'tiles_used', 'n_tiles', 'shape', 'tile_infos', 'batch_tiles', 'tile_overlap', 'tiles', 'collated_tiles'] | None | {"Assign": 10, "AugAssign": 1, "Expr": 1, "For": 2, "While": 1} | 11 | 32 | 11 | ["ordered_array", "list", "extract_tiles", "len", "collate_tiles", "len", "enumerate", "range", "len", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_collate_tiles_3d) defined within the public class called public.The function start at line 44 and ends at 75. It contains 18 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [44.0] and does not return any value. It declares 11.0 functions, and It has 11.0 ... |
CAREamics_careamics | public | public | 0 | 0 | test_extract_tiles | def test_extract_tiles(data_shape, tile_size, overlaps):"""Test extracted tiles are all the same size and can reconstruct the image."""arr = np.random.random_sample(data_shape).astype(np.float32)tile_data_generator = extract_tiles(arr=arr, tile_size=np.array(tile_size), overlaps=np.array(overlaps))tiles = []tile_infos ... | 2 | 16 | 3 | 136 | 7 | 30 | 59 | 30 | data_shape,tile_size,overlaps | ['overlap_crop_coords', 'arr', 'stitched_arr', 'tile_infos', 'tile_data_generator', 'stitch_coords', 'tiles'] | None | {"Assign": 7, "Expr": 4, "For": 1} | 13 | 30 | 13 | ["astype", "np.random.random_sample", "extract_tiles", "np.array", "np.array", "tiles.append", "tile_infos.append", "len", "len", "len", "stitch_prediction", "np.testing.assert_array_equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_extract_tiles) defined within the public class called public.The function start at line 30 and ends at 59. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [30.0] and does not return any value. It declares 13.0 functions, and It has 13.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_tile_info_legacy | def test_compute_tile_info_legacy():"""Test the legacy version of `compute_tile_info`."""data_shape = (1, 3, 10, 9)tile_size = (1, 3, 4, 4)overlaps = (0, 0, 2, 2)stitch_shape = tuple(ts - ov for ts, ov in zip(tile_size, overlaps, strict=False))grid_index_manager = GridIndexManager(data_shape=data_shape,grid_shape=stitc... | 2 | 49 | 0 | 360 | 6 | 62 | 120 | 62 | ['tile_size', 'overlaps', 'grid_index_manager', 'stitch_shape', 'data_shape', 'tile_info'] | None | {"Assign": 9, "Expr": 1} | 15 | 59 | 15 | ["tuple", "zip", "GridIndexManager", "compute_tile_info_legacy", "TileInformation", "tuple", "compute_tile_info_legacy", "TileInformation", "tuple", "compute_tile_info_legacy", "TileInformation", "tuple", "compute_tile_info_legacy", "TileInformation", "tuple"] | 0 | [] | The function (test_compute_tile_info_legacy) defined within the public class called public.The function start at line 62 and ends at 120. It contains 49 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 15.0 functions, and It has... | |
CAREamics_careamics | public | public | 0 | 0 | test_compute_tile_info | def test_compute_tile_info():"""Test `compute_tile_info` for a selection of known results."""# TODO: improve this test ?data_shape = np.array([1, 3, 10, 9])tile_size = np.array([4, 4])overlaps = np.array([2, 2])# first exampletile_info = compute_tile_info((0, 0), data_shape[1:], tile_size, overlaps)assert tile_info == ... | 1 | 36 | 0 | 353 | 4 | 123 | 170 | 123 | ['overlaps', 'tile_info', 'tile_size', 'data_shape'] | None | {"Assign": 7, "Expr": 1} | 15 | 48 | 15 | ["np.array", "np.array", "np.array", "compute_tile_info", "TileInformation", "tuple", "compute_tile_info", "TileInformation", "tuple", "compute_tile_info", "TileInformation", "tuple", "compute_tile_info", "TileInformation", "tuple"] | 0 | [] | The function (test_compute_tile_info) defined within the public class called public.The function start at line 123 and ends at 170. It contains 36 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 15.0 functions, and It has 15.0 ... | |
CAREamics_careamics | public | public | 0 | 0 | test_compute_padding | def test_compute_padding(data_shape, tile_size, overlaps):padding = compute_padding(np.array(data_shape), np.array(tile_size), np.array(overlaps))for axis, (before, after) in enumerate(padding):# padded array should be divisible by the stitch sizestitch_size = tile_size[axis] - overlaps[axis]axis_size = data_shape[axis... | 2 | 9 | 3 | 87 | 3 | 184 | 196 | 184 | data_shape,tile_size,overlaps | ['axis_size', 'stitch_size', 'padding'] | None | {"Assign": 3, "For": 1} | 6 | 13 | 6 | ["compute_padding", "np.array", "np.array", "np.array", "enumerate", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_padding) defined within the public class called public.The function start at line 184 and ends at 196. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [184.0] and does not return any value. It declares 6.0 functions, and It has 6.0 f... |
CAREamics_careamics | public | public | 0 | 0 | test_n_tiles_1d | def test_n_tiles_1d(axis_size, tile_size, overlap):"""Test calculating the number of tiles in a specific dimension."""result = n_tiles_1d(axis_size, tile_size, overlap)assert result == int(np.ceil(axis_size / (tile_size - overlap))) | 1 | 3 | 3 | 38 | 1 | 203 | 206 | 203 | axis_size,tile_size,overlap | ['result'] | None | {"Assign": 1, "Expr": 1} | 4 | 4 | 4 | ["n_tiles_1d", "int", "np.ceil", "pytest.mark.parametrize"] | 0 | [] | The function (test_n_tiles_1d) defined within the public class called public.The function start at line 203 and ends at 206. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [203.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_total_n_tiles | def test_total_n_tiles(data_shape, tile_size, overlaps):"""Test calculating the total number of tiles."""result = total_n_tiles(data_shape, tile_size, overlaps)n_tiles = 1for i in range(-1, -len(tile_size) - 1, -1):n_tiles = n_tiles * int(np.ceil(data_shape[i] / (tile_size[i] - overlaps[i])))assert result == n_tiles | 2 | 6 | 3 | 75 | 2 | 220 | 228 | 220 | data_shape,tile_size,overlaps | ['n_tiles', 'result'] | None | {"Assign": 3, "Expr": 1, "For": 1} | 6 | 9 | 6 | ["total_n_tiles", "range", "len", "int", "np.ceil", "pytest.mark.parametrize"] | 0 | [] | The function (test_total_n_tiles) defined within the public class called public.The function start at line 220 and ends at 228. It contains 6 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [220.0] and does not return any value. It declares 6.0 functions, and It has 6.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_tile_grid_shape | def test_compute_tile_grid_shape(data_shape, tile_size, overlaps):"""Test computing tile grid shape."""result = compute_tile_grid_shape(data_shape, tile_size, overlaps)tile_grid_shape = tuple(int(np.ceil(data_shape[i] / (tile_size[i] - overlaps[i])))for i in range(-len(tile_size), 0, 1))assert result == tile_grid_shape | 2 | 7 | 3 | 68 | 2 | 242 | 252 | 242 | data_shape,tile_size,overlaps | ['result', 'tile_grid_shape'] | None | {"Assign": 2, "Expr": 1} | 7 | 11 | 7 | ["compute_tile_grid_shape", "tuple", "int", "np.ceil", "range", "len", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_tile_grid_shape) defined within the public class called public.The function start at line 242 and ends at 252. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [242.0] and does not return any value. It declares 7.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | check_extract_tiles | def check_extract_tiles(array: np.ndarray, tile_size, overlaps):"""Test extracting patches randomly."""tile_data_generator = extract_tiles(array, tile_size, overlaps)tiles = []all_overlap_crop_coords = []all_stitch_coords = []# Assemble all tiles and their respective coordinatesfor tile_data in tile_data_generator:tile... | 2 | 19 | 3 | 153 | 9 | 11 | 42 | 11 | array,tile_size,overlaps | ['n_max', 'overlap_crop_coords', 'tile_data_generator', 'stitch_coords', 'tiles', 'all_overlap_crop_coords', 'tile', 'all_stitch_coords', 'unique'] | None | {"AnnAssign": 1, "Assign": 9, "Expr": 4, "For": 1} | 14 | 32 | 14 | ["extract_tiles", "tiles.append", "all_overlap_crop_coords.append", "all_stitch_coords.append", "len", "len", "len", "len", "len", "len", "np.prod", "np.unique", "np.array", "len"] | 2 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset.tiling.test_tiled_patching_py.test_extract_tiles_2d", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset.tiling.test_tiled_patching_py... | The function (check_extract_tiles) defined within the public class called public.The function start at line 11 and ends at 42. It contains 19 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [11.0] and does not return any value. It declares 14.0 functions, It has 14.0 functio... |
CAREamics_careamics | public | public | 0 | 0 | test_extract_tiles_2d | def test_extract_tiles_2d(array_2D, tile_size, overlaps):"""Test extracting tiles for prediction in 2D."""check_extract_tiles(array_2D, tile_size, overlaps) | 1 | 2 | 3 | 18 | 0 | 52 | 54 | 52 | array_2D,tile_size,overlaps | [] | None | {"Expr": 2} | 2 | 3 | 2 | ["check_extract_tiles", "pytest.mark.parametrize"] | 0 | [] | The function (test_extract_tiles_2d) defined within the public class called public.The function start at line 52 and ends at 54. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [52.0] and does not return any value. It declares 2.0 functions, and It has 2.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_extract_tiles_3d | def test_extract_tiles_3d(array_3D, tile_size, overlaps):"""Test extracting tiles for prediction in 3D.The 3D array is a fixture of shape (1, 8, 16, 16)."""check_extract_tiles(array_3D, tile_size, overlaps) | 1 | 2 | 3 | 18 | 0 | 64 | 68 | 64 | array_3D,tile_size,overlaps | [] | None | {"Expr": 2} | 2 | 5 | 2 | ["check_extract_tiles", "pytest.mark.parametrize"] | 0 | [] | The function (test_extract_tiles_3d) defined within the public class called public.The function start at line 64 and ends at 68. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [64.0] and does not return any value. It declares 2.0 functions, and It has 2.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_compute_crop_and_stitch_coords_1d | def test_compute_crop_and_stitch_coords_1d(axis_size, patch_size, overlap):(crop_coords,stitch_coords,overlap_crop_coords,) = _compute_crop_and_stitch_coords_1d(axis_size, patch_size, overlap)# check that the number of patches is sufficient to cover the whole axis and that# the number of coordinates is# the same for al... | 3 | 35 | 3 | 260 | 1 | 73 | 120 | 73 | axis_size,patch_size,overlap | ['num_patches'] | None | {"Assign": 2} | 24 | 48 | 24 | ["_compute_crop_and_stitch_coords_1d", "astype", "np.ceil", "len", "len", "len", "all", "all", "all", "range", "len", "np.sum", "np.array", "np.array", "np.sum", "np.array", "np.array", "np.array_equal", "np.array", "np.array", "np.array", "np.array", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_compute_crop_and_stitch_coords_1d) defined within the public class called public.The function start at line 73 and ends at 120. It contains 35 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [73.0] and does not return any value. It declares 24.0 functions,... |
CAREamics_careamics | public | public | 0 | 0 | test_from_array | def test_from_array(data_shape, patch_size, expected_dataset_len):rng = np.random.default_rng(42)example_input = rng.random(data_shape)example_target = rng.random(data_shape)train_data_config = _create_ng_data_configuration(data_type="array",axes="YX",patch_size=patch_size,batch_size=1,augmentations=_list_spatial_augme... | 1 | 30 | 3 | 181 | 6 | 28 | 61 | 28 | data_shape,patch_size,expected_dataset_len | ['output', 'example_input', 'train_dataset', 'rng', 'example_target', 'train_data_config'] | None | {"Assign": 7, "Expr": 1} | 14 | 34 | 14 | ["np.random.default_rng", "rng.random", "rng.random", "_create_ng_data_configuration", "_list_spatial_augmentations", "train_data_config.set_means_and_stds", "example_input.mean", "example_input.std", "example_target.mean", "example_target.std", "create_array_dataset", "len", "len", "pytest.mark.parametrize"] | 0 | [] | The function (test_from_array) defined within the public class called public.The function start at line 28 and ends at 61. It contains 30 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [28.0] and does not return any value. It declares 14.0 functions, and It has 14.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_from_tiff | def test_from_tiff(tmp_path: Path, data_shape, patch_size, expected_dataset_len):rng = np.random.default_rng(42)example_input = rng.random(data_shape)example_target = rng.random(data_shape)input_file_path = tmp_path / "input.tiff"target_file_path = tmp_path / "target.tiff"tifffile.imwrite(input_file_path, example_input... | 1 | 34 | 4 | 211 | 8 | 72 | 111 | 72 | tmp_path,data_shape,patch_size,expected_dataset_len | ['output', 'target_file_path', 'input_file_path', 'example_input', 'train_dataset', 'rng', 'example_target', 'train_data_config'] | None | {"Assign": 9, "Expr": 3} | 16 | 40 | 16 | ["np.random.default_rng", "rng.random", "rng.random", "tifffile.imwrite", "tifffile.imwrite", "_create_ng_data_configuration", "_list_spatial_augmentations", "train_data_config.set_means_and_stds", "example_input.mean", "example_input.std", "example_target.mean", "example_target.std", "create_tiff_dataset", "len", "len... | 0 | [] | The function (test_from_tiff) defined within the public class called public.The function start at line 72 and ends at 111. It contains 34 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [72.0] and does not return any value. It declares 16.0 functions, and It has 16.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_prediction_from_array | def test_prediction_from_array(data_shape, tile_size, tile_overlap):rng = np.random.default_rng(42)example_data = rng.random(data_shape)prediction_config = NGDataConfig(data_type="array",patching={"name": "tiled","patch_size": tile_size,"overlap": tile_overlap,},axes="YX",image_means=(example_data.mean(),),image_stds=(... | 1 | 28 | 3 | 157 | 5 | 123 | 153 | 123 | data_shape,tile_size,tile_overlap | ['output', 'example_data', 'prediction_config', 'rng', 'prediction_dataset'] | None | {"Assign": 6} | 11 | 31 | 11 | ["np.random.default_rng", "rng.random", "NGDataConfig", "example_data.mean", "example_data.std", "_list_spatial_augmentations", "create_array_dataset", "len", "len", "pytest.mark.skip", "pytest.mark.parametrize"] | 0 | [] | The function (test_prediction_from_array) defined within the public class called public.The function start at line 123 and ends at 153. It contains 28 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [123.0] and does not return any value. It declares 11.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | test_from_custom_data_type.read_data_func_test | def read_data_func_test(data):return 1 - data | 1 | 2 | 1 | 9 | 0 | 185 | 186 | 185 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_from_custom_data_type.read_data_func_test) defined within the public class called public.The function start at line 185 and ends at 186. 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_from_custom_data_type | def test_from_custom_data_type(patch_size, data_shape):rng = np.random.default_rng(42)example_data = rng.random(data_shape)example_target = rng.random(data_shape)train_data_config = _create_ng_data_configuration(data_type="custom",axes="YX",patch_size=patch_size,batch_size=1,augmentations=_list_spatial_augmentations(),... | 1 | 33 | 2 | 190 | 6 | 164 | 202 | 164 | patch_size,data_shape | ['output', 'example_data', 'train_dataset', 'rng', 'example_target', 'train_data_config'] | Returns | {"Assign": 7, "Expr": 1, "Return": 1} | 14 | 39 | 14 | ["np.random.default_rng", "rng.random", "rng.random", "_create_ng_data_configuration", "_list_spatial_augmentations", "train_data_config.set_means_and_stds", "example_data.mean", "example_data.std", "example_target.mean", "example_target.std", "create_custom_file_dataset", "len", "len", "pytest.mark.parametrize"] | 0 | [] | The function (test_from_custom_data_type) defined within the public class called public.The function start at line 164 and ends at 202. It contains 33 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [164.0], and this function return a value. It declares 14.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | create_test_czi | def create_test_czi(file_path: Path, data: NDArray | list[NDArray]):if not isinstance(data, list):data = [data]with pyczi.create_czi(str(file_path)) as czi:xoffs = 0for scene_idx, scene_data in enumerate(data):for t in range(scene_data.shape[0]):for c in range(scene_data.shape[1]):for z in range(scene_data.shape[2]):cz... | 6 | 16 | 2 | 148 | 2 | 20 | 36 | 20 | file_path,data | ['xoffs', 'data'] | None | {"Assign": 2, "AugAssign": 1, "Expr": 1, "For": 4, "If": 1, "With": 1} | 8 | 17 | 8 | ["isinstance", "pyczi.create_czi", "str", "enumerate", "range", "range", "range", "czi.write"] | 2 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset_ng.patch_extractor.image_stack.test_czi_image_stack_py.test_extract_patch", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset_ng.patc... | The function (create_test_czi) defined within the public class called public.The function start at line 20 and ends at 36. It contains 16 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [20.0] and does not return any value. It declares 8.0 functions, It has 8.0 functions cal... |
CAREamics_careamics | public | public | 0 | 0 | test_extract_patch | def test_extract_patch(tmp_path: Path,orig_shape: tuple[int, ...],depth_axis: Literal["none", "Z", "T"],expected_axes: str,expected_shape: list[int],sample_idx: int,expect_raise,):# reference data to compare againstdata = np.random.randn(*orig_shape).astype(np.float32)# save data as a czi file to ininitialise image sta... | 5 | 50 | 7 | 352 | 8 | 63 | 127 | 63 | tmp_path,orig_shape,depth_axis,expected_axes,expected_shape,sample_idx,expect_raise | ['extracted_patch', 'patch_ref', 'image_stack', 'patch_size', 'data_ref', 'file_path', 'data', 'coords'] | None | {"Assign": 15, "Expr": 2, "If": 3, "Return": 1, "With": 1} | 26 | 65 | 26 | ["astype", "np.random.randn", "create_test_czi", "CziImageStack", "len", "image_stack.extract_patch", "np.moveaxis", "data_ref.reshape", "image_stack.extract_patch", "expected_axes.index", "data.swapaxes", "np.testing.assert_array_equal", "pytest.mark.parametrize", "nullcontext", "pytest.raises", "pytest.raises", "null... | 0 | [] | The function (test_extract_patch) defined within the public class called public.The function start at line 63 and ends at 127. It contains 50 lines of code and it has a cyclomatic complexity of 5. It takes 7 parameters, represented as [63.0] and does not return any value. It declares 26.0 functions, and It has 26.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_multiple_scenes | def test_multiple_scenes(tmp_path: Path,):original_shapes = [[4, 1, 8, 16, 32],[4, 1, 8, 24, 18],[4, 1, 8, 45, 32],]# reference data to compare againstdata_ref = [np.random.randn(*shape).astype(np.float32) for shape in original_shapes]# save data as a czi file to ininitialise image stack withfile_path = tmp_path / "tes... | 5 | 35 | 1 | 296 | 12 | 131 | 176 | 131 | tmp_path | ['extracted_patch', 'scene_rectangle_sizes', 'scene_rectangles', 'original_shapes', 'patch_ref', 't', 'image_stack', 'expected_rectangle_sizes', 'patch_size', 'data_ref', 'file_path', 'coords'] | None | {"Assign": 12, "Expr": 2, "For": 1} | 11 | 46 | 11 | ["astype", "np.random.randn", "create_test_czi", "CziImageStack.get_bounding_rectangles", "len", "len", "scene_rectangles.values", "enumerate", "CziImageStack", "image_stack.extract_patch", "np.testing.assert_array_equal"] | 0 | [] | The function (test_multiple_scenes) defined within the public class called public.The function start at line 131 and ends at 176. It contains 35 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 11.0 functions, and It has 11.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_import_czi_image_stack_failure | def test_import_czi_image_stack_failure():"""Test that in the absence of pylibCZIrw, the CziImageStack import failswith an import error."""if importlib.util.find_spec("pylibCZIrw") is None:with pytest.raises(ImportError):CziImageStack(data_path="") | 2 | 4 | 0 | 31 | 0 | 8 | 13 | 8 | [] | None | {"Expr": 2, "If": 1, "With": 1} | 3 | 6 | 3 | ["importlib.util.find_spec", "pytest.raises", "CziImageStack"] | 0 | [] | The function (test_import_czi_image_stack_failure) defined within the public class called public.The function start at line 8 and ends at 13. 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 3.0 functions, and It h... | |
CAREamics_careamics | public | public | 0 | 0 | create_test_zarr | def create_test_zarr(file_path: Path, data_path: str, data: NDArray):store = zarr.storage.LocalStore(root=file_path.resolve())# create arrayarray = zarr.create(store=store,shape=data.shape,chunks=data.shape,# only 1 chunkdtype=np.uint16,path=data_path,)# write dataarray[...] = datastore.close() | 1 | 11 | 3 | 75 | 2 | 12 | 24 | 12 | file_path,data_path,data | ['array', 'store'] | None | {"Assign": 3, "Expr": 1} | 4 | 13 | 4 | ["zarr.storage.LocalStore", "file_path.resolve", "zarr.create", "store.close"] | 1 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset_ng.patch_extractor.image_stack.test_zarr_image_stack_py.test_extract_patch_2D"] | The function (create_test_zarr) defined within the public class called public.The function start at line 12 and ends at 24. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [12.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions ca... |
CAREamics_careamics | public | public | 0 | 0 | test_extract_patch_2D | def test_extract_patch_2D(tmp_path: Path,original_axes: str,original_shape: tuple[int, ...],expected_shape: tuple[int, ...],sample_idx: int,):# reference data to compare against, it is reshaped using careamics reshape_arraydata = np.arange(np.prod(original_shape)).reshape(original_shape)data_ref = reshape_array(data, o... | 1 | 27 | 5 | 197 | 10 | 38 | 73 | 38 | tmp_path,original_axes,original_shape,expected_shape,sample_idx | ['extracted_patch', 'data_path', 'patch_ref', 'image_stack', 'store', 'patch_size', 'data_ref', 'file_path', 'data', 'coords'] | None | {"Assign": 10, "Expr": 2} | 10 | 36 | 10 | ["reshape", "np.arange", "np.prod", "reshape_array", "create_test_zarr", "zarr.storage.LocalStore", "ZarrImageStack", "image_stack.extract_patch", "np.testing.assert_array_equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_extract_patch_2D) defined within the public class called public.The function start at line 38 and ends at 73. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [38.0] and does not return any value. It declares 10.0 functions, and It has 10.0 ... |
CAREamics_careamics | public | public | 0 | 0 | test_from_ome_zarr | def test_from_ome_zarr():# kinda an integration testurl = "https://uk1s3.embassy.ebi.ac.uk/idr/zarr/v0.4/idr0062A/6001240.zarr"image_stack = ZarrImageStack.from_ome_zarr(path=url)# initialise image stackn_channels = image_stack.data_shape[1]patch_size = (100, 64, 25)patch = image_stack.extract_patch(sample_idx=0, coord... | 1 | 10 | 0 | 78 | 5 | 76 | 86 | 76 | ['patch', 'image_stack', 'url', 'patch_size', 'n_channels'] | None | {"Assign": 5} | 3 | 11 | 3 | ["ZarrImageStack.from_ome_zarr", "image_stack.extract_patch", "isinstance"] | 0 | [] | The function (test_from_ome_zarr) defined within the public class called public.The function start at line 76 and ends at 86. 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 function... | |
CAREamics_careamics | public | public | 0 | 0 | _create_random_patching_strategy | def _create_random_patching_strategy(data_shapes: Sequence[Sequence[int]], patch_size: Sequence[int]) -> RandomPatchingStrategy:seed = 42return RandomPatchingStrategy(data_shapes=data_shapes, patch_size=patch_size, seed=seed) | 1 | 7 | 2 | 40 | 1 | 16 | 22 | 16 | data_shapes,patch_size | ['seed'] | RandomPatchingStrategy | {"Assign": 1, "Return": 1} | 1 | 7 | 1 | ["RandomPatchingStrategy"] | 0 | [] | The function (_create_random_patching_strategy) defined within the public class called public.The function start at line 16 and ends at 22. It contains 7 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 declare 1.0 function, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | _create_fixed_random_patching_strategy | def _create_fixed_random_patching_strategy(data_shapes: Sequence[Sequence[int]], patch_size: Sequence[int]) -> FixedRandomPatchingStrategy:seed = 42return FixedRandomPatchingStrategy(data_shapes=data_shapes, patch_size=patch_size, seed=seed) | 1 | 7 | 2 | 40 | 1 | 25 | 31 | 25 | data_shapes,patch_size | ['seed'] | FixedRandomPatchingStrategy | {"Assign": 1, "Return": 1} | 1 | 7 | 1 | ["FixedRandomPatchingStrategy"] | 0 | [] | The function (_create_fixed_random_patching_strategy) defined within the public class called public.The function start at line 25 and ends at 31. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [25.0] and does not return any value. It declare 1.0 function, and ... |
CAREamics_careamics | public | public | 0 | 0 | _create_sequential_patching_strategy | def _create_sequential_patching_strategy(data_shapes: Sequence[Sequence[int]], patch_size: Sequence[int]) -> SequentialPatchingStrategy:overlap = tuple(2 for _ in patch_size)return SequentialPatchingStrategy(data_shapes, patch_size, overlap) | 2 | 5 | 2 | 41 | 1 | 34 | 38 | 34 | data_shapes,patch_size | ['overlap'] | SequentialPatchingStrategy | {"Assign": 1, "Return": 1} | 2 | 5 | 2 | ["tuple", "SequentialPatchingStrategy"] | 0 | [] | The function (_create_sequential_patching_strategy) defined within the public class called public.The function start at line 34 and ends at 38. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [34.0] and does not return any value. It declares 2.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | _create_tiling_strategy | def _create_tiling_strategy(data_shapes: Sequence[Sequence[int]], patch_size: Sequence[int]) -> TilingStrategy:if len(patch_size) == 2:overlaps = (2, 2)elif len(patch_size) == 3:overlaps = (2, 2, 2)else:raise ValueErrorreturn TilingStrategy(data_shapes=data_shapes, tile_size=patch_size, overlaps=overlaps) | 3 | 12 | 2 | 73 | 1 | 41 | 52 | 41 | data_shapes,patch_size | ['overlaps'] | TilingStrategy | {"Assign": 2, "If": 2, "Return": 1} | 3 | 12 | 3 | ["len", "len", "TilingStrategy"] | 0 | [] | The function (_create_tiling_strategy) defined within the public class called public.The function start at line 41 and ends at 52. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [41.0] and does not return any value. It declares 3.0 functions, and It has 3.0 ... |
CAREamics_careamics | public | public | 0 | 0 | _create_whole_sample_patching_strategy | def _create_whole_sample_patching_strategy(data_shapes: Sequence[Sequence[int]], patch_size: Sequence[int]) -> WholeSamplePatchingStrategy:# patch_size unusedreturn WholeSamplePatchingStrategy(data_shapes=data_shapes) | 1 | 4 | 2 | 29 | 0 | 55 | 59 | 55 | data_shapes,patch_size | [] | WholeSamplePatchingStrategy | {"Return": 1} | 1 | 5 | 1 | ["WholeSamplePatchingStrategy"] | 0 | [] | The function (_create_whole_sample_patching_strategy) defined within the public class called public.The function start at line 55 and ends at 59. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [55.0] and does not return any value. It declare 1.0 function, and ... |
CAREamics_careamics | public | public | 0 | 0 | test_all_get_patch_spec | def test_all_get_patch_spec(strategy_constr: PatchingStrategyConstr,data_shapes: Sequence[Sequence[int]],patch_size: Sequence[int],):strategy = strategy_constr(data_shapes, patch_size)n_patches = strategy.n_patchesfor i in range(n_patches):patch_spec = strategy.get_patch_spec(i)# validate patch is within spatial bounds... | 2 | 16 | 3 | 117 | 8 | 86 | 104 | 86 | strategy_constr,data_shapes,patch_size | ['patch_size_', 'spatial_shape', 'data_index', 'patch_spec', 'n_patches', 'data_shape', 'strategy', 'coords'] | None | {"Assign": 8, "For": 1} | 9 | 19 | 9 | ["strategy_constr", "range", "strategy.get_patch_spec", "np.array", "np.array", "all", "all", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_all_get_patch_spec) defined within the public class called public.The function start at line 86 and ends at 104. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [86.0] and does not return any value. It declares 9.0 functions, and It has 9.0... |
CAREamics_careamics | public | public | 0 | 0 | test_patches_cover_50percent | def test_patches_cover_50percent(strategy_constr: PatchingStrategyConstr,data_shapes: Sequence[Sequence[int]],patch_size: Sequence[int],):# Testing more than 50% because some patching strategies are random (but seeded)"""Test that more than 50% of the data is covered by the sampled pathches"""patching_strategy = strate... | 6 | 25 | 3 | 170 | 7 | 117 | 149 | 117 | strategy_constr,data_shapes,patch_size | ['tracking_arrays', 'tracking_array', 'spatial_slice', 'total_size', 'total_covered', 'patching_strategy', 'patch_specs'] | None | {"Assign": 8, "AugAssign": 2, "Expr": 1, "For": 2} | 11 | 33 | 11 | ["strategy_constr", "np.zeros", "patching_strategy.get_patch_spec", "range", "tuple", "slice", "zip", "slice", "np.count_nonzero", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_patches_cover_50percent) defined within the public class called public.The function start at line 117 and ends at 149. It contains 25 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [117.0] and does not return any value. It declares 11.0 functions, and It... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.