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_calc_patch_bins | def test_calc_patch_bins(data_shapes, patch_size, expected_patches):"""Test bins are created as expected"""image_stack_index_bins, sample_index_bins, sample_bins = (RandomPatchingStrategy._calc_bins(data_shapes, patch_size))assert image_stack_index_bins[-1] == sample_index_bins[-1] == expected_patches# create image_sta... | 2 | 10 | 3 | 78 | 2 | 22 | 37 | 22 | data_shapes,patch_size,expected_patches | ['idx', 'new_image_stack_bins'] | None | {"Assign": 3, "Expr": 2, "For": 1} | 5 | 16 | 5 | ["RandomPatchingStrategy._calc_bins", "new_image_stack_bins.append", "all", "np.array", "pytest.mark.parametrize"] | 0 | [] | The function (test_calc_patch_bins) defined within the public class called public.The function start at line 22 and ends at 37. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [22.0] and does not return any value. It declares 5.0 functions, and It has 5.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_n_patches | def test_n_patches(data_shape, patch_size, expected_patches):spatial_shape = data_shape[2:]n_patches = _calc_n_patches(spatial_shape, patch_size)assert n_patches == expected_patches | 1 | 4 | 3 | 28 | 2 | 49 | 53 | 49 | data_shape,patch_size,expected_patches | ['n_patches', 'spatial_shape'] | None | {"Assign": 2} | 2 | 5 | 2 | ["_calc_n_patches", "pytest.mark.parametrize"] | 0 | [] | The function (test_n_patches) defined within the public class called public.The function start at line 49 and ends at 53. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [49.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions ... |
CAREamics_careamics | public | public | 0 | 0 | test_n_patches_raises | def test_n_patches_raises():spatial_shape = (8, 8)patch_size = (2, 2, 2)with pytest.raises(ValueError):_calc_n_patches(spatial_shape, patch_size) | 1 | 5 | 0 | 34 | 2 | 56 | 60 | 56 | ['patch_size', 'spatial_shape'] | None | {"Assign": 2, "Expr": 1, "With": 1} | 2 | 5 | 2 | ["pytest.raises", "_calc_n_patches"] | 0 | [] | The function (test_n_patches_raises) defined within the public class called public.The function start at line 56 and ends at 60. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functi... | |
CAREamics_careamics | public | public | 0 | 0 | test_random_coords | def test_random_coords(data_shape, patch_size, iterations):spatial_shape = data_shape[2:]rng = np.random.default_rng(42)for _ in range(iterations):coords = np.array(_generate_random_coords(spatial_shape, patch_size, rng))# validate patch is within spatial boundsassert (0 <= coords).all()# less than or equal is correct ... | 2 | 7 | 3 | 76 | 3 | 74 | 82 | 74 | data_shape,patch_size,iterations | ['rng', 'spatial_shape', 'coords'] | None | {"Assign": 3, "For": 1} | 8 | 9 | 8 | ["np.random.default_rng", "range", "np.array", "_generate_random_coords", "all", "all", "np.array", "pytest.mark.parametrize"] | 0 | [] | The function (test_random_coords) defined within the public class called public.The function start at line 74 and ends at 82. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [74.0] and does not return any value. It declares 8.0 functions, and It has 8.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_random_coords_raises | def test_random_coords_raises():spatial_shape = (8, 8)patch_size = (2, 2, 2)rng = np.random.default_rng(42)with pytest.raises(ValueError):_generate_random_coords(spatial_shape, patch_size, rng) | 1 | 6 | 0 | 46 | 3 | 85 | 90 | 85 | ['rng', 'patch_size', 'spatial_shape'] | None | {"Assign": 3, "Expr": 1, "With": 1} | 3 | 6 | 3 | ["np.random.default_rng", "pytest.raises", "_generate_random_coords"] | 0 | [] | The function (test_random_coords_raises) defined within the public class called public.The function start at line 85 and ends at 90. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 fu... | |
CAREamics_careamics | public | public | 0 | 0 | test_whole_image_covered | def test_whole_image_covered(data_shapes: Sequence[Sequence[int]],patch_size: Sequence[int],overlap: Sequence[int],):patching_strategy = SequentialPatchingStrategy(data_shapes, patch_size, overlap)patch_specs = patching_strategy.patch_specs# track where patches have been sampled fromtracking_arrays = [np.zeros(data_sha... | 5 | 19 | 3 | 139 | 5 | 34 | 57 | 34 | data_shapes,patch_size,overlap | ['tracking_arrays', 'tracking_array', 'spatial_slice', 'patching_strategy', 'patch_specs'] | None | {"Assign": 6, "For": 2} | 8 | 24 | 8 | ["SequentialPatchingStrategy", "np.zeros", "tuple", "slice", "zip", "slice", "tracking_array.all", "pytest.mark.parametrize"] | 0 | [] | The function (test_whole_image_covered) defined within the public class called public.The function start at line 34 and ends at 57. It contains 19 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [34.0] and does not return any value. It declares 8.0 functions, and It has 8.0... |
CAREamics_careamics | public | public | 0 | 0 | _test_tiling_output | def _test_tiling_output(data_shapes: list[tuple[int, ...]],patch_size: tuple[int, ...],overlaps: tuple[int, ...],axes: str,):"""Test that TilingStrategy creates tiles that can be stitched to the original dataNote this is called by `test_tiling_output_2D` and test_tiling_output_3D"""data = [np.arange(np.prod(data_shape)... | 9 | 41 | 4 | 313 | 11 | 13 | 62 | 13 | data_shapes,patch_size,overlaps,axes | ['tile_spec', 'stitched_samples', 'samples', 'patch_extractor', 'n_tiles', 'tiling_strategy', 'tile_infos', 'tiles', 'image_region', 'tile', 'data'] | None | {"AnnAssign": 1, "Assign": 12, "Expr": 3, "For": 2, "If": 1} | 16 | 50 | 16 | ["reshape", "np.arange", "np.prod", "create_array_extractor", "TilingStrategy", "range", "tiling_strategy.get_patch_spec", "patch_extractor.extract_patch", "ImageRegionData", "str", "image_regions.append", "imageregions_to_tileinfos", "stitch_prediction", "np.split", "zip", "np.testing.assert_array_equal"] | 2 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset_ng.patching_strategies.test_tiling_strategy_py.test_tiling_output_2D", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.dataset_ng.patching_... | The function (_test_tiling_output) defined within the public class called public.The function start at line 13 and ends at 62. It contains 41 lines of code and it has a cyclomatic complexity of 9. It takes 4 parameters, represented as [13.0] and does not return any value. It declares 16.0 functions, It has 16.0 functio... |
CAREamics_careamics | public | public | 0 | 0 | test_tiling_output_2D | def test_tiling_output_2D(data_shapes: list[tuple[int, int, int, int]],patch_size: tuple[int, int],overlaps: tuple[int, int],):_test_tiling_output(data_shapes, patch_size, overlaps, axes="SCYX") | 1 | 6 | 3 | 50 | 0 | 73 | 78 | 73 | data_shapes,patch_size,overlaps | [] | None | {"Expr": 1} | 3 | 6 | 3 | ["_test_tiling_output", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_tiling_output_2D) defined within the public class called public.The function start at line 73 and ends at 78. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [73.0] and does not return any value. It declares 3.0 functions, and It has 3.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_tiling_output_3D | def test_tiling_output_3D(data_shapes: list[tuple[int, int, int, int, int]],patch_size: tuple[int, int, int],overlaps: tuple[int, int, int],):_test_tiling_output(data_shapes, patch_size, overlaps, axes="SCZYX") | 1 | 6 | 3 | 56 | 0 | 89 | 94 | 89 | data_shapes,patch_size,overlaps | [] | None | {"Expr": 1} | 3 | 6 | 3 | ["_test_tiling_output", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_tiling_output_3D) defined within the public class called public.The function start at line 89 and ends at 94. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [89.0] and does not return any value. It declares 3.0 functions, and It has 3.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_whole_image_covered_2d | def test_whole_image_covered_2d(data_shapes: list[tuple[int, int, int, int]],patch_size: tuple[int, int],overlaps: tuple[int, int],):patching_strategy = TilingStrategy(data_shapes, patch_size, overlaps)patch_specs = patching_strategy.tile_specs# track where patches have been sampled fromtracking_arrays = [np.zeros(data... | 5 | 19 | 3 | 149 | 5 | 105 | 128 | 105 | data_shapes,patch_size,overlaps | ['tracking_arrays', 'tracking_array', 'spatial_slice', 'patching_strategy', 'patch_specs'] | None | {"Assign": 6, "For": 2} | 9 | 24 | 9 | ["TilingStrategy", "np.zeros", "tuple", "slice", "zip", "slice", "tracking_array.all", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_whole_image_covered_2d) defined within the public class called public.The function start at line 105 and ends at 128. It contains 19 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [105.0] and does not return any value. It declares 9.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | test_whole_image_covered_3d | def test_whole_image_covered_3d(data_shapes: list[tuple[int, int, int, int]],patch_size: tuple[int, int],overlaps: tuple[int, int],):patching_strategy = TilingStrategy(data_shapes, patch_size, overlaps)patch_specs = patching_strategy.tile_specs# track where patches have been sampled fromtracking_arrays = [np.zeros(data... | 5 | 19 | 3 | 149 | 5 | 139 | 162 | 139 | data_shapes,patch_size,overlaps | ['tracking_arrays', 'tracking_array', 'spatial_slice', 'patching_strategy', 'patch_specs'] | None | {"Assign": 6, "For": 2} | 9 | 24 | 9 | ["TilingStrategy", "np.zeros", "tuple", "slice", "zip", "slice", "tracking_array.all", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_whole_image_covered_3d) defined within the public class called public.The function start at line 139 and ends at 162. It contains 19 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [139.0] and does not return any value. It declares 9.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | test_get_read_tiff | def test_get_read_tiff():assert get_read_func(SupportedData.TIFF) is read_tiff | 1 | 2 | 0 | 13 | 0 | 8 | 9 | 8 | [] | None | {} | 1 | 2 | 1 | ["get_read_func"] | 0 | [] | The function (test_get_read_tiff) defined within the public class called public.The function start at line 8 and ends at 9. 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 call... | |
CAREamics_careamics | public | public | 0 | 0 | test_get_read_any_error | def test_get_read_any_error():with pytest.raises(NotImplementedError):get_read_func("some random") | 1 | 3 | 0 | 16 | 0 | 12 | 14 | 12 | [] | None | {"Expr": 1, "With": 1} | 2 | 3 | 2 | ["pytest.raises", "get_read_func"] | 0 | [] | The function (test_get_read_any_error) defined within the public class called public.The function start at line 12 and ends at 14. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 func... | |
CAREamics_careamics | public | public | 0 | 0 | test_read_tiff | def test_read_tiff(tmp_path, ordered_array):"""Test reading a tiff file."""# create an arrayarray: np.ndarray = ordered_array((10, 10))# save filesfile = tmp_path / "test.tiff"tifffile.imwrite(file, array)# read filesarray_read = read_tiff(file)np.testing.assert_array_equal(array_read, array) | 1 | 6 | 2 | 51 | 2 | 8 | 19 | 8 | tmp_path,ordered_array | ['array_read', 'file'] | None | {"AnnAssign": 1, "Assign": 2, "Expr": 3} | 4 | 12 | 4 | ["ordered_array", "tifffile.imwrite", "read_tiff", "np.testing.assert_array_equal"] | 0 | [] | The function (test_read_tiff) defined within the public class called public.The function start at line 8 and ends at 19. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [8.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functions ca... |
CAREamics_careamics | public | public | 0 | 0 | test_read_tiff_invalid | def test_read_tiff_invalid(tmp_path):# invalid file typefile = tmp_path / "test.txt"file.write_text("test")with pytest.raises(ValueError):read_tiff(file)# non-existing filefile = tmp_path / "test.tiff"with pytest.raises(FileNotFoundError):read_tiff(file) | 1 | 8 | 1 | 45 | 1 | 22 | 32 | 22 | tmp_path | ['file'] | None | {"Assign": 2, "Expr": 3, "With": 2} | 5 | 11 | 5 | ["file.write_text", "pytest.raises", "read_tiff", "pytest.raises", "read_tiff"] | 0 | [] | The function (test_read_tiff_invalid) defined within the public class called public.The function start at line 22 and ends at 32. 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 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_get_write_tiff | def test_get_write_tiff():assert get_write_func(SupportedData.TIFF) is write_tiff | 1 | 2 | 0 | 13 | 0 | 6 | 7 | 6 | [] | None | {} | 1 | 2 | 1 | ["get_write_func"] | 0 | [] | The function (test_get_write_tiff) defined within the public class called public.The function start at line 6 and ends at 7. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 function cal... | |
CAREamics_careamics | public | public | 0 | 0 | test_write_tiff | def test_write_tiff(tmp_path, ordered_array):"""Test writing a tiff file."""# create an arrayarray: np.ndarray = ordered_array((10, 10))# save filesfile = tmp_path / "test.tiff"write_tiff(file, array)assert file.is_file() | 1 | 5 | 2 | 39 | 1 | 7 | 16 | 7 | tmp_path,ordered_array | ['file'] | None | {"AnnAssign": 1, "Assign": 1, "Expr": 2} | 3 | 10 | 3 | ["ordered_array", "write_tiff", "file.is_file"] | 0 | [] | The function (test_write_tiff) defined within the public class called public.The function start at line 7 and ends at 16. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [7.0] and does not return any value. It declares 3.0 functions, and It has 3.0 functions c... |
CAREamics_careamics | public | public | 0 | 0 | test_invalid_extension_error | def test_invalid_extension_error(tmp_path, ordered_array):"""Test error is raised when a path with an invalid extension is used."""# create an arrayarray: np.ndarray = ordered_array((10, 10))# save filesfile = tmp_path / "test.invalid"with pytest.raises(ValueError):write_tiff(file, array) | 1 | 5 | 2 | 41 | 1 | 19 | 27 | 19 | tmp_path,ordered_array | ['file'] | None | {"AnnAssign": 1, "Assign": 1, "Expr": 2, "With": 1} | 3 | 9 | 3 | ["ordered_array", "pytest.raises", "write_tiff"] | 0 | [] | The function (test_invalid_extension_error) defined within the public class called public.The function start at line 19 and ends at 27. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [19.0] and does not return any value. It declares 3.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | create_dummy_noise_model | def create_dummy_noise_model(tmp_path: Path,n_gaussians: int = 3,n_coeffs: int = 3,) -> None:weights = np.random.rand(3 * n_gaussians, n_coeffs)nm_dict = {"trained_weight": weights,"min_signal": np.array([0]),"max_signal": np.array([2**16 - 1]),"min_sigma": 0.125,}np.savez(tmp_path / "dummy_noise_model.npz", **nm_dict) | 1 | 13 | 3 | 87 | 2 | 38 | 50 | 38 | tmp_path,n_gaussians,n_coeffs | ['weights', 'nm_dict'] | None | {"Assign": 2, "Expr": 1} | 4 | 13 | 4 | ["np.random.rand", "np.array", "np.array", "np.savez"] | 3 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.test_LVAE_lightning_module_py.create_vae_lightning_model", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.test_LVAE_lightning_... | The function (create_dummy_noise_model) defined within the public class called public.The function start at line 38 and ends at 50. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [38.0] and does not return any value. It declares 4.0 functions, It has 4.0 func... |
CAREamics_careamics | public | public | 0 | 0 | create_vae_lightning_model | def create_vae_lightning_model(tmp_path: Path,algorithm: str,loss_type: str,ll_type: str = "gaussian",# TODO revisitmultiscale_count: int = 1,predict_logvar: Literal["pixelwise"] | None = None,target_ch: int = 1,) -> VAEModule:"""Instantiate the muSplit lightining model."""lvae_config = LVAEModel(architecture="LVAE",in... | 9 | 68 | 7 | 320 | 7 | 55 | 130 | 55 | tmp_path,algorithm,loss_type,ll_type,multiscale_count,predict_logvar,target_ch | ['vae_config', 'gaussian_lik_config', 'gmm', 'loss_config', 'noise_model_config', 'lvae_config', 'nm_lik_config'] | VAEModule | {"Assign": 17, "Expr": 3, "If": 8, "Return": 1} | 14 | 76 | 14 | ["LVAEModel", "LVAELossConfig", "GaussianLikelihoodConfig", "GaussianLikelihoodConfig", "create_dummy_noise_model", "GaussianMixtureNMConfig", "MultiChannelNMConfig", "NMLikelihoodConfig", "create_dummy_noise_model", "GaussianMixtureNMConfig", "MultiChannelNMConfig", "NMLikelihoodConfig", "VAEBasedAlgorithm", "VAEModul... | 8 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.test_LVAE_lightning_module_py.test_get_reconstructed_tensor", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.test_LVAE_lightni... | The function (create_vae_lightning_model) defined within the public class called public.The function start at line 55 and ends at 130. It contains 68 lines of code and it has a cyclomatic complexity of 9. It takes 7 parameters, represented as [55.0] and does not return any value. It declares 14.0 functions, It has 14.0... |
CAREamics_careamics | DummyDataset | public | 0 | 1 | __init__ | def __init__(self,img_size: int = 64,target_ch: int = 1,multiscale_count: int = 1,):self.num_samples = 3self.img_size = img_sizeself.target_ch = target_chself.multiscale_count = multiscale_count | 1 | 10 | 4 | 44 | 0 | 135 | 144 | 135 | self,img_size,target_ch,multiscale_count | [] | None | {"Assign": 4} | 0 | 10 | 0 | [] | 8,182 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi... | The function (__init__) defined within the public class called DummyDataset, that inherit another class.The function start at line 135 and ends at 144. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [135.0] and does not return any value. It has 8182.0 functio... |
CAREamics_careamics | DummyDataset | public | 0 | 1 | __len__ | def __len__(self):return self.num_samples | 1 | 2 | 1 | 9 | 0 | 146 | 147 | 146 | self | [] | Returns | {"Return": 1} | 0 | 2 | 0 | [] | 3 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3576232_vmware_liota.packages.examples.kura.kura_integrate_iotcc_py.sub_callback", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3665918_alvinwan_neural_backed_decision_trees.nbdt.data.imagenet_py._TinyImagenet200Va... | The function (__len__) defined within the public class called DummyDataset, that inherit another class.The function start at line 146 and ends at 147. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 3.0 functions ca... |
CAREamics_careamics | DummyDataset | public | 0 | 1 | __getitem__ | def __getitem__(self, idx: int):input_ = torch.randn(self.multiscale_count, self.img_size, self.img_size)target = torch.randn(self.target_ch, self.img_size, self.img_size)return input_, target | 1 | 4 | 2 | 49 | 0 | 149 | 152 | 149 | self,idx | [] | Returns | {"Assign": 2, "Return": 1} | 2 | 4 | 2 | ["torch.randn", "torch.randn"] | 30 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3535398_idsia_brainstorm.brainstorm.structure.buffer_views_py.BufferView.__getitem__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3573634_xray7224_pypump.pypump.models.feed_py.Lists.__getitem__", "_.content.gdriv... | The function (__getitem__) defined within the public class called DummyDataset, that inherit another class.The function start at line 149 and ends at 152. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [149.0], and this function return a value. It declares 2.0... |
CAREamics_careamics | public | public | 0 | 0 | create_dummy_dloader | def create_dummy_dloader(batch_size: int = 1,img_size: int = 64,target_ch: int = 1,multiscale_count: int = 1,):dataset = DummyDataset(img_size=img_size,target_ch=target_ch,multiscale_count=multiscale_count,)return DataLoader(dataset, batch_size=batch_size, shuffle=False) | 1 | 12 | 4 | 58 | 1 | 155 | 166 | 155 | batch_size,img_size,target_ch,multiscale_count | ['dataset'] | Returns | {"Assign": 1, "Return": 1} | 2 | 12 | 2 | ["DummyDataset", "DataLoader"] | 8 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.test_LVAE_lightning_module_py.test_get_reconstructed_tensor", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.test_LVAE_lightni... | The function (create_dummy_dloader) defined within the public class called public.The function start at line 155 and ends at 166. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [155.0], and this function return a value. It declares 2.0 functions, It has 2.0 f... |
CAREamics_careamics | public | public | 0 | 0 | test_hdn_lightning_init | def test_hdn_lightning_init(multiscale_count: int,predict_logvar: str,ll_type: str,loss_type: str,output_channels: int,exp_error: Callable,):lvae_config = LVAEModel(architecture="LVAE",input_shape=(64, 64),multiscale_count=multiscale_count,z_dims=[128, 128, 128, 128],output_channels=output_channels,predict_logvar=predi... | 3 | 44 | 6 | 199 | 5 | 181 | 226 | 181 | multiscale_count,predict_logvar,ll_type,loss_type,output_channels,exp_error | ['gm_likelihood_config', 'vae_config', 'nm_likelihood_config', 'lightning_model', 'lvae_config'] | None | {"Assign": 7, "If": 2, "With": 1} | 15 | 46 | 15 | ["LVAEModel", "GaussianLikelihoodConfig", "NMLikelihoodConfig", "VAEBasedAlgorithm", "LVAELossConfig", "VAEModule", "isinstance", "isinstance", "pytest.mark.parametrize", "does_not_raise", "does_not_raise", "pytest.raises", "does_not_raise", "pytest.raises", "pytest.raises"] | 0 | [] | The function (test_hdn_lightning_init) defined within the public class called public.The function start at line 181 and ends at 226. It contains 44 lines of code and it has a cyclomatic complexity of 3. It takes 6 parameters, represented as [181.0] and does not return any value. It declares 15.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_microsplit_lightning_init | def test_microsplit_lightning_init(tmp_path: Path,multiscale_count: int,predict_logvar: str,target_ch: int,nm_cnt: int,loss_type: str,exp_error: Callable,):# Create the model configlvae_config = LVAEModel(architecture="LVAE",input_shape=(64, 64),multiscale_count=multiscale_count,z_dims=[128, 128, 128, 128],output_chann... | 6 | 68 | 7 | 328 | 7 | 256 | 332 | 256 | tmp_path,multiscale_count,predict_logvar,target_ch,nm_cnt,loss_type,exp_error | ['vae_config', 'gaussian_lik_config', 'gmm', 'noise_model_config', 'lvae_config', 'lightning_model', 'nm_lik_config'] | None | {"Assign": 10, "Expr": 1, "If": 5, "With": 1} | 36 | 77 | 36 | ["LVAEModel", "GaussianLikelihoodConfig", "create_dummy_noise_model", "GaussianMixtureNMConfig", "MultiChannelNMConfig", "NMLikelihoodConfig", "VAEBasedAlgorithm", "LVAELossConfig", "VAEModule", "isinstance", "isinstance", "isinstance", "isinstance", "isinstance", "isinstance", "isinstance", "pytest.mark.parametrize", ... | 0 | [] | The function (test_microsplit_lightning_init) defined within the public class called public.The function start at line 256 and ends at 332. It contains 68 lines of code and it has a cyclomatic complexity of 6. It takes 7 parameters, represented as [256.0] and does not return any value. It declares 36.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | test_hdn_training_step | def test_hdn_training_step(tmp_path: Path,batch_size: int,ll_type: str,):lightning_model = create_vae_lightning_model(tmp_path=tmp_path,algorithm="hdn",loss_type="hdn",ll_type=ll_type,multiscale_count=1,predict_logvar=None,target_ch=1,)dloader = create_dummy_dloader(batch_size=batch_size,img_size=64,multiscale_count=1,... | 2 | 31 | 3 | 158 | 6 | 337 | 371 | 337 | tmp_path,batch_size,ll_type | ['batch', 'data_mean', 'dloader', 'lightning_model', 'data_std', 'train_loss'] | None | {"Assign": 6, "Expr": 1, "If": 1} | 11 | 35 | 11 | ["create_vae_lightning_model", "create_dummy_dloader", "torch.zeros", "torch.zeros", "lightning_model.set_data_stats", "next", "iter", "lightning_model.training_step", "isinstance", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_hdn_training_step) defined within the public class called public.The function start at line 337 and ends at 371. It contains 31 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [337.0] and does not return any value. It declares 11.0 functions, and It has 1... |
CAREamics_careamics | public | public | 0 | 0 | test_hdn_validation_step | def test_hdn_validation_step(tmp_path: Path,batch_size: int,ll_type: str,):lightning_model = create_vae_lightning_model(tmp_path=tmp_path,algorithm="hdn",loss_type="hdn",ll_type=ll_type,multiscale_count=1,predict_logvar=None,target_ch=1,)dloader = create_dummy_dloader(batch_size=batch_size,img_size=64,multiscale_count=... | 2 | 26 | 3 | 132 | 5 | 376 | 403 | 376 | tmp_path,batch_size,ll_type | ['batch', 'data_mean', 'dloader', 'lightning_model', 'data_std'] | None | {"Assign": 5, "Expr": 2, "If": 1} | 10 | 28 | 10 | ["create_vae_lightning_model", "create_dummy_dloader", "torch.zeros", "torch.zeros", "lightning_model.set_data_stats", "next", "iter", "lightning_model.validation_step", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_hdn_validation_step) defined within the public class called public.The function start at line 376 and ends at 403. It contains 26 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [376.0] and does not return any value. It declares 10.0 functions, and It has... |
CAREamics_careamics | public | public | 0 | 0 | test_microsplit_training_step | def test_microsplit_training_step(tmp_path: Path,batch_size: int,multiscale_count: int,predict_logvar: str,target_ch: int,loss_type: str,):lightning_model = create_vae_lightning_model(tmp_path=(tmp_path if loss_type in ["denoisplit", "denoisplit_musplit"] else None),algorithm="microsplit",loss_type=loss_type,multiscale... | 3 | 35 | 6 | 182 | 6 | 434 | 472 | 434 | tmp_path,batch_size,multiscale_count,predict_logvar,target_ch,loss_type | ['batch', 'data_mean', 'dloader', 'lightning_model', 'data_std', 'train_loss'] | None | {"Assign": 6, "Expr": 1, "If": 1} | 10 | 39 | 10 | ["create_vae_lightning_model", "create_dummy_dloader", "torch.zeros", "torch.zeros", "lightning_model.set_data_stats", "next", "iter", "lightning_model.training_step", "isinstance", "pytest.mark.parametrize"] | 0 | [] | The function (test_microsplit_training_step) defined within the public class called public.The function start at line 434 and ends at 472. It contains 35 lines of code and it has a cyclomatic complexity of 3. It takes 6 parameters, represented as [434.0] and does not return any value. It declares 10.0 functions, and I... |
CAREamics_careamics | public | public | 0 | 0 | test_microsplit_validation_step | def test_microsplit_validation_step(tmp_path: Path,batch_size: int,multiscale_count: int,predict_logvar: str,target_ch: int,loss_type: str,):lightning_model = create_vae_lightning_model(tmp_path=(tmp_path if loss_type in ["denoisplit", "denoisplit_musplit"] else None),algorithm="microsplit",loss_type=loss_type,multisca... | 3 | 30 | 6 | 156 | 5 | 503 | 534 | 503 | tmp_path,batch_size,multiscale_count,predict_logvar,target_ch,loss_type | ['batch', 'data_mean', 'dloader', 'lightning_model', 'data_std'] | None | {"Assign": 5, "Expr": 2, "If": 1} | 9 | 32 | 9 | ["create_vae_lightning_model", "create_dummy_dloader", "torch.zeros", "torch.zeros", "lightning_model.set_data_stats", "next", "iter", "lightning_model.validation_step", "pytest.mark.parametrize"] | 0 | [] | The function (test_microsplit_validation_step) defined within the public class called public.The function start at line 503 and ends at 534. It contains 30 lines of code and it has a cyclomatic complexity of 3. It takes 6 parameters, represented as [503.0] and does not return any value. It declares 9.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | test_training_loop_hdn | def test_training_loop_hdn(tmp_path: Path,batch_size: int,):lightning_model = create_vae_lightning_model(tmp_path=tmp_path,algorithm="hdn",loss_type="hdn",multiscale_count=1,predict_logvar=None,target_ch=1,)dloader = create_dummy_dloader(batch_size=batch_size,img_size=64,multiscale_count=1,target_ch=1,)trainer = Traine... | 2 | 27 | 2 | 114 | 3 | 539 | 566 | 539 | tmp_path,batch_size | ['trainer', 'lightning_model', 'dloader'] | None | {"Assign": 3, "Expr": 2, "Try": 1} | 6 | 28 | 6 | ["create_vae_lightning_model", "create_dummy_dloader", "Trainer", "trainer.fit", "pytest.fail", "pytest.mark.parametrize"] | 0 | [] | The function (test_training_loop_hdn) defined within the public class called public.The function start at line 539 and ends at 566. It contains 27 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [539.0] and does not return any value. It declares 6.0 functions, and It has 6.... |
CAREamics_careamics | public | public | 0 | 0 | test_training_loop_microsplit | def test_training_loop_microsplit(tmp_path: Path,batch_size: int,multiscale_count: int,predict_logvar: str,target_ch: int,loss_type: str,):lightning_model = create_vae_lightning_model(tmp_path=(tmp_path if loss_type in ["denoisplit", "denoisplit_musplit"] else None),algorithm="microsplit",loss_type=loss_type,multiscale... | 4 | 37 | 6 | 187 | 5 | 597 | 636 | 597 | tmp_path,batch_size,multiscale_count,predict_logvar,target_ch,loss_type | ['trainer', 'data_mean', 'dloader', 'lightning_model', 'data_std'] | None | {"Assign": 5, "Expr": 3, "If": 1, "Try": 1} | 9 | 40 | 9 | ["create_vae_lightning_model", "create_dummy_dloader", "torch.zeros", "torch.zeros", "lightning_model.set_data_stats", "Trainer", "trainer.fit", "pytest.fail", "pytest.mark.parametrize"] | 0 | [] | The function (test_training_loop_microsplit) defined within the public class called public.The function start at line 597 and ends at 636. It contains 37 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [597.0] and does not return any value. It declares 9.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_get_reconstructed_tensor | def test_get_reconstructed_tensor(predict_logvar: str,target_ch: int,):lightning_model = create_vae_lightning_model(tmp_path=None,algorithm="microsplit",loss_type="musplit",multiscale_count=1,predict_logvar=predict_logvar,target_ch=target_ch,)dloader = create_dummy_dloader(batch_size=1,img_size=64,multiscale_count=1,ta... | 1 | 22 | 2 | 95 | 4 | 641 | 662 | 641 | predict_logvar,target_ch | ['output', 'lightning_model', 'rec_img', 'dloader'] | None | {"Assign": 5} | 8 | 22 | 8 | ["create_vae_lightning_model", "create_dummy_dloader", "next", "iter", "lightning_model", "lightning_model.get_reconstructed_tensor", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_get_reconstructed_tensor) defined within the public class called public.The function start at line 641 and ends at 662. It contains 22 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [641.0] and does not return any value. It declares 8.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_val_PSNR_computation | def test_val_PSNR_computation(predict_logvar: str,target_ch: int,):lightning_model = create_vae_lightning_model(tmp_path=None,algorithm="microsplit",loss_type="musplit",multiscale_count=1,predict_logvar=predict_logvar,target_ch=target_ch,)assert lightning_model.running_psnr is not Noneassert len(lightning_model.running... | 3 | 39 | 2 | 266 | 4 | 667 | 707 | 667 | predict_logvar,target_ch | ['output', 'curr_psnr', 'lightning_model', 'dloader'] | None | {"Assign": 5, "Expr": 1, "For": 2} | 15 | 41 | 15 | ["create_vae_lightning_model", "len", "isinstance", "create_dummy_dloader", "next", "iter", "lightning_model", "lightning_model.compute_val_psnr", "len", "range", "get", "reset", "get", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_val_PSNR_computation) defined within the public class called public.The function start at line 667 and ends at 707. It contains 39 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [667.0] and does not return any value. It declares 15.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_smoke_n2v_2d_array | def test_smoke_n2v_2d_array(tmp_path, minimum_n2v_configuration):"""Test a full run of N2V training with the lightning API."""rng = np.random.default_rng(42)# training datatrain_array = rng.integers(0, 255, (32, 32)).astype(np.float32)val_array = rng.integers(0, 255, (32, 32)).astype(np.float32)cfg = Configuration(**mi... | 1 | 40 | 2 | 270 | 9 | 21 | 76 | 21 | tmp_path,minimum_n2v_configuration | ['predict_data', 'predicted', 'trainer', 'model', 'cfg', 'train_array', 'rng', 'data', 'val_array'] | None | {"Assign": 10, "Expr": 2} | 17 | 56 | 17 | ["np.random.default_rng", "astype", "rng.integers", "astype", "rng.integers", "Configuration", "create_careamics_module", "create_train_datamodule", "Trainer", "ModelCheckpoint", "trainer.fit", "exists", "Path", "data.get_data_statistics", "create_predict_datamodule", "trainer.predict", "squeeze"] | 0 | [] | The function (test_smoke_n2v_2d_array) defined within the public class called public.The function start at line 21 and ends at 76. It contains 40 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [21.0] and does not return any value. It declares 17.0 functions, and It has 17.... |
CAREamics_careamics | public | public | 0 | 0 | test_smoke_n2v_2d_tiling | def test_smoke_n2v_2d_tiling(tmp_path, minimum_n2v_configuration):"""Test a full run of N2V training with the lightning API and tiled prediction."""# training datarng = np.random.default_rng(42)train_array = rng.integers(0, 255, (32, 32)).astype(np.float32)val_array = rng.integers(0, 255, (32, 32)).astype(np.float32)cf... | 1 | 43 | 2 | 297 | 10 | 79 | 136 | 79 | tmp_path,minimum_n2v_configuration | ['predict_data', 'predicted', 'trainer', 'model', 'cfg', 'train_array', 'rng', 'predicted_stitched', 'data', 'val_array'] | None | {"Assign": 11, "Expr": 2} | 17 | 58 | 17 | ["np.random.default_rng", "astype", "rng.integers", "astype", "rng.integers", "Configuration", "create_careamics_module", "create_train_datamodule", "Trainer", "ModelCheckpoint", "trainer.fit", "exists", "Path", "data.get_data_statistics", "create_predict_datamodule", "trainer.predict", "convert_outputs"] | 0 | [] | The function (test_smoke_n2v_2d_tiling) defined within the public class called public.The function start at line 79 and ends at 136. It contains 43 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [79.0] and does not return any value. It declares 17.0 functions, and It has 1... |
CAREamics_careamics | public | public | 0 | 0 | test_careamics_module | def test_careamics_module(minimum_algorithm_n2v):"""Test that the minimum algorithm allows instantiating a the Lightning APIintermediate layer."""algo_config = UNetBasedAlgorithm(**minimum_algorithm_n2v)# extract model parametersmodel_parameters = algo_config.model.model_dump(exclude_none=True)# instantiate FCNModulecr... | 1 | 13 | 1 | 84 | 2 | 13 | 31 | 13 | minimum_algorithm_n2v | ['model_parameters', 'algo_config'] | None | {"Assign": 2, "Expr": 2} | 3 | 19 | 3 | ["UNetBasedAlgorithm", "algo_config.model.model_dump", "create_careamics_module"] | 0 | [] | The function (test_careamics_module) defined within the public class called public.The function start at line 13 and ends at 31. 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 3.0 functions, and It has 3.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_careamics_fcn | def test_careamics_fcn(minimum_algorithm_n2v):"""Test that the minimum algorithm allows instantiating a CAREamicsKiln."""algo_config = UNetBasedAlgorithm(**minimum_algorithm_n2v)# instantiate CAREamicsKilnFCNModule(algo_config) | 1 | 3 | 1 | 17 | 1 | 34 | 39 | 34 | minimum_algorithm_n2v | ['algo_config'] | None | {"Assign": 1, "Expr": 2} | 2 | 6 | 2 | ["UNetBasedAlgorithm", "FCNModule"] | 0 | [] | The function (test_careamics_fcn) defined within the public class called public.The function start at line 34 and ends at 39. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_2D_depth_2_shape | def test_fcn_module_unet_2D_depth_2_shape(shape):algo_dict = {"algorithm": "n2n","model": {"architecture": "UNet","conv_dims": 2,"in_channels": 1,"num_classes": 1,"depth": 2,},"loss": "mae",}algo_config = UNetBasedAlgorithm(**algo_dict)# instantiate CAREamicsKilnmodel = FCNModule(algo_config)# set model to evaluation m... | 1 | 18 | 1 | 97 | 4 | 50 | 71 | 50 | shape | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 22 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_2D_depth_2_shape) defined within the public class called public.The function start at line 50 and ends at 71. 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 6.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_2D_depth_3_shape | def test_fcn_module_unet_2D_depth_3_shape(shape):algo_dict = {"algorithm": "n2n","model": {"architecture": "UNet","conv_dims": 2,"in_channels": 1,"num_classes": 1,"depth": 3,},"loss": "mae",}algo_config = UNetBasedAlgorithm(**algo_dict)# instantiate CAREamicsKilnmodel = FCNModule(algo_config)# set model to evaluation m... | 1 | 18 | 1 | 97 | 4 | 85 | 106 | 85 | shape | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 22 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_2D_depth_3_shape) defined within the public class called public.The function start at line 85 and ends at 106. 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 6.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_depth_2_3D | def test_fcn_module_unet_depth_2_3D(shape):algo_dict = {"algorithm": "n2n","model": {"architecture": "UNet","conv_dims": 3,"in_channels": 1,"num_classes": 1,"depth": 2,},"loss": "mae",}algo_config = UNetBasedAlgorithm(**algo_dict)# instantiate CAREamicsKilnmodel = FCNModule(algo_config)# set model to evaluation mode to... | 1 | 18 | 1 | 97 | 4 | 118 | 139 | 118 | shape | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 22 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_depth_2_3D) defined within the public class called public.The function start at line 118 and ends at 139. 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 6.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_depth_3_3D | def test_fcn_module_unet_depth_3_3D(shape):algo_dict = {"algorithm": "n2n","model": {"architecture": "UNet","conv_dims": 3,"in_channels": 1,"num_classes": 1,"depth": 3,},"loss": "mae",}algo_config = UNetBasedAlgorithm(**algo_dict)# instantiate CAREamicsKilnmodel = FCNModule(algo_config)# set model to evaluation mode to... | 1 | 18 | 1 | 97 | 4 | 151 | 172 | 151 | shape | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 22 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_depth_3_3D) defined within the public class called public.The function start at line 151 and ends at 172. 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 6.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_depth_3_3D_n2v2 | def test_fcn_module_unet_depth_3_3D_n2v2(shape):algo_dict = {"algorithm": "n2v","model": {"architecture": "UNet","conv_dims": 3,"in_channels": 1,"num_classes": 1,"depth": 3,"n2v2": True,},"loss": "n2v",}algo_config = UNetBasedAlgorithm(**algo_dict)# instantiate CAREamicsKilnmodel = FCNModule(algo_config)# set model to ... | 1 | 19 | 1 | 101 | 4 | 184 | 206 | 184 | shape | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 23 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_depth_3_3D_n2v2) defined within the public class called public.The function start at line 184 and ends at 206. 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 6.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_depth_2_channels_2D | def test_fcn_module_unet_depth_2_channels_2D(n_channels):algo_dict = {"algorithm": "n2n","model": {"architecture": "UNet","conv_dims": 2,"in_channels": n_channels,"num_classes": n_channels,"depth": 2,},"loss": "mae",}algo_config = UNetBasedAlgorithm(**algo_dict)# instantiate CAREamicsKilnmodel = FCNModule(algo_config)#... | 1 | 18 | 1 | 98 | 4 | 210 | 231 | 210 | n_channels | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 22 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_depth_2_channels_2D) defined within the public class called public.The function start at line 210 and ends at 231. 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 6.0 functions, ... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_depth_3_channels_2D | def test_fcn_module_unet_depth_3_channels_2D(n_channels, independent_channels):algo_dict = {"algorithm": "n2n","model": {"architecture": "UNet","conv_dims": 2,"in_channels": n_channels,"num_classes": n_channels,"depth": 3,"independent_channels": independent_channels,},"loss": "mae",}algo_config = UNetBasedAlgorithm(**a... | 1 | 19 | 2 | 104 | 4 | 238 | 260 | 238 | n_channels,independent_channels | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 23 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_depth_3_channels_2D) defined within the public class called public.The function start at line 238 and ends at 260. It contains 19 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [238.0] and does not return any value. It declares 6.0 functio... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_depth_2_channels_3D | def test_fcn_module_unet_depth_2_channels_3D(n_channels):algo_dict = {"algorithm": "n2n","model": {"architecture": "UNet","conv_dims": 3,"in_channels": n_channels,"num_classes": n_channels,"depth": 2,},"loss": "mae",}algo_config = UNetBasedAlgorithm(**algo_dict)# instantiate CAREamicsKilnmodel = FCNModule(algo_config)#... | 1 | 18 | 1 | 100 | 4 | 264 | 285 | 264 | n_channels | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 22 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_depth_2_channels_3D) defined within the public class called public.The function start at line 264 and ends at 285. 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 6.0 functions, ... |
CAREamics_careamics | public | public | 0 | 0 | test_fcn_module_unet_depth_3_channels_3D | def test_fcn_module_unet_depth_3_channels_3D(n_channels):algo_dict = {"algorithm": "n2n","model": {"architecture": "UNet","conv_dims": 3,"in_channels": n_channels,"num_classes": n_channels,"depth": 3,},"loss": "mae",}algo_config = UNetBasedAlgorithm(**algo_dict)# instantiate CAREamicsKilnmodel = FCNModule(algo_config)#... | 1 | 18 | 1 | 100 | 4 | 289 | 310 | 289 | n_channels | ['x', 'algo_config', 'model', 'algo_dict'] | None | {"AnnAssign": 1, "Assign": 4, "Expr": 1} | 6 | 22 | 6 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "model.forward", "pytest.mark.parametrize"] | 0 | [] | The function (test_fcn_module_unet_depth_3_channels_3D) defined within the public class called public.The function start at line 289 and ends at 310. 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 6.0 functions, ... |
CAREamics_careamics | public | public | 0 | 0 | test_prediction_callback_during_training.__init__ | def __init__(self, pred_datamodule: PredictDataModule):self.pred_datamodule = pred_datamodule# prepare data and setupself.pred_datamodule.prepare_data()self.pred_datamodule.setup()self.pred_dataloader = pred_datamodule.predict_dataloader()self.data = None | 1 | 6 | 2 | 42 | 0 | 327 | 335 | 327 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_prediction_callback_during_training.__init__) defined within the public class called public.The function start at line 327 and ends at 335. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [327.0] and does not return any value.. |
CAREamics_careamics | public | public | 0 | 0 | test_prediction_callback_during_training.on_validation_epoch_end | def on_validation_epoch_end(self, trainer: Trainer, pl_module):if trainer.sanity_checking:# optional skipreturn# update statistics in the prediction dataset for coherence# (they can computed on-line by the training dataset)self.pred_datamodule.predict_dataset.image_means = (trainer.datamodule.train_dataset.image_stats.... | 3 | 14 | 3 | 114 | 0 | 337 | 356 | 337 | null | [] | None | null | 0 | 0 | 0 | null | 0 | null | The function (test_prediction_callback_during_training.on_validation_epoch_end) defined within the public class called public.The function start at line 337 and ends at 356. It contains 14 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [337.0] and does not return any value.... |
CAREamics_careamics | public | public | 0 | 0 | test_prediction_callback_during_training | def test_prediction_callback_during_training(minimum_n2v_configuration, tiled):import numpy as npfrom pytorch_lightning import Callback, Trainerfrom careamics import CAREamistfrom careamics.config import Configurationfrom careamics.lightning import PredictDataModule, create_predict_datamodulefrom careamics.prediction_u... | 3 | 28 | 2 | 186 | 7 | 315 | 376 | 315 | minimum_n2v_configuration,tiled | ['outputs', 'config', 'array', 'batch', 'engine', 'predict_after_val_callback', 'pred_datamodule'] | None | {"Assign": 13, "Expr": 4, "For": 1, "If": 1, "Return": 1} | 17 | 62 | 17 | ["Configuration", "self.pred_datamodule.prepare_data", "self.pred_datamodule.setup", "pred_datamodule.predict_dataloader", "enumerate", "pl_module.transfer_batch_to_device", "outputs.append", "pl_module.predict_step", "convert_outputs", "reshape", "np.arange", "create_predict_datamodule", "CustomPredictAfterValidationC... | 0 | [] | The function (test_prediction_callback_during_training) defined within the public class called public.The function start at line 315 and ends at 376. It contains 28 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [315.0] and does not return any value. It declares 17.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_onnx_export | def test_onnx_export(tmp_path, algorithm, architecture, conv_dim, n2v2, loss, shape):"""Test model exportability to ONNX."""algo_config = {"algorithm": algorithm,"model": {"architecture": architecture,"conv_dims": conv_dim,"in_channels": 1,"num_classes": 1,"depth": 3,"n2v2": n2v2,},"loss": loss,}algo_config = UNetBased... | 2 | 30 | 7 | 177 | 4 | 22 | 61 | 22 | tmp_path,algorithm,architecture,conv_dim,n2v2,loss,shape | ['x', 'dynamic_axes', 'model', 'algo_config'] | None | {"Assign": 7, "Expr": 4, "For": 1} | 9 | 40 | 9 | ["UNetBasedAlgorithm", "FCNModule", "model.model.eval", "torch.rand", "range", "len", "torch.onnx.export", "checker.check_model", "pytest.mark.parametrize"] | 0 | [] | The function (test_onnx_export) defined within the public class called public.The function start at line 22 and ends at 61. It contains 30 lines of code and it has a cyclomatic complexity of 2. It takes 7 parameters, represented as [22.0] and does not return any value. It declares 9.0 functions, and It has 9.0 functio... |
CAREamics_careamics | public | public | 0 | 0 | test_microsplit_datamodule_data_stats | def test_microsplit_datamodule_data_stats(tmp_path):rng = np.random.default_rng(42)# Create channel directoriesch0_dir = tmp_path / "ch0"ch1_dir = tmp_path / "ch1"ch0_dir.mkdir()ch1_dir.mkdir()# Create random data for each channelfor i in range(5):data_ch0 = rng.integers(0, 255, (64, 64)).astype(np.float32)data_ch1 = r... | 2 | 35 | 1 | 233 | 7 | 18 | 61 | 18 | tmp_path | ['data_ch0', 'config', 'data_module', 'ch1_dir', 'rng', 'ch0_dir', 'data_ch1'] | None | {"Assign": 8, "Expr": 4, "For": 1} | 16 | 44 | 16 | ["np.random.default_rng", "ch0_dir.mkdir", "ch1_dir.mkdir", "range", "astype", "rng.integers", "astype", "rng.integers", "tifffile.imwrite", "tifffile.imwrite", "MicroSplitDataConfig", "MicroSplitDataModule", "str", "len", "isinstance", "isinstance"] | 0 | [] | The function (test_microsplit_datamodule_data_stats) defined within the public class called public.The function start at line 18 and ends at 61. It contains 35 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 16.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | simple_array | def simple_array(ordered_array):return ordered_array((10, 10)) | 1 | 2 | 1 | 14 | 0 | 9 | 10 | 9 | ordered_array | [] | Returns | {"Return": 1} | 1 | 2 | 1 | ["ordered_array"] | 0 | [] | The function (simple_array) defined within the public class called public.The function start at line 9 and ends at 10. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declare 1.0 function, and It has 1.0 function calle... |
CAREamics_careamics | public | public | 0 | 0 | test_mismatching_types_array | def test_mismatching_types_array(simple_array, minimum_algorithm_n2v):"""Test that an error is raised if the data type does not match the passed data."""minimum_algorithm_n2v["data_type"] = SupportedData.TIFF.valuewith pytest.raises(ValueError):PredictDataModule(data_config=InferenceConfig(**minimum_algorithm_n2v),trai... | 1 | 19 | 2 | 107 | 0 | 13 | 34 | 13 | simple_array,minimum_algorithm_n2v | [] | None | {"Assign": 3, "Expr": 4, "With": 3} | 9 | 22 | 9 | ["pytest.raises", "PredictDataModule", "InferenceConfig", "pytest.raises", "PredictDataModule", "InferenceConfig", "pytest.raises", "PredictDataModule", "InferenceConfig"] | 0 | [] | The function (test_mismatching_types_array) defined within the public class called public.The function start at line 13 and ends at 34. It contains 19 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 9.0 functions, and It has... |
CAREamics_careamics | public | public | 0 | 0 | test_wrapper_unknown_type | def test_wrapper_unknown_type(simple_array):"""Test that an error is raised if the data type is not supported."""with pytest.raises(ValueError):create_predict_datamodule(pred_data=simple_array,data_type="wrong_type",image_means=[0.5],image_stds=[0.1],axes="YX",batch_size=2,) | 1 | 10 | 1 | 49 | 0 | 37 | 47 | 37 | simple_array | [] | None | {"Expr": 2, "With": 1} | 2 | 11 | 2 | ["pytest.raises", "create_predict_datamodule"] | 0 | [] | The function (test_wrapper_unknown_type) defined within the public class called public.The function start at line 37 and ends at 47. It contains 10 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 f... |
CAREamics_careamics | public | public | 0 | 0 | test_wrapper_instantiated_with_tiling | def test_wrapper_instantiated_with_tiling(simple_array):"""Test that the data module is created correctly with an array."""# create data moduledata_module = create_predict_datamodule(pred_data=simple_array,data_type="array",image_means=[0.5],image_stds=[0.1],axes="YX",batch_size=2,tile_overlap=[2, 2],tile_size=[8, 8],)... | 1 | 14 | 1 | 83 | 1 | 50 | 66 | 50 | simple_array | ['data_module'] | None | {"Assign": 1, "Expr": 3} | 6 | 17 | 6 | ["create_predict_datamodule", "data_module.prepare_data", "data_module.setup", "len", "list", "data_module.predict_dataloader"] | 0 | [] | The function (test_wrapper_instantiated_with_tiling) defined within the public class called public.The function start at line 50 and ends at 66. 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 6.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | test_wrapper_instantiated_without_tiling | def test_wrapper_instantiated_without_tiling(simple_array):"""Test that the data module is created correctly with an array."""# create data moduledata_module = create_predict_datamodule(pred_data=simple_array,data_type="array",image_means=[0.5],image_stds=[0.1],axes="YX",batch_size=2,)data_module.prepare_data()data_mod... | 1 | 12 | 1 | 67 | 1 | 69 | 83 | 69 | simple_array | ['data_module'] | None | {"Assign": 1, "Expr": 3} | 6 | 15 | 6 | ["create_predict_datamodule", "data_module.prepare_data", "data_module.setup", "len", "list", "data_module.predict_dataloader"] | 0 | [] | The function (test_wrapper_instantiated_without_tiling) defined within the public class called public.The function start at line 69 and ends at 83. 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 6.0 functions, an... |
CAREamics_careamics | public | public | 0 | 0 | simple_array | def simple_array(ordered_array):return ordered_array((10, 10)) | 1 | 2 | 1 | 14 | 0 | 16 | 17 | 16 | ordered_array | [] | Returns | {"Return": 1} | 1 | 2 | 1 | ["ordered_array"] | 0 | [] | The function (simple_array) defined within the public class called public.The function start at line 16 and ends at 17. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declare 1.0 function, and It has 1.0 function call... |
CAREamics_careamics | public | public | 0 | 0 | test_mismatching_types_array | def test_mismatching_types_array(simple_array, minimum_algorithm_n2v):"""Test that an error is raised if the data type does not match the passed data."""minimum_algorithm_n2v["data_type"] = SupportedData.TIFF.valuewith pytest.raises(ValueError):TrainDataModule(data_config=DataConfig(**minimum_algorithm_n2v), train_data... | 1 | 16 | 2 | 104 | 0 | 20 | 38 | 20 | simple_array,minimum_algorithm_n2v | [] | None | {"Assign": 3, "Expr": 4, "With": 3} | 9 | 19 | 9 | ["pytest.raises", "TrainDataModule", "DataConfig", "pytest.raises", "TrainDataModule", "DataConfig", "pytest.raises", "TrainDataModule", "DataConfig"] | 0 | [] | The function (test_mismatching_types_array) defined within the public class called public.The function start at line 20 and ends at 38. It contains 16 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [20.0] and does not return any value. It declares 9.0 functions, and It has... |
CAREamics_careamics | public | public | 0 | 0 | test_wrapper_unknown_type | def test_wrapper_unknown_type(simple_array):"""Test that an error is raised if the data type is not supported."""with pytest.raises(ValueError):create_train_datamodule(train_data=simple_array,data_type="wrong_type",patch_size=(8, 8),axes="YX",batch_size=2,) | 1 | 9 | 1 | 41 | 0 | 41 | 50 | 41 | simple_array | [] | None | {"Expr": 2, "With": 1} | 2 | 10 | 2 | ["pytest.raises", "create_train_datamodule"] | 0 | [] | The function (test_wrapper_unknown_type) defined within the public class called public.The function start at line 41 and ends at 50. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_wrapper_train_array | def test_wrapper_train_array(simple_array):"""Test that the data module is created correctly with an array."""# create data moduledata_module = create_train_datamodule(train_data=simple_array,data_type="array",patch_size=(8, 8),axes="YX",batch_size=2,val_minimum_patches=2,)data_module.prepare_data()data_module.setup()a... | 1 | 12 | 1 | 63 | 1 | 53 | 67 | 53 | simple_array | ['data_module'] | None | {"Assign": 1, "Expr": 3} | 6 | 15 | 6 | ["create_train_datamodule", "data_module.prepare_data", "data_module.setup", "len", "list", "data_module.train_dataloader"] | 0 | [] | The function (test_wrapper_train_array) defined within the public class called public.The function start at line 53 and ends at 67. 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 6.0 functions, and It has 6.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_wrapper_supervised | def test_wrapper_supervised(simple_array):"""Test that a supervised data config is created."""data_module = create_train_datamodule(train_data=simple_array,data_type="array",patch_size=(8, 8),axes="YX",batch_size=2,train_target_data=simple_array,val_minimum_patches=2,)for transform in data_module.data_config.transforms... | 2 | 12 | 1 | 62 | 1 | 70 | 82 | 70 | simple_array | ['data_module'] | None | {"Assign": 1, "Expr": 1, "For": 1} | 1 | 13 | 1 | ["create_train_datamodule"] | 0 | [] | The function (test_wrapper_supervised) defined within the public class called public.The function start at line 70 and ends at 82. It contains 12 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 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_wrapper_supervised_n2v_throws_error | def test_wrapper_supervised_n2v_throws_error(simple_array):"""Test that an error is raised if target data is passed but the transformations(default ones) contain N2V manipulate."""with pytest.raises(ValueError):create_train_datamodule(train_data=simple_array,data_type="array",patch_size=(8, 8),axes="YX",batch_size=2,tr... | 1 | 12 | 1 | 61 | 0 | 85 | 98 | 85 | simple_array | [] | None | {"Expr": 2, "With": 1} | 4 | 14 | 4 | ["pytest.raises", "create_train_datamodule", "XYFlipModel", "N2VManipulateModel"] | 0 | [] | The function (test_wrapper_supervised_n2v_throws_error) defined within the public class called public.The function start at line 85 and ends at 98. 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 4.0 functions, an... |
CAREamics_careamics | public | public | 0 | 0 | test_get_data_statistics | def test_get_data_statistics(tmp_path):"""Test that get_data_statistics works for every type of training dataset."""rng = np.random.default_rng(42)data = rng.integers(0, 255, (5, 3, 32, 32))data_mean = data.mean(axis=(0, 2, 3))data_std = data.std(axis=(0, 2, 3))data_val = rng.integers(0, 10, (2, 3, 32, 32))# create dat... | 3 | 51 | 1 | 352 | 10 | 101 | 161 | 101 | tmp_path | ['val_path', 'data_val', 'data_module', 'data_path', 'train_path', 'data_mean', 'rng', 'data_config', 'data_std', 'data'] | None | {"Assign": 15, "Expr": 9, "For": 2} | 27 | 61 | 27 | ["np.random.default_rng", "rng.integers", "data.mean", "data.std", "rng.integers", "DataConfig", "TrainDataModule", "data_module.prepare_data", "data_module.setup", "isinstance", "data_module.get_data_statistics", "np.allclose", "np.allclose", "train_path.mkdir", "val_path.mkdir", "range", "imwrite", "range", "imwrite"... | 0 | [] | The function (test_get_data_statistics) defined within the public class called public.The function start at line 101 and ends at 161. It contains 51 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 27.0 functions, and It has 27.... |
CAREamics_careamics | public | public | 0 | 0 | create_tiles | def create_tiles(n_samples: int) -> tuple[list[NDArray], list[TileInformation]]:"""Create a set of tiles from `n_samples`.To create the tiles the following parameters, `tile_size=(4, 4)` and`overlaps=(2, 2)`, on an input array with shape (`n_samples`, 1, 8, 8); thisresults in 9 tiles per sample.Parameters----------n_sa... | 3 | 9 | 1 | 105 | 7 | 21 | 51 | 21 | n_samples | ['all_tiles', 'tile_size', 'arr', 'tile_infos', 'input_shape', 'tile_overlap', 'tiles'] | tuple[list[NDArray], list[TileInformation]] | {"Assign": 7, "Expr": 1, "Return": 1} | 5 | 31 | 5 | ["reshape", "np.arange", "np.prod", "list", "extract_tiles"] | 9 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.callbacks.prediction_writer_callback.test_cache_tiles_write_strategy_py.test_clear_cache", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.test... | The function (create_tiles) defined within the public class called public.The function start at line 21 and ends at 51. It contains 9 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 5.0 functions, It has 5.0 functions called ins... |
CAREamics_careamics | public | public | 0 | 0 | patch_tile_cache | def patch_tile_cache(strategy: CacheTiles, tiles: list[NDArray], tile_infos: list[TileInformation]) -> None:"""Patch simulated tile cache into `strategy`.Parameters----------strategy : CacheTilesWrite strategy `CacheTiles`.tiles : list of NDArrayTiles to patch into `strategy.tile_cache`.tile_infos : list of TileInforma... | 1 | 5 | 3 | 34 | 0 | 54 | 70 | 54 | strategy,tiles,tile_infos | [] | None | {"Assign": 2, "Expr": 1} | 0 | 17 | 0 | [] | 9 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.callbacks.prediction_writer_callback.test_cache_tiles_write_strategy_py.test_clear_cache", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.test... | The function (patch_tile_cache) defined within the public class called public.The function start at line 54 and ends at 70. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [54.0] and does not return any value. It has 9.0 functions calling this function which ar... |
CAREamics_careamics | public | public | 0 | 0 | write_func | def write_func():"""Mock `WriteFunc`."""return Mock(spec=WriteFunc) | 1 | 2 | 0 | 12 | 0 | 74 | 76 | 74 | [] | Returns | {"Expr": 1, "Return": 1} | 1 | 3 | 1 | ["Mock"] | 1 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.careamist_py.CAREamist.predict_to_disk"] | The function (write_func) defined within the public class called public.The function start at line 74 and ends at 76. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declare 1.0 function, It has 1.0 function called insi... | |
CAREamics_careamics | public | public | 0 | 0 | cache_tiles_strategy | def cache_tiles_strategy(write_func) -> CacheTiles:"""Initialized `CacheTiles` class.Parameters----------write_func : WriteFuncWrite function. (Comes from fixture).Returns-------CacheTilesInitialized `CacheTiles` class."""write_extension = ".ext"write_func_kwargs = {}return CacheTiles(write_func=write_func,write_extens... | 1 | 8 | 1 | 31 | 2 | 80 | 100 | 80 | write_func | ['write_extension', 'write_func_kwargs'] | CacheTiles | {"Assign": 2, "Expr": 1, "Return": 1} | 1 | 21 | 1 | ["CacheTiles"] | 0 | [] | The function (cache_tiles_strategy) defined within the public class called public.The function start at line 80 and ends at 100. 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 declare 1.0 function, and It has 1.0 function... |
CAREamics_careamics | public | public | 0 | 0 | test_cache_tiles_init | def test_cache_tiles_init(write_func, cache_tiles_strategy):"""Test `CacheTiles` initializes as expected."""assert cache_tiles_strategy.write_func is write_funcassert cache_tiles_strategy.write_extension == ".ext"assert cache_tiles_strategy.write_func_kwargs == {}assert cache_tiles_strategy.tile_cache == []assert cache... | 1 | 6 | 2 | 41 | 0 | 103 | 111 | 103 | write_func,cache_tiles_strategy | [] | None | {"Expr": 1} | 0 | 9 | 0 | [] | 0 | [] | The function (test_cache_tiles_init) defined within the public class called public.The function start at line 103 and ends at 111. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [103.0] and does not return any value.. |
CAREamics_careamics | public | public | 0 | 0 | test_last_tiles | def test_last_tiles(cache_tiles_strategy):"""Test `CacheTiles.last_tile` property."""# all tiles of 1 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=1)patch_tile_cache(cache_tiles_strategy, tiles, tile_infos)last_tile = [False, False, False, False, False, False, False, False, True]assert cache_tiles_str... | 1 | 5 | 1 | 51 | 1 | 114 | 122 | 114 | cache_tiles_strategy | ['last_tile'] | None | {"Assign": 2, "Expr": 2} | 2 | 9 | 2 | ["create_tiles", "patch_tile_cache"] | 0 | [] | The function (test_last_tiles) defined within the public class called public.The function start at line 114 and ends at 122. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and It has 2.0 functions ... |
CAREamics_careamics | public | public | 0 | 0 | test_write_batch_no_last_tile | def test_write_batch_no_last_tile(cache_tiles_strategy):"""Test `CacheTiles.write_batch` when there is no last tile added to the cache.Expected behaviour is that the batch is added to the cache."""# all tiles of 1 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=1)# simulate adding a batch that will not c... | 2 | 31 | 1 | 203 | 8 | 125 | 169 | 125 | cache_tiles_strategy | ['extended_tiles', 'mock_dataset', 'extended_tile_infos', 'n_tiles', 'trainer', 'next_batch', 'dataloader_idx', 'batch_size'] | None | {"Assign": 11, "Expr": 3} | 12 | 45 | 12 | ["create_tiles", "patch_tile_cache", "np.concatenate", "Mock", "Mock", "Mock", "cache_tiles_strategy.write_batch", "Mock", "Mock", "all", "np.array_equal", "range"] | 0 | [] | The function (test_write_batch_no_last_tile) defined within the public class called public.The function start at line 125 and ends at 169. It contains 31 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 12.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_write_batch_last_tile | def test_write_batch_last_tile(cache_tiles_strategy):"""Test `CacheTiles.write_batch` when there is a last tile added to the cache.Expected behaviour is that the cache is cleared and the write func is called."""# all tiles of 2 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=2)# simulate adding a batch t... | 1 | 54 | 1 | 320 | 15 | 172 | 254 | 172 | cache_tiles_strategy | ['mock_create_write_file_path', 'mock_stitch_prediction_single', 'mock_dataset', 'out_file_path', 'in_file_path', 'remaining_tile_info', 'n_tiles', 'trainer', 'prediction_image', 'mock_get_sample_file_path', 'next_batch', 'dataloader_idx', 'dirpath', 'batch_size', 'remaining_tile'] | None | {"Assign": 22, "Expr": 5, "With": 1} | 18 | 83 | 18 | ["create_tiles", "patch_tile_cache", "np.concatenate", "Mock", "Mock", "Mock", "Mock", "patch.multiple", "Mock", "Path", "Path", "cache_tiles_strategy.write_batch", "Mock", "Mock", "mock_create_write_file_path.assert_called_once_with", "cache_tiles_strategy.write_func.assert_called_once_with", "len", "np.array_equal"] | 0 | [] | The function (test_write_batch_last_tile) defined within the public class called public.The function start at line 172 and ends at 254. It contains 54 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 18.0 functions, and It has 1... |
CAREamics_careamics | public | public | 0 | 0 | test_have_last_tile_true | def test_have_last_tile_true(cache_tiles_strategy):"""Test `CacheTiles._have_last_tile` returns true when there is a last tile."""# all tiles of 1 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=1)patch_tile_cache(cache_tiles_strategy, tiles, tile_infos)assert cache_tiles_strategy._has_last_tile() | 1 | 4 | 1 | 30 | 0 | 257 | 264 | 257 | cache_tiles_strategy | [] | None | {"Assign": 1, "Expr": 2} | 3 | 8 | 3 | ["create_tiles", "patch_tile_cache", "cache_tiles_strategy._has_last_tile"] | 0 | [] | The function (test_have_last_tile_true) defined within the public class called public.The function start at line 257 and ends at 264. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 f... |
CAREamics_careamics | public | public | 0 | 0 | test_have_last_tile_false | def test_have_last_tile_false(cache_tiles_strategy):"""Test `CacheTiles._have_last_tile` returns false when there is not a last tile."""# all tiles of 1 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=1)# don't include last tilepatch_tile_cache(cache_tiles_strategy, tiles[:-1], tile_infos[:-1])assert not... | 1 | 4 | 1 | 41 | 0 | 267 | 275 | 267 | cache_tiles_strategy | [] | None | {"Assign": 1, "Expr": 2} | 3 | 9 | 3 | ["create_tiles", "patch_tile_cache", "cache_tiles_strategy._has_last_tile"] | 0 | [] | The function (test_have_last_tile_false) defined within the public class called public.The function start at line 267 and ends at 275. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 ... |
CAREamics_careamics | public | public | 0 | 0 | test_clear_cache | def test_clear_cache(cache_tiles_strategy):"""Test `CacheTiles._clear_cache` removes the tiles up until the first "last tile"."""# all tiles of 2 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=2)# include first tile from next samplepatch_tile_cache(cache_tiles_strategy, tiles[:10], tile_infos[:10])cache... | 1 | 7 | 1 | 75 | 0 | 278 | 292 | 278 | cache_tiles_strategy | [] | None | {"Assign": 1, "Expr": 3} | 5 | 15 | 5 | ["create_tiles", "patch_tile_cache", "cache_tiles_strategy._clear_cache", "len", "np.array_equal"] | 0 | [] | The function (test_clear_cache) defined within the public class called public.The function start at line 278 and ends at 292. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 functions... |
CAREamics_careamics | public | public | 0 | 0 | test_last_tile_index | def test_last_tile_index(cache_tiles_strategy):"""Test `CacheTiles._last_tile_index` returns the index of the last tile."""# all tiles of 1 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=1)patch_tile_cache(cache_tiles_strategy, tiles, tile_infos)assert cache_tiles_strategy._last_tile_index() == 8 | 1 | 4 | 1 | 32 | 0 | 295 | 301 | 295 | cache_tiles_strategy | [] | None | {"Assign": 1, "Expr": 2} | 3 | 7 | 3 | ["create_tiles", "patch_tile_cache", "cache_tiles_strategy._last_tile_index"] | 0 | [] | The function (test_last_tile_index) defined within the public class called public.The function start at line 295 and ends at 301. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_last_tile_index_error | def test_last_tile_index_error(cache_tiles_strategy):"""Test `CacheTiles._last_tile_index` raises an error when there is no last tile."""# all tiles of 1 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=1)# don't include last tilepatch_tile_cache(cache_tiles_strategy, tiles[:-1], tile_infos[:-1])with pyte... | 1 | 5 | 1 | 47 | 0 | 304 | 312 | 304 | cache_tiles_strategy | [] | None | {"Assign": 1, "Expr": 3, "With": 1} | 4 | 9 | 4 | ["create_tiles", "patch_tile_cache", "pytest.raises", "cache_tiles_strategy._last_tile_index"] | 0 | [] | The function (test_last_tile_index_error) defined within the public class called public.The function start at line 304 and ends at 312. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 4.0 functions, and It has 4.0... |
CAREamics_careamics | public | public | 0 | 0 | test_get_image_tiles | def test_get_image_tiles(cache_tiles_strategy):"""Test `CacheTiles._get_image_tiles` returns the tiles of a single image."""# all tiles of 2 samples with 9 tilestiles, tile_infos = create_tiles(n_samples=2)# include first tile from next samplepatch_tile_cache(cache_tiles_strategy, tiles[:10], tile_infos[:10])image_tile... | 2 | 7 | 1 | 81 | 0 | 315 | 326 | 315 | cache_tiles_strategy | [] | None | {"Assign": 2, "Expr": 2} | 7 | 12 | 7 | ["create_tiles", "patch_tile_cache", "cache_tiles_strategy._get_image_tiles", "len", "all", "np.array_equal", "range"] | 0 | [] | The function (test_get_image_tiles) defined within the public class called public.The function start at line 315 and ends at 326. It contains 7 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 7.0 functions, and It has 7.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_get_sample_file_path_tiled_ds | def test_get_sample_file_path_tiled_ds():# Create DS with mock InferenceConfigsrc_files = [f"{i}.ext" for i in range(2)]pred_config = Mock(spec=InferenceConfig)# attrs used in DS initializationpred_config.axes = Mock()pred_config.tile_size = Mock()pred_config.tile_overlap = Mock()pred_config.image_means = [Mock()]pred_... | 3 | 12 | 0 | 97 | 4 | 12 | 27 | 12 | ['file_path', 'src_files', 'ds', 'pred_config'] | None | {"Assign": 9, "For": 1} | 10 | 16 | 10 | ["range", "Mock", "Mock", "Mock", "Mock", "Mock", "Mock", "IterableTiledPredDataset", "range", "get_sample_file_path"] | 0 | [] | The function (test_get_sample_file_path_tiled_ds) defined within the public class called public.The function start at line 12 and ends at 27. It contains 12 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 10.0 functions, and It... | |
CAREamics_careamics | public | public | 0 | 0 | test_get_sample_file_path_untiled_ds | def test_get_sample_file_path_untiled_ds():# Create DS with mock InferenceConfigsrc_files = [f"{i}.ext" for i in range(2)]pred_config = Mock(spec=InferenceConfig)# attrs used in DS initializationpred_config.axes = Mock()pred_config.image_means = [Mock()]pred_config.image_stds = [Mock()]ds = IterablePredDataset(pred_con... | 3 | 10 | 0 | 83 | 4 | 30 | 43 | 30 | ['file_path', 'src_files', 'ds', 'pred_config'] | None | {"Assign": 7, "For": 1} | 8 | 14 | 8 | ["range", "Mock", "Mock", "Mock", "Mock", "IterablePredDataset", "range", "get_sample_file_path"] | 0 | [] | The function (test_get_sample_file_path_untiled_ds) defined within the public class called public.The function start at line 30 and ends at 43. It contains 10 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 8.0 functions, and I... | |
CAREamics_careamics | public | public | 0 | 0 | test_create_write_file_path | def test_create_write_file_path():dirpath = Path("output_directory")file_path = Path("input_directory/file_name.in_ext")write_extension = ".out_ext"write_file_path = create_write_file_path(dirpath=dirpath, file_path=file_path, write_extension=write_extension)assert write_file_path == Path("output_directory/file_name.ou... | 1 | 8 | 0 | 42 | 4 | 46 | 54 | 46 | ['file_path', 'write_extension', 'dirpath', 'write_file_path'] | None | {"Assign": 4} | 4 | 9 | 4 | ["Path", "Path", "create_write_file_path", "Path"] | 0 | [] | The function (test_create_write_file_path) defined within the public class called public.The function start at line 46 and ends at 54. 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 4.0 functions, and It has 4.0 ... | |
CAREamics_careamics | public | public | 0 | 0 | write_strategy | def write_strategy():"""Mock `WriteFunc`."""return Mock(spec=WriteStrategy) | 1 | 2 | 0 | 12 | 0 | 32 | 34 | 32 | [] | Returns | {"Expr": 1, "Return": 1} | 1 | 3 | 1 | ["Mock"] | 0 | [] | The function (write_strategy) defined within the public class called public.The function start at line 32 and ends at 34. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declare 1.0 function, and It has 1.0 function ca... | |
CAREamics_careamics | public | public | 0 | 0 | dirpath | def dirpath(tmp_path: Path):"""Directory path."""return tmp_path / "predictions" | 1 | 2 | 1 | 12 | 0 | 38 | 40 | 38 | tmp_path | [] | Returns | {"Expr": 1, "Return": 1} | 0 | 3 | 0 | [] | 0 | [] | The function (dirpath) defined within the public class called public.The function start at line 38 and ends at 40. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value.. |
CAREamics_careamics | public | public | 0 | 0 | prediction_writer_callback | def prediction_writer_callback(write_strategy: WriteStrategy, dirpath: Union[Path, str]):"""Initialized `PredictionWriterCallback`."""return PredictionWriterCallback(write_strategy=write_strategy, dirpath=dirpath) | 1 | 4 | 2 | 28 | 0 | 44 | 48 | 44 | write_strategy,dirpath | [] | Returns | {"Expr": 1, "Return": 1} | 1 | 5 | 1 | ["PredictionWriterCallback"] | 0 | [] | The function (prediction_writer_callback) defined within the public class called public.The function start at line 44 and ends at 48. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [44.0], and this function return a value. It declare 1.0 function, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_smoke_n2v_tiled_tiff | def test_smoke_n2v_tiled_tiff(tmp_path, minimum_n2v_configuration):rng = np.random.default_rng(42)# training datatrain_array = rng.integers(0, 255, (32, 32)).astype(np.float32)val_array = rng.integers(0, 255, (32, 32)).astype(np.float32)# write train array to tifftrain_dir = tmp_path / "train"train_dir.mkdir()file_name... | 1 | 52 | 2 | 358 | 16 | 55 | 130 | 55 | tmp_path,minimum_n2v_configuration | ['predict_data', 'train_file', 'predicted', 'trainer', 'file_name', 'model', 'train_dir', 'train_array', 'cfg', 'write_strategy', 'rng', 'predicted_images', 'dirpath', 'data', 'save_data', 'val_array'] | None | {"Assign": 17, "Expr": 4} | 22 | 76 | 22 | ["np.random.default_rng", "astype", "rng.integers", "astype", "rng.integers", "train_dir.mkdir", "tifffile.imwrite", "Configuration", "create_careamics_module", "create_train_datamodule", "create_write_strategy", "Trainer", "ModelCheckpoint", "PredictionWriterCallback", "trainer.fit", "data.get_data_statistics", "creat... | 0 | [] | The function (test_smoke_n2v_tiled_tiff) defined within the public class called public.The function start at line 55 and ends at 130. It contains 52 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 declares 22.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_smoke_n2v_untiled_tiff | def test_smoke_n2v_untiled_tiff(tmp_path, minimum_n2v_configuration):rng = np.random.default_rng(42)# training datatrain_array = rng.integers(0, 255, (32, 32)).astype(np.float32)val_array = rng.integers(0, 255, (32, 32)).astype(np.float32)# write train array to tifftrain_dir = tmp_path / "train"train_dir.mkdir()file_na... | 1 | 50 | 2 | 342 | 16 | 134 | 207 | 134 | tmp_path,minimum_n2v_configuration | ['predict_data', 'train_file', 'predicted', 'trainer', 'file_name', 'model', 'train_dir', 'train_array', 'cfg', 'write_strategy', 'rng', 'predicted_images', 'dirpath', 'data', 'save_data', 'val_array'] | None | {"Assign": 17, "Expr": 4} | 22 | 74 | 22 | ["np.random.default_rng", "astype", "rng.integers", "astype", "rng.integers", "train_dir.mkdir", "tifffile.imwrite", "Configuration", "create_careamics_module", "create_train_datamodule", "create_write_strategy", "Trainer", "ModelCheckpoint", "PredictionWriterCallback", "trainer.fit", "data.get_data_statistics", "creat... | 0 | [] | The function (test_smoke_n2v_untiled_tiff) defined within the public class called public.The function start at line 134 and ends at 207. It contains 50 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [134.0] and does not return any value. It declares 22.0 functions, and It ... |
CAREamics_careamics | public | public | 0 | 0 | test_initialization | def test_initialization(prediction_writer_callback, write_strategy, dirpath):"""Test `PredictionWriterCallback` initializes as expected."""assert prediction_writer_callback.writing_predictions is Trueassert prediction_writer_callback.write_strategy is write_strategyassert prediction_writer_callback.dirpath == Path(dirp... | 1 | 4 | 3 | 35 | 0 | 210 | 214 | 210 | prediction_writer_callback,write_strategy,dirpath | [] | None | {"Expr": 1} | 2 | 5 | 2 | ["resolve", "Path"] | 0 | [] | The function (test_initialization) defined within the public class called public.The function start at line 210 and ends at 214. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [210.0] and does not return any value. It declares 2.0 functions, and It has 2.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_init_dirpath_absolute_path | def test_init_dirpath_absolute_path(prediction_writer_callback):"""Test initialization of dirpath with absolute path."""absolute_path = Path("/absolute/path").absolute()prediction_writer_callback._init_dirpath(absolute_path)assert prediction_writer_callback.dirpath == absolute_path | 1 | 4 | 1 | 28 | 1 | 217 | 221 | 217 | prediction_writer_callback | ['absolute_path'] | None | {"Assign": 1, "Expr": 2} | 3 | 5 | 3 | ["absolute", "Path", "prediction_writer_callback._init_dirpath"] | 0 | [] | The function (test_init_dirpath_absolute_path) defined within the public class called public.The function start at line 217 and ends at 221. It contains 4 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_init_dirpath_relative_path | def test_init_dirpath_relative_path(prediction_writer_callback):"""Test initialization of dirpath with relatice path."""relative_path = "relative/path"# patch pathlib.Path.cwd to returnmock_cwd = Path("/current/working/dir")with patch("pathlib.Path.cwd", return_value=mock_cwd):prediction_writer_callback._init_dirpath(r... | 1 | 6 | 1 | 39 | 2 | 224 | 231 | 224 | prediction_writer_callback | ['mock_cwd', 'relative_path'] | None | {"Assign": 2, "Expr": 2, "With": 1} | 3 | 8 | 3 | ["Path", "patch", "prediction_writer_callback._init_dirpath"] | 0 | [] | The function (test_init_dirpath_relative_path) defined within the public class called public.The function start at line 224 and ends at 231. 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 ha... |
CAREamics_careamics | public | public | 0 | 0 | test_setup_prediction_directory_creation | def test_setup_prediction_directory_creation(prediction_writer_callback, dirpath):"""Test prediction directory is created when `setup` is called at `stage="predict"`."""trainer = Mock(spec=Trainer)pl_module = Mock(spec=LightningModule)stage = "predict"prediction_writer_callback.setup(trainer=trainer, pl_module=pl_modul... | 1 | 6 | 2 | 52 | 3 | 234 | 244 | 234 | prediction_writer_callback,dirpath | ['trainer', 'pl_module', 'stage'] | None | {"Assign": 3, "Expr": 2} | 4 | 11 | 4 | ["Mock", "Mock", "prediction_writer_callback.setup", "os.path.isdir"] | 0 | [] | The function (test_setup_prediction_directory_creation) defined within the public class called public.The function start at line 234 and ends at 244. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [234.0] and does not return any value. It declares 4.0 function... |
CAREamics_careamics | public | public | 0 | 0 | test_write_on_batch_end | def test_write_on_batch_end(prediction_writer_callback):"""Test `PredictionWriterCallback.write_on_batch_end`.Check `prediction_writer_callback.write_strategy.write_batch` is called asexpected."""# mock write_on_batch_end inputs.trainer = Mock(spec=Trainer)pl_module = Mock(spec=LightningModule)prediction = Mock()batch_... | 1 | 24 | 1 | 138 | 8 | 247 | 282 | 247 | prediction_writer_callback | ['pl_module', 'mock_dataset', 'batch', 'trainer', 'prediction', 'dataloader_idx', 'batch_idx', 'batch_indices'] | None | {"Assign": 10, "Expr": 3} | 8 | 36 | 8 | ["Mock", "Mock", "Mock", "Mock", "Mock", "Mock", "prediction_writer_callback.write_on_batch_end", "prediction_writer_callback.write_strategy.write_batch.assert_called_once_with"] | 0 | [] | The function (test_write_on_batch_end) defined within the public class called public.The function start at line 247 and ends at 282. It contains 24 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 f... |
CAREamics_careamics | public | public | 0 | 0 | test_write_on_batch_end_writing_predictions_off | def test_write_on_batch_end_writing_predictions_off(prediction_writer_callback):"""Test that `write_batch` acts as expected when writing predictions is set to off.Ensure `PredictionWriterCallback.write_strategy.write_batch` is not called when`PredictionWriterCallback.writing_predictions=False`."""prediction_writer_call... | 1 | 16 | 1 | 109 | 8 | 285 | 310 | 285 | prediction_writer_callback | ['pl_module', 'mock_dataset', 'batch', 'trainer', 'prediction', 'dataloader_idx', 'batch_idx', 'batch_indices'] | None | {"Assign": 11, "Expr": 3} | 8 | 26 | 8 | ["Mock", "Mock", "Mock", "Mock", "Mock", "Mock", "prediction_writer_callback.write_on_batch_end", "prediction_writer_callback.write_strategy.write_batch.assert_not_called"] | 0 | [] | The function (test_write_on_batch_end_writing_predictions_off) defined within the public class called public.The function start at line 285 and ends at 310. 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 8.0 func... |
CAREamics_careamics | public | public | 0 | 0 | test_from_write_func_params | def test_from_write_func_params(write_strategy, dirpath):"""Test `from_write_func_param` classmethod initializes `PredictWriterCallback`."""write_type = SupportedData.TIFFtiled = Truewrite_func = Nonewrite_extension = Nonewrite_func_kwargs = None# mock create_write_strategy as it is already tested individually.with pat... | 1 | 29 | 2 | 122 | 7 | 313 | 347 | 313 | write_strategy,dirpath | ['callback', 'tiled', 'write_extension', 'write_strategy', 'write_type', 'write_func', 'write_func_kwargs'] | None | {"Assign": 8, "Expr": 2, "With": 1} | 6 | 35 | 6 | ["patch", "Mock", "PredictionWriterCallback.from_write_func_params", "mock_create_write_strategy.assert_called_once_with", "resolve", "Path"] | 0 | [] | The function (test_from_write_func_params) defined within the public class called public.The function start at line 313 and ends at 347. It contains 29 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [313.0] and does not return any value. It declares 6.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | write_func | def write_func():"""Mock `WriteFunc`."""return Mock(spec=WriteFunc) | 1 | 2 | 0 | 12 | 0 | 19 | 21 | 19 | [] | Returns | {"Expr": 1, "Return": 1} | 1 | 3 | 1 | ["Mock"] | 1 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.careamist_py.CAREamist.predict_to_disk"] | The function (write_func) defined within the public class called public.The function start at line 19 and ends at 21. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declare 1.0 function, It has 1.0 function called insi... | |
CAREamics_careamics | public | public | 0 | 0 | write_image_strategy | def write_image_strategy(write_func) -> WriteImage:"""Initialized `CacheTiles` class.Parameters----------write_func : WriteFuncWrite function. (Comes from fixture).Returns-------CacheTilesInitialized `CacheTiles` class."""write_extension = ".ext"write_func_kwargs = {}return WriteImage(write_func=write_func,write_extens... | 1 | 8 | 1 | 31 | 2 | 25 | 45 | 25 | write_func | ['write_extension', 'write_func_kwargs'] | WriteImage | {"Assign": 2, "Expr": 1, "Return": 1} | 1 | 21 | 1 | ["WriteImage"] | 0 | [] | The function (write_image_strategy) defined within the public class called public.The function start at line 25 and ends at 45. 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 declare 1.0 function, and It has 1.0 function ... |
CAREamics_careamics | public | public | 0 | 0 | test_cache_tiles_init | def test_cache_tiles_init(write_func, write_image_strategy):"""Test `WriteImage` initializes as expected."""assert write_image_strategy.write_func is write_funcassert write_image_strategy.write_extension == ".ext"assert write_image_strategy.write_func_kwargs == {} | 1 | 4 | 2 | 27 | 0 | 48 | 54 | 48 | write_func,write_image_strategy | [] | None | {"Expr": 1} | 0 | 7 | 0 | [] | 0 | [] | The function (test_cache_tiles_init) defined within the public class called public.The function start at line 48 and ends at 54. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [48.0] and does not return any value.. |
CAREamics_careamics | public | public | 0 | 0 | test_write_batch | def test_write_batch(write_image_strategy, ordered_array):n_batches = 1prediction = ordered_array((n_batches, 1, 8, 8))batch = predictionbatch_indices = np.arange(n_batches)batch_idx = 0# mock trainer and datasetstrainer = Mock(spec=Trainer)# mock trainer and datasetstrainer = Mock(spec=Trainer)mock_dataset = Mock(spec... | 1 | 49 | 2 | 255 | 14 | 57 | 126 | 57 | write_image_strategy,ordered_array | ['mock_create_write_file_path', 'mock_dataset', 'n_batches', 'batch', 'mock_dl', 'in_file_path', 'out_file_path', 'trainer', 'prediction', 'mock_get_sample_file_path', 'dataloader_idx', 'dirpath', 'batch_idx', 'batch_indices'] | None | {"Assign": 20, "Expr": 3, "With": 1} | 14 | 70 | 14 | ["ordered_array", "np.arange", "Mock", "Mock", "Mock", "Mock", "patch.multiple", "Path", "Path", "write_image_strategy.write_batch", "Mock", "mock_create_write_file_path.assert_called_with", "write_image_strategy.write_func.assert_called_once", "np.array_equal"] | 0 | [] | The function (test_write_batch) defined within the public class called public.The function start at line 57 and ends at 126. It contains 49 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [57.0] and does not return any value. It declares 14.0 functions, and It has 14.0 func... |
CAREamics_careamics | public | public | 0 | 0 | save_numpy | def save_numpy(file_path: Path, img: NDArray, *args, **kwargs) -> None:"""Example custom save function."""np.save(file_path, img, *args, **kwargs) | 1 | 2 | 4 | 34 | 0 | 19 | 21 | 19 | file_path,img,*args,**kwargs | [] | None | {"Expr": 2} | 1 | 3 | 1 | ["np.save"] | 0 | [] | The function (save_numpy) defined within the public class called public.The function start at line 19 and ends at 21. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [19.0] and does not return any value. It declare 1.0 function, and It has 1.0 function called ... |
CAREamics_careamics | public | public | 0 | 0 | test_create_write_strategy_tiff_tiled | def test_create_write_strategy_tiff_tiled():"""Test write strategy creation for tiled tiff."""write_strategy = create_write_strategy(write_type="tiff", tiled=True)assert isinstance(write_strategy, CacheTiles)assert write_strategy.write_func is write_tiffassert write_strategy.write_extension == ".tiff"assert write_strat... | 1 | 6 | 0 | 43 | 1 | 24 | 31 | 24 | ['write_strategy'] | None | {"Assign": 1, "Expr": 1} | 2 | 8 | 2 | ["create_write_strategy", "isinstance"] | 0 | [] | The function (test_create_write_strategy_tiff_tiled) defined within the public class called public.The function start at line 24 and ends at 31. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and I... | |
CAREamics_careamics | public | public | 0 | 0 | test_create_write_strategy_tiff_untiled | def test_create_write_strategy_tiff_untiled():"""Test write strategy creation for untiled tiff."""write_strategy = create_write_strategy(write_type="tiff", tiled=False)assert isinstance(write_strategy, WriteImage)assert write_strategy.write_func is write_tiffassert write_strategy.write_extension == ".tiff"assert write_... | 1 | 6 | 0 | 43 | 1 | 34 | 41 | 34 | ['write_strategy'] | None | {"Assign": 1, "Expr": 1} | 2 | 8 | 2 | ["create_write_strategy", "isinstance"] | 0 | [] | The function (test_create_write_strategy_tiff_untiled) defined within the public class called public.The function start at line 34 and ends at 41. It contains 6 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.