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_create_write_strategy_custom_tiled | def test_create_write_strategy_custom_tiled():"""Test write strategy creation for tiled custom type."""write_strategy = create_write_strategy(write_type="custom", tiled=True, write_func=save_numpy, write_extension=".npy")assert isinstance(write_strategy, CacheTiles)assert write_strategy.write_func is save_numpyassert w... | 1 | 8 | 0 | 51 | 1 | 44 | 52 | 44 | ['write_strategy'] | None | {"Assign": 1, "Expr": 1} | 2 | 9 | 2 | ["create_write_strategy", "isinstance"] | 0 | [] | The function (test_create_write_strategy_custom_tiled) defined within the public class called public.The function start at line 44 and ends at 52. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, and ... | |
CAREamics_careamics | public | public | 0 | 0 | test_create_write_strategy_custom_untiled | def test_create_write_strategy_custom_untiled():"""Test write strategy creation for untiled custom type."""write_strategy = create_write_strategy(write_type="custom", tiled=False, write_func=save_numpy, write_extension=".npy")assert isinstance(write_strategy, WriteImage)assert write_strategy.write_func is save_numpyass... | 1 | 8 | 0 | 51 | 1 | 55 | 63 | 55 | ['write_strategy'] | None | {"Assign": 1, "Expr": 1} | 2 | 9 | 2 | ["create_write_strategy", "isinstance"] | 0 | [] | The function (test_create_write_strategy_custom_untiled) defined within the public class called public.The function start at line 55 and ends at 63. It contains 8 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 2.0 functions, an... | |
CAREamics_careamics | public | public | 0 | 0 | test_select_write_func_tiff | def test_select_write_func_tiff():"""Test tiff write function is selected correctly."""write_func = select_write_func(write_type="tiff", write_func=None)assert write_func is write_tiff | 1 | 3 | 0 | 21 | 1 | 66 | 69 | 66 | ['write_func'] | None | {"Assign": 1, "Expr": 1} | 1 | 4 | 1 | ["select_write_func"] | 0 | [] | The function (test_select_write_func_tiff) defined within the public class called public.The function start at line 66 and ends at 69. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 fu... | |
CAREamics_careamics | public | public | 0 | 0 | test_select_write_func_custom | def test_select_write_func_custom(write_func):"""Test custom write func is returned or raises error if None."""if write_func is None:with pytest.raises(ValueError):write_func = select_write_func("custom", write_func)returnwrite_func = select_write_func("custom", write_func)assert write_func is save_numpy | 2 | 7 | 1 | 40 | 1 | 73 | 80 | 73 | write_func | ['write_func'] | None | {"Assign": 2, "Expr": 1, "If": 1, "Return": 1, "With": 1} | 4 | 8 | 4 | ["pytest.raises", "select_write_func", "select_write_func", "pytest.mark.parametrize"] | 0 | [] | The function (test_select_write_func_custom) defined within the public class called public.The function start at line 73 and ends at 80. 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 4.0 functions, and It has 4.... |
CAREamics_careamics | public | public | 0 | 0 | test_select_write_extension_tiff | def test_select_write_extension_tiff():"""Test tiff extension is selected correctly."""write_extension = select_write_extension(write_type="tiff", write_extension=None)assert write_extension == ".tiff" | 1 | 3 | 0 | 21 | 1 | 83 | 86 | 83 | ['write_extension'] | None | {"Assign": 1, "Expr": 1} | 1 | 4 | 1 | ["select_write_extension"] | 0 | [] | The function (test_select_write_extension_tiff) defined within the public class called public.The function start at line 83 and ends at 86. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1... | |
CAREamics_careamics | public | public | 0 | 0 | test_select_write_extension_custom | def test_select_write_extension_custom(write_extension):"""Test custom extension is returned or raises if None."""if write_extension is None:with pytest.raises(ValueError):write_extension = select_write_extension("custom", write_extension)returnwrite_extension = select_write_extension("custom", write_extension)assert w... | 2 | 7 | 1 | 40 | 1 | 90 | 97 | 90 | write_extension | ['write_extension'] | None | {"Assign": 2, "Expr": 1, "If": 1, "Return": 1, "With": 1} | 4 | 8 | 4 | ["pytest.raises", "select_write_extension", "select_write_extension", "pytest.mark.parametrize"] | 0 | [] | The function (test_select_write_extension_custom) defined within the public class called public.The function start at line 90 and ends at 97. 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 4.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | test_gaussian_likelihood | def test_gaussian_likelihood(batch_size: int,target_ch: int,predict_logvar: Union[str, None],logvar_lowerbound: Union[float, None],) -> None:config = GaussianLikelihoodConfig(predict_logvar=predict_logvar, logvar_lowerbound=logvar_lowerbound)likelihood = likelihood_factory(config)img_size = 64inp_ch = target_ch * (1 + ... | 2 | 23 | 4 | 171 | 7 | 26 | 50 | 26 | batch_size,target_ch,predict_logvar,logvar_lowerbound | ['likelihood', 'config', 'target', 'inp_ch', 'img_size', 'reconstruction', 'exp_out_shape'] | None | {"Assign": 8, "If": 1} | 11 | 25 | 11 | ["GaussianLikelihoodConfig", "likelihood_factory", "int", "torch.rand", "torch.rand", "likelihood", "mean", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_gaussian_likelihood) defined within the public class called public.The function start at line 26 and ends at 50. It contains 23 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [26.0] and does not return any value. It declares 11.0 functions, and It has 11... |
CAREamics_careamics | public | public | 0 | 0 | test_noise_model_likelihood | def test_noise_model_likelihood(tmp_path: Path,batch_size: int,img_size: int,target_ch: int,create_dummy_noise_model,) -> None:# Instantiate the noise modelnp.savez(tmp_path / "dummy_noise_model.npz", **create_dummy_noise_model)gmm = GaussianMixtureNMConfig(model_type="GaussianMixtureNoiseModel",path=tmp_path / "dummy_... | 1 | 27 | 5 | 199 | 11 | 56 | 88 | 56 | tmp_path,batch_size,img_size,target_ch,create_dummy_noise_model | ['likelihood', 'target', 'config', 'reconstruction', 'data_mean', 'gmm', 'noise_model_config', 'nm', 'exp_out_shape', 'data_std', 'inp_shape'] | None | {"Assign": 11, "Expr": 2} | 15 | 33 | 15 | ["np.savez", "GaussianMixtureNMConfig", "MultiChannelNMConfig", "noise_model_factory", "torch.rand", "target.mean", "target.std", "NMLikelihoodConfig", "likelihood_factory", "likelihood.set_data_stats", "likelihood", "mean", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_noise_model_likelihood) defined within the public class called public.The function start at line 56 and ends at 88. It contains 27 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [56.0] and does not return any value. It declares 15.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:"""Create a dummy noise model and save it in a `.npz` file."""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": ... | 1 | 13 | 3 | 88 | 2 | 44 | 57 | 44 | tmp_path,n_gaussians,n_coeffs | ['weights', 'nm_dict'] | None | {"Assign": 2, "Expr": 2} | 4 | 14 | 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 44 and ends at 57. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [44.0] and does not return any value. It declares 4.0 functions, It has 4.0 func... |
CAREamics_careamics | public | public | 0 | 0 | init_noise_model | def init_noise_model(tmp_path: Path,target_ch: int,n_gaussians: int = 3,n_coeffs: int = 3,) -> MultiChannelNoiseModel:"""Instantiate a dummy noise model."""create_dummy_noise_model(tmp_path, n_gaussians, n_coeffs)gmm = GaussianMixtureNMConfig(model_type="GaussianMixtureNoiseModel",path=tmp_path / "dummy_noise_model.npz... | 1 | 13 | 4 | 67 | 2 | 60 | 74 | 60 | tmp_path,target_ch,n_gaussians,n_coeffs | ['gmm', 'noise_model_config'] | MultiChannelNoiseModel | {"Assign": 2, "Expr": 2, "Return": 1} | 4 | 15 | 4 | ["create_dummy_noise_model", "GaussianMixtureNMConfig", "MultiChannelNMConfig", "noise_model_factory"] | 4 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.losses.test_lvae_losses_py.test_denoisplit_loss", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.losses.test_lvae_losses_py.test_denoisplit_muspli... | The function (init_noise_model) defined within the public class called public.The function start at line 60 and ends at 74. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [60.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions ca... |
CAREamics_careamics | public | public | 0 | 0 | test_lvae_loss_factory | def test_lvae_loss_factory(loss_type: Union[SupportedLoss, str], exp_loss_func: Callable, exp_error: Callable):with exp_error:loss_func = loss_factory(loss_type)assert loss_func is not Noneassert callable(loss_func)assert loss_func == exp_loss_func | 1 | 8 | 3 | 43 | 1 | 89 | 96 | 89 | loss_type,exp_loss_func,exp_error | ['loss_func'] | None | {"Assign": 1, "With": 1} | 10 | 8 | 10 | ["loss_factory", "callable", "pytest.mark.parametrize", "does_not_raise", "does_not_raise", "does_not_raise", "does_not_raise", "does_not_raise", "does_not_raise", "pytest.raises"] | 0 | [] | The function (test_lvae_loss_factory) defined within the public class called public.The function start at line 89 and ends at 96. It contains 8 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 10.0 functions, and It has 10.0 ... |
CAREamics_careamics | public | public | 0 | 0 | test_reconstruction_loss | def test_reconstruction_loss(tmp_path: Path,batch_size: int,target_ch: int,predict_logvar: str,likelihood_type: str,):# create test dataimg_size = 64inp_ch = target_ch * (1 + int(predict_logvar is not None))reconstruction = torch.rand((batch_size, inp_ch, img_size, img_size))target = torch.rand((batch_size, target_ch, ... | 2 | 26 | 5 | 194 | 10 | 116 | 148 | 116 | tmp_path,batch_size,target_ch,predict_logvar,likelihood_type | ['likelihood', 'target', 'config', 'rec_loss', 'inp_ch', 'img_size', 'reconstruction', 'data_mean', 'nm', 'data_std'] | None | {"Assign": 13, "Expr": 1, "If": 1} | 13 | 33 | 13 | ["int", "torch.rand", "torch.rand", "init_noise_model", "target.mean", "target.std", "NMLikelihoodConfig", "likelihood_factory", "likelihood.set_data_stats", "GaussianLikelihoodConfig", "likelihood_factory", "get_reconstruction_loss", "pytest.mark.parametrize"] | 0 | [] | The function (test_reconstruction_loss) defined within the public class called public.The function start at line 116 and ends at 148. It contains 26 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [116.0] and does not return any value. It declares 13.0 functions, and It has... |
CAREamics_careamics | public | public | 0 | 0 | test_reconstruction_loss_musplit_denoisplit | def test_reconstruction_loss_musplit_denoisplit(tmp_path: Path,batch_size: int,target_ch: int,predict_logvar: str,nm_weight: float,):# create test dataimg_size = 64inp_ch = target_ch * (1 + int(predict_logvar is not None))reconstruction = torch.rand((batch_size, inp_ch, img_size, img_size))target = torch.rand((batch_si... | 1 | 29 | 5 | 206 | 12 | 155 | 190 | 155 | tmp_path,batch_size,target_ch,predict_logvar,nm_weight | ['target', 'gaussian_likelihood', 'rec_loss', 'inp_ch', 'img_size', 'reconstruction', 'data_mean', 'nm_likelihood', 'nm', 'data_std', 'gaussian_config', 'nm_config'] | None | {"Assign": 12, "Expr": 1} | 17 | 36 | 17 | ["int", "torch.rand", "torch.rand", "init_noise_model", "target.mean", "target.std", "NMLikelihoodConfig", "likelihood_factory", "nm_likelihood.set_data_stats", "GaussianLikelihoodConfig", "likelihood_factory", "_reconstruction_loss_musplit_denoisplit", "isinstance", "pytest.mark.parametrize", "pytest.mark.parametrize"... | 0 | [] | The function (test_reconstruction_loss_musplit_denoisplit) defined within the public class called public.The function start at line 155 and ends at 190. It contains 29 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [155.0] and does not return any value. It declares 17.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_KL_divergence_loss | def test_KL_divergence_loss(batch_size: int,n_layers: int,enable_LC: bool,kl_type: Literal["kl", "kl_restricted"],rescaling: Literal["latent_dim", "image_dim"],aggregation: Literal["mean", "sum"],free_bits_coeff: float,):# create test dataimg_size = 64if enable_LC:z = [torch.ones(batch_size, 128, img_size, img_size) fo... | 6 | 32 | 7 | 211 | 6 | 200 | 234 | 200 | batch_size,n_layers,enable_LC,kl_type,rescaling,aggregation,free_bits_coeff | ['sizes', 'img_shape', 'kl_loss', 'td_data', 'img_size', 'z'] | None | {"Assign": 8, "If": 1} | 19 | 35 | 19 | ["torch.ones", "range", "range", "torch.ones", "torch.ones", "range", "torch.ones", "range", "get_kl_divergence_loss", "isinstance", "isinstance", "kl_loss.item", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametri... | 0 | [] | The function (test_KL_divergence_loss) defined within the public class called public.The function start at line 200 and ends at 234. It contains 32 lines of code and it has a cyclomatic complexity of 6. It takes 7 parameters, represented as [200.0] and does not return any value. It declares 19.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_musplit_loss | def test_musplit_loss(batch_size: int,target_ch: int,predict_logvar: str,n_layers: int,enable_LC: bool,kl_type: Literal["kl", "kl_restricted"],):# create test dataimg_size = 64inp_ch = target_ch * (1 + int(predict_logvar is not None))reconstruction = torch.rand((batch_size, inp_ch, img_size, img_size))target = torch.ra... | 6 | 38 | 6 | 271 | 12 | 243 | 288 | 243 | batch_size,target_ch,predict_logvar,n_layers,enable_LC,kl_type | ['likelihood', 'target', 'config', 'sizes', 'output', 'inp_ch', 'td_data', 'img_size', 'reconstruction', 'z', 'loss_parameters', 'kl_params'] | None | {"Assign": 14, "If": 1} | 23 | 46 | 23 | ["int", "torch.rand", "torch.rand", "torch.rand", "range", "range", "torch.rand", "torch.rand", "range", "torch.rand", "range", "GaussianLikelihoodConfig", "likelihood_factory", "KLLossConfig", "LVAELossConfig", "musplit_loss", "isinstance", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize... | 0 | [] | The function (test_musplit_loss) defined within the public class called public.The function start at line 243 and ends at 288. It contains 38 lines of code and it has a cyclomatic complexity of 6. It takes 6 parameters, represented as [243.0] and does not return any value. It declares 23.0 functions, and It has 23.0 f... |
CAREamics_careamics | public | public | 0 | 0 | test_denoisplit_loss | def test_denoisplit_loss(tmp_path: Path,batch_size: int,target_ch: int,n_layers: int,kl_type: Literal["kl", "kl_restricted"],):# create test dataimg_size = 64reconstruction = torch.rand((batch_size, target_ch, img_size, img_size))target = torch.rand((batch_size, target_ch, img_size, img_size))td_data = {"z": [torch.ran... | 4 | 34 | 5 | 268 | 12 | 295 | 336 | 295 | tmp_path,batch_size,target_ch,n_layers,kl_type | ['likelihood', 'target', 'output', 'td_data', 'img_size', 'reconstruction', 'data_mean', 'nm', 'data_std', 'loss_parameters', 'nm_config', 'kl_params'] | None | {"Assign": 12, "Expr": 1} | 22 | 42 | 22 | ["torch.rand", "torch.rand", "torch.rand", "range", "torch.rand", "range", "torch.rand", "range", "init_noise_model", "target.mean", "target.std", "NMLikelihoodConfig", "likelihood_factory", "likelihood.set_data_stats", "KLLossConfig", "LVAELossConfig", "denoisplit_loss", "isinstance", "pytest.mark.parametrize", "pytes... | 0 | [] | The function (test_denoisplit_loss) defined within the public class called public.The function start at line 295 and ends at 336. It contains 34 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [295.0] and does not return any value. It declares 22.0 functions, and It has 22.... |
CAREamics_careamics | public | public | 0 | 0 | test_denoisplit_musplit_loss | def test_denoisplit_musplit_loss(tmp_path: Path,batch_size: int,target_ch: int,predict_logvar: str,n_layers: int,enable_LC: bool,kl_type: Literal["kl", "kl_restricted"],):# create test dataimg_size = 64inp_ch = target_ch * (1 + int(predict_logvar is not None))reconstruction = torch.rand((batch_size, inp_ch, img_size, i... | 6 | 48 | 7 | 350 | 17 | 345 | 400 | 345 | tmp_path,batch_size,target_ch,predict_logvar,n_layers,enable_LC,kl_type | ['target', 'gaussian_likelihood', 'sizes', 'output', 'inp_ch', 'td_data', 'img_size', 'reconstruction', 'data_mean', 'loss_parameters', 'nm_likelihood', 'nm', 'data_std', 'z', 'gaussian_config', 'nm_config', 'kl_params'] | None | {"Assign": 19, "Expr": 1, "If": 1} | 29 | 56 | 29 | ["int", "torch.rand", "torch.rand", "torch.rand", "range", "range", "torch.rand", "torch.rand", "range", "torch.rand", "range", "init_noise_model", "target.mean", "target.std", "NMLikelihoodConfig", "likelihood_factory", "nm_likelihood.set_data_stats", "GaussianLikelihoodConfig", "likelihood_factory", "KLLossConfig", "... | 0 | [] | The function (test_denoisplit_musplit_loss) defined within the public class called public.The function start at line 345 and ends at 400. It contains 48 lines of code and it has a cyclomatic complexity of 6. It takes 7 parameters, represented as [345.0] and does not return any value. It declares 29.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_state_dict_io | def test_state_dict_io(tmp_path, ordered_array, pre_trained):"""Test exporting and loading a state dict."""# training datatrain_array = ordered_array((32, 32))path = tmp_path / "model.pth"# instantiate CAREamistcareamist = CAREamist(source=pre_trained, work_dir=tmp_path)# predict (no tiling and no tta)predicted_output ... | 1 | 11 | 3 | 105 | 6 | 13 | 35 | 13 | tmp_path,ordered_array,pre_trained | ['predicted', 'train_array', 'careamist', 'path', 'predicted_loaded', 'predicted_output'] | None | {"Assign": 6, "Expr": 3} | 9 | 23 | 9 | ["ordered_array", "CAREamist", "careamist.predict", "np.concatenate", "_export_state_dict", "path.exists", "_load_state_dict", "careamist.predict", "all"] | 0 | [] | The function (test_state_dict_io) defined within the public class called public.The function start at line 13 and ends at 35. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [13.0] and does not return any value. It declares 9.0 functions, and It has 9.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_bmz_io | def test_bmz_io(tmp_path, ordered_array, pre_trained):"""Test exporting and loading to the BMZ."""# training datatrain_array = ordered_array((32, 32))# instantiate CAREamistcareamist = CAREamist(source=pre_trained, work_dir=tmp_path)# predict (no tiling and no tta)predicted_output = careamist.predict(train_array, tta_t... | 1 | 27 | 3 | 235 | 8 | 38 | 78 | 38 | tmp_path,ordered_array,pre_trained | ['torch_array', 'predicted', 'description', 'train_array', 'careamist', 'path', 'predicted_loaded', 'predicted_output'] | None | {"Assign": 10, "Expr": 2} | 19 | 41 | 19 | ["ordered_array", "CAREamist", "careamist.predict", "np.concatenate", "export_to_bmz", "path.exists", "load_description", "str", "load_pretrained", "Tensor", "squeeze", "numpy", "detach", "careamist.model.forward", "squeeze", "numpy", "detach", "model.forward", "all"] | 0 | [] | The function (test_bmz_io) defined within the public class called public.The function start at line 38 and ends at 78. It contains 27 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 19.0 functions, and It has 19.0 functions ... |
CAREamics_careamics | public | public | 0 | 0 | test_model_registry_unet | def test_model_registry_unet():"""Test that"""model_config = {"architecture": "UNet",}# instantiate modelmodel = model_factory(UNetModel(**model_config))assert isinstance(model, UNet) | 1 | 6 | 0 | 30 | 2 | 7 | 15 | 7 | ['model_config', 'model'] | None | {"Assign": 2, "Expr": 1} | 3 | 9 | 3 | ["model_factory", "UNetModel", "isinstance"] | 0 | [] | The function (test_model_registry_unet) defined within the public class called public.The function start at line 7 and ends at 15. 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 func... | |
CAREamics_careamics | public | public | 0 | 0 | test_unet_depth | def test_unet_depth(depth):"""Test that the UNet has the correct number of down and up convswith respect to the depth."""model = UNet(conv_dims=2, depth=depth)# check that encoder has the right number of down convscounter_down = 0for _, layer in model.encoder.encoder_blocks.named_children():if type(layer).__name__ == "... | 5 | 12 | 1 | 88 | 3 | 9 | 28 | 9 | depth | ['counter_down', 'counter_up', 'model'] | None | {"Assign": 3, "AugAssign": 2, "Expr": 1, "For": 2, "If": 2} | 6 | 20 | 6 | ["UNet", "model.encoder.encoder_blocks.named_children", "type", "model.decoder.decoder_blocks.named_children", "type", "pytest.mark.parametrize"] | 0 | [] | The function (test_unet_depth) defined within the public class called public.The function start at line 9 and ends at 28. It contains 12 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions ca... |
CAREamics_careamics | public | public | 0 | 0 | test_blurpool2d | def test_blurpool2d(input_shape):"""Test that the BlurPool2d layer works as expected."""layer = MaxBlurPool(dim=2, kernel_size=3)assert layer(torch.randn(input_shape)).shape == tuple([1, 1] + [i // 2 for i in input_shape[2:]]) | 1 | 5 | 1 | 43 | 1 | 44 | 49 | 44 | input_shape | ['layer'] | None | {"Assign": 1, "Expr": 1} | 5 | 6 | 5 | ["MaxBlurPool", "layer", "torch.randn", "tuple", "pytest.mark.parametrize"] | 0 | [] | The function (test_blurpool2d) defined within the public class called public.The function start at line 44 and ends at 49. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 functions ca... |
CAREamics_careamics | public | public | 0 | 0 | test_blurpool3d | def test_blurpool3d(input_shape):"""Test that the BlurPool3d layer works as expected."""layer = MaxBlurPool(dim=3, kernel_size=3)assert layer(torch.randn(input_shape)).shape == tuple([1, 1] + [i // 2 for i in input_shape[2:]]) | 1 | 5 | 1 | 43 | 1 | 65 | 70 | 65 | input_shape | ['layer'] | None | {"Assign": 1, "Expr": 1} | 5 | 6 | 5 | ["MaxBlurPool", "layer", "torch.randn", "tuple", "pytest.mark.parametrize"] | 0 | [] | The function (test_blurpool3d) defined within the public class called public.The function start at line 65 and ends at 70. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 5.0 functions, and It has 5.0 functions ca... |
CAREamics_careamics | public | public | 0 | 0 | test_independent_channels | def test_independent_channels(independent_channels):"""Test that with independent channels there is no connections between theparallel networks."""n_channels = 2input_shape = (1, n_channels, 8, 8)# input 1x1 = torch.randn(input_shape)# input 2: channel 1 same as input 1, channel 2 all zerosx2 = x1.clone()x2[:, 1] = 0mo... | 2 | 20 | 1 | 146 | 7 | 74 | 110 | 74 | independent_channels | ['y1', 'x1', 'input_shape', 'model', 'y2', 'x2', 'n_channels'] | None | {"Assign": 8, "Expr": 2, "If": 1} | 10 | 37 | 10 | ["torch.randn", "x1.clone", "UNet", "model.eval", "model", "model", "any", "all", "any", "pytest.mark.parametrize"] | 0 | [] | The function (test_independent_channels) defined within the public class called public.The function start at line 74 and ends at 110. It contains 20 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 10.0 functions, and It has 10.... |
CAREamics_careamics | public | public | 0 | 0 | create_LVAE_model | def create_LVAE_model(input_shape: tuple = (1, 64, 64),z_dims: list[int] = (128, 128, 128, 128),encoder_conv_strides=(2, 2),decoder_conv_strides=(2, 2),multiscale_count: int = 0,output_channels: int = 1,analytical_kl: bool = False,predict_logvar: Union[Literal["pixelwise"], None] = None,) -> nn.Module:lvae_model_config... | 1 | 31 | 3 | 174 | 2 | 16 | 47 | 16 | input_shape,z_dims,encoder_conv_strides,decoder_conv_strides,multiscale_count,output_channels,analytical_kl,predict_logvar | ['lvae_model_config', 'config'] | nn.Module | {"Assign": 2, "Return": 1} | 5 | 32 | 5 | ["LVAEModel", "VAEBasedAlgorithm", "LVAELossConfig", "GaussianLikelihoodConfig", "model_factory"] | 11 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.models.lvae.test_lvae_architecture_py.test_KL_shape", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.models.lvae.test_lvae_architecture_py.test_LC... | The function (create_LVAE_model) defined within the public class called public.The function start at line 16 and ends at 47. It contains 31 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [16.0] and does not return any value. It declares 5.0 functions, It has 5.0 functions c... |
CAREamics_careamics | public | public | 0 | 0 | test_first_bottom_up | def test_first_bottom_up(img_size: int,encoder_conv_strides,decoder_conv_strides,tmp_path,create_dummy_noise_model,) -> None:model = create_LVAE_model(tmp_path=tmp_path,encoder_conv_strides=encoder_conv_strides,decoder_conv_strides=decoder_conv_strides,create_dummy_noise_model=create_dummy_noise_model,input_shape=img_s... | 1 | 18 | 5 | 86 | 4 | 61 | 78 | 61 | img_size,encoder_conv_strides,decoder_conv_strides,tmp_path,create_dummy_noise_model | ['inputs', 'output', 'first_bottom_up', 'model'] | None | {"Assign": 4} | 5 | 18 | 5 | ["create_LVAE_model", "torch.ones", "first_bottom_up", "pytest.mark.skip", "pytest.mark.parametrize"] | 0 | [] | The function (test_first_bottom_up) defined within the public class called public.The function start at line 61 and ends at 78. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [61.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_bottom_up_layers | def test_bottom_up_layers(img_size: list[int],z_dims: list[int],multiscale_count,encoder_conv_stride,decoder_conv_stride,tmp_path,create_dummy_noise_model,) -> None:model = create_LVAE_model(tmp_path=tmp_path,input_shape=img_size,create_dummy_noise_model=create_dummy_noise_model,z_dims=z_dims,multiscale_count=multiscal... | 4 | 34 | 7 | 206 | 7 | 103 | 136 | 103 | img_size,z_dims,multiscale_count,encoder_conv_stride,decoder_conv_stride,tmp_path,create_dummy_noise_model | ['n_filters', 'expected_img_size', 'downscale_factor', 'input_size', 'model', 'bottom_up_layers', 'inputs'] | None | {"Assign": 9, "Expr": 1, "For": 1, "If": 1} | 13 | 34 | 13 | ["create_LVAE_model", "len", "len", "len", "downscale_factor.insert", "np.array", "np.array", "torch.ones", "layer", "tuple", "tuple", "pytest.mark.skip", "pytest.mark.parametrize"] | 0 | [] | The function (test_bottom_up_layers) defined within the public class called public.The function start at line 103 and ends at 136. It contains 34 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [103.0] and does not return any value. It declares 13.0 functions, and It has 13... |
CAREamics_careamics | public | public | 0 | 0 | test_LC_init | def test_LC_init(z_dims: list[int],multiscale_count: int,tmp_path,create_dummy_noise_model,) -> None:with pytest.raises(AssertionError):create_LVAE_model(tmp_path=tmp_path,create_dummy_noise_model=create_dummy_noise_model,z_dims=z_dims,multiscale_count=multiscale_count,) | 1 | 13 | 4 | 48 | 0 | 150 | 163 | 150 | z_dims,multiscale_count,tmp_path,create_dummy_noise_model | [] | None | {"Expr": 1, "With": 1} | 4 | 14 | 4 | ["pytest.raises", "create_LVAE_model", "pytest.mark.skip", "pytest.mark.parametrize"] | 0 | [] | The function (test_LC_init) defined within the public class called public.The function start at line 150 and ends at 163. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [150.0] and does not return any value. It declares 4.0 functions, and It has 4.0 function... |
CAREamics_careamics | public | public | 0 | 0 | test_bottom_up_pass | def test_bottom_up_pass(img_size: list[int],z_dims: list[int],multiscale_count: int,encoder_conv_stride,decoder_conv_stride,tmp_path,create_dummy_noise_model,) -> None:model = create_LVAE_model(input_shape=img_size,tmp_path=tmp_path,create_dummy_noise_model=create_dummy_noise_model,z_dims=z_dims,encoder_conv_strides=en... | 4 | 40 | 7 | 212 | 9 | 188 | 231 | 188 | img_size,z_dims,multiscale_count,encoder_conv_stride,decoder_conv_stride,tmp_path,create_dummy_noise_model | ['outputs', 'n_filters', 'img_size', 'model', 'lowres_first_bottom_up_layers', 'bottom_up_layers', 'exp_img_size', 'inputs', 'first_bottom_up_layer'] | None | {"Assign": 10, "For": 2, "If": 1} | 10 | 44 | 10 | ["create_LVAE_model", "len", "len", "range", "torch.ones", "model._bottomup_pass", "range", "len", "pytest.mark.skip", "pytest.mark.parametrize"] | 0 | [] | The function (test_bottom_up_pass) defined within the public class called public.The function start at line 188 and ends at 231. It contains 40 lines of code and it has a cyclomatic complexity of 4. It takes 7 parameters, represented as [188.0] and does not return any value. It declares 10.0 functions, and It has 10.0... |
CAREamics_careamics | public | public | 0 | 0 | test_topmost_top_down_layer | def test_topmost_top_down_layer(img_size: int, multiscale_count: int, tmp_path, create_dummy_noise_model) -> None:model = create_LVAE_model(input_shape=img_size,tmp_path=tmp_path,create_dummy_noise_model=create_dummy_noise_model,multiscale_count=multiscale_count,)topmost_top_down = model.top_down_layers[-1]n_filters = ... | 3 | 23 | 4 | 161 | 10 | 237 | 261 | 237 | img_size,multiscale_count,tmp_path,create_dummy_noise_model | ['n_filters', 'expected_out_shape', 'downscaling', 'model', 'expected_z_shape', 'downscaled_size', 'topmost_top_down', 'bu_value', 'exp_out_size', 'retain_sp_dims'] | None | {"Assign": 11} | 6 | 25 | 6 | ["create_LVAE_model", "torch.ones", "topmost_top_down", "pytest.mark.skip", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_topmost_top_down_layer) defined within the public class called public.The function start at line 237 and ends at 261. It contains 23 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [237.0] and does not return any value. It declares 6.0 functions, and It h... |
CAREamics_careamics | public | public | 0 | 0 | test_all_top_down_layers | def test_all_top_down_layers(img_size: int,z_dims: tuple[int],multiscale_count: int,encoder_conv_stride,decoder_conv_stride,tmp_path,create_dummy_noise_model,) -> None:model = create_LVAE_model(tmp_path=tmp_path,create_dummy_noise_model=create_dummy_noise_model,input_shape=img_size,z_dims=z_dims,multiscale_count=multis... | 6 | 49 | 7 | 266 | 13 | 277 | 326 | 277 | img_size,z_dims,multiscale_count,encoder_conv_stride,decoder_conv_stride,tmp_path,create_dummy_noise_model | ['n_filters', 'bu_value', 'td_layer', 'top_down_layers', 'expected_out_shape', 'downscaling', 'model', 'expected_z_shape', 'downscaled_size', 'skip_input', 'inputs', 'exp_out_size', 'retain_sp_dims'] | None | {"Assign": 16, "Expr": 1, "For": 1, "If": 1} | 9 | 50 | 9 | ["create_LVAE_model", "len", "downscaled_size.insert", "torch.ones", "reversed", "range", "td_layer", "pytest.mark.skip", "pytest.mark.parametrize"] | 0 | [] | The function (test_all_top_down_layers) defined within the public class called public.The function start at line 277 and ends at 326. It contains 49 lines of code and it has a cyclomatic complexity of 6. It takes 7 parameters, represented as [277.0] and does not return any value. It declares 9.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_final_top_down | def test_final_top_down(img_size: int, multiscale_count: int, tmp_path, create_dummy_noise_model) -> None:model = create_LVAE_model(tmp_path=tmp_path,create_dummy_noise_model=create_dummy_noise_model,input_shape=img_size,multiscale_count=multiscale_count,)final_top_down = model.final_top_downn_filters = model.encoder_n... | 1 | 17 | 4 | 97 | 8 | 332 | 348 | 332 | img_size,multiscale_count,tmp_path,create_dummy_noise_model | ['n_filters', 'output', 'expected_out_shape', 'final_upsampling', 'inp_size', 'model', 'final_top_down', 'inputs'] | None | {"Assign": 8} | 6 | 17 | 6 | ["create_LVAE_model", "torch.ones", "final_top_down", "pytest.mark.skip", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_final_top_down) defined within the public class called public.The function start at line 332 and ends at 348. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [332.0] and does not return any value. It declares 6.0 functions, and It has 6.0 f... |
CAREamics_careamics | public | public | 0 | 0 | test_top_down_pass | def test_top_down_pass(img_size: int, multiscale_count: int, tmp_path, create_dummy_noise_model) -> None:model = create_LVAE_model(tmp_path=tmp_path,create_dummy_noise_model=create_dummy_noise_model,input_shape=img_size,multiscale_count=multiscale_count,)top_down_layers = model.top_down_layersfinal_top_down = model.fin... | 4 | 31 | 4 | 193 | 10 | 354 | 388 | 354 | img_size,multiscale_count,tmp_path,create_dummy_noise_model | ['n_filters', 'expected_out_shape', 'top_down_layers', 'curr_size', 'bu_values', 'n_layers', 'model', 'td_sizes', 'final_top_down', 'expected_z_shape'] | None | {"Assign": 11, "AugAssign": 1, "Expr": 2, "For": 2, "If": 1} | 10 | 35 | 10 | ["create_LVAE_model", "range", "td_sizes.append", "bu_values.append", "torch.ones", "model.topdown_pass", "range", "pytest.mark.skip", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_top_down_pass) defined within the public class called public.The function start at line 354 and ends at 388. It contains 31 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [354.0] and does not return any value. It declares 10.0 functions, and It has 10.0 ... |
CAREamics_careamics | public | public | 0 | 0 | test_KL_shape | def test_KL_shape(img_size: int,multiscale_count: int,analytical_kl: bool,batch_size: int,tmp_path,create_dummy_noise_model,) -> None:model = create_LVAE_model(tmp_path=tmp_path,create_dummy_noise_model=create_dummy_noise_model,input_shape=img_size,multiscale_count=multiscale_count,analytical_kl=analytical_kl,)top_down... | 6 | 47 | 6 | 296 | 10 | 396 | 446 | 396 | img_size,multiscale_count,analytical_kl,batch_size,tmp_path,create_dummy_noise_model | ['n_filters', 'top_down_layers', 'curr_size', 'exp_keys', 'bu_values', 'n_layers', 'model', 'td_sizes', 'final_top_down', 'expected_z_shape'] | None | {"Assign": 11, "AugAssign": 1, "Expr": 2, "For": 2, "If": 2} | 14 | 51 | 14 | ["create_LVAE_model", "range", "td_sizes.append", "bu_values.append", "torch.ones", "model.topdown_pass", "all", "data.keys", "range", "pytest.mark.skip", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_KL_shape) defined within the public class called public.The function start at line 396 and ends at 446. It contains 47 lines of code and it has a cyclomatic complexity of 6. It takes 6 parameters, represented as [396.0] and does not return any value. It declares 14.0 functions, and It has 14.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_output_layer | def test_output_layer(img_size: int,multiscale_count: int,predict_logvar: Union[Literal["pixelwise"], None],output_channels: int,tmp_path,create_dummy_noise_model,) -> None:model = create_LVAE_model(tmp_path=tmp_path,create_dummy_noise_model=create_dummy_noise_model,input_shape=img_size,multiscale_count=multiscale_coun... | 2 | 23 | 6 | 125 | 7 | 454 | 477 | 454 | img_size,multiscale_count,predict_logvar,output_channels,tmp_path,create_dummy_noise_model | ['n_filters', 'output', 'out_layer', 'input_', 'model', 'exp_out_shape', 'num_out_ch'] | None | {"Assign": 7} | 8 | 24 | 8 | ["create_LVAE_model", "torch.ones", "out_layer", "pytest.mark.skip", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_output_layer) defined within the public class called public.The function start at line 454 and ends at 477. It contains 23 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [454.0] and does not return any value. It declares 8.0 functions, and It has 8.0 fun... |
CAREamics_careamics | public | public | 0 | 0 | test_lvae | def test_lvae(img_size: list[int],z_dims: list[int],multiscale_count: int,encoder_conv_stride,decoder_conv_stride,tmp_path,create_dummy_noise_model,) -> None:model = create_LVAE_model(input_shape=img_size,z_dims=z_dims,multiscale_count=multiscale_count,encoder_conv_strides=encoder_conv_stride,decoder_conv_strides=decod... | 3 | 27 | 7 | 164 | 2 | 500 | 526 | 500 | img_size,z_dims,multiscale_count,encoder_conv_stride,decoder_conv_stride,tmp_path,create_dummy_noise_model | ['inputs', 'model'] | None | {"Assign": 3} | 11 | 27 | 11 | ["create_LVAE_model", "torch.ones", "model", "len", "len", "len", "len", "len", "len", "all", "pytest.mark.parametrize"] | 0 | [] | The function (test_lvae) defined within the public class called public.The function start at line 500 and ends at 526. It contains 27 lines of code and it has a cyclomatic complexity of 3. It takes 7 parameters, represented as [500.0] and does not return any value. It declares 11.0 functions, and It has 11.0 functions... |
CAREamics_careamics | public | public | 0 | 0 | test_factory_no_noise_model | def test_factory_no_noise_model():noise_model = noise_model_factory(None)assert noise_model is None | 1 | 3 | 0 | 14 | 1 | 19 | 21 | 19 | ['noise_model'] | None | {"Assign": 1} | 1 | 3 | 1 | ["noise_model_factory"] | 0 | [] | The function (test_factory_no_noise_model) defined within the public class called public.The function start at line 19 and ends at 21. It contains 3 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, and It has 1.0 fu... | |
CAREamics_careamics | public | public | 0 | 0 | test_instantiate_noise_model | def test_instantiate_noise_model(tmp_path: Path, create_dummy_noise_model) -> None:# Create a dummy noise modelnp.savez(tmp_path / "dummy_noise_model.npz", **create_dummy_noise_model)# Instantiate the noise modelgmm = GaussianMixtureNMConfig(model_type="GaussianMixtureNoiseModel",path=tmp_path / "dummy_noise_model.npz"... | 1 | 13 | 2 | 102 | 3 | 24 | 40 | 24 | tmp_path,create_dummy_noise_model | ['gmm', 'noise_model_config', 'noise_model'] | None | {"Assign": 3, "Expr": 1} | 4 | 17 | 4 | ["np.savez", "GaussianMixtureNMConfig", "MultiChannelNMConfig", "noise_model_factory"] | 0 | [] | The function (test_instantiate_noise_model) defined within the public class called public.The function start at line 24 and ends at 40. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [24.0] and does not return any value. It declares 4.0 functions, and It has... |
CAREamics_careamics | public | public | 0 | 0 | test_instantiate_multiple_noise_models | def test_instantiate_multiple_noise_models(tmp_path: Path, create_dummy_noise_model) -> None:# Create a dummy noise modelnp.savez(tmp_path / "dummy_noise_model.npz", **create_dummy_noise_model)# Instantiate the noise modelgmm = GaussianMixtureNMConfig(model_type="GaussianMixtureNoiseModel",path=tmp_path / "dummy_noise_... | 1 | 26 | 2 | 215 | 3 | 43 | 72 | 43 | tmp_path,create_dummy_noise_model | ['gmm', 'noise_model_config', 'noise_model'] | None | {"Assign": 3, "Expr": 1} | 4 | 30 | 4 | ["np.savez", "GaussianMixtureNMConfig", "MultiChannelNMConfig", "noise_model_factory"] | 0 | [] | The function (test_instantiate_multiple_noise_models) defined within the public class called public.The function start at line 43 and ends at 72. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [43.0] and does not return any value. It declares 4.0 functions, a... |
CAREamics_careamics | public | public | 0 | 0 | test_noise_model_likelihood | def test_noise_model_likelihood(tmp_path: Path,img_size: int,create_dummy_noise_model,) -> None:np.savez(tmp_path / "dummy_noise_model.npz", **create_dummy_noise_model)gmm_config = GaussianMixtureNMConfig(model_type="GaussianMixtureNoiseModel",path=tmp_path / "dummy_noise_model.npz",# all other params are default)nm = ... | 1 | 18 | 3 | 109 | 6 | 76 | 96 | 76 | tmp_path,img_size,create_dummy_noise_model | ['likelihood', 'signal', 'obs', 'gmm_config', 'nm', 'inp_shape'] | None | {"Assign": 6, "Expr": 1} | 8 | 21 | 8 | ["np.savez", "GaussianMixtureNMConfig", "GaussianMixtureNoiseModel", "isinstance", "torch.ones", "torch.randn", "nm.likelihood", "pytest.mark.parametrize"] | 0 | [] | The function (test_noise_model_likelihood) defined within the public class called public.The function start at line 76 and ends at 96. It contains 18 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [76.0] and does not return any value. It declares 8.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_multi_channel_noise_model_likelihood | def test_multi_channel_noise_model_likelihood(tmp_path: Path,img_size: int,target_ch: int,create_dummy_noise_model,) -> None:noise_models = []rand_epss = []for i in range(target_ch):eps = np.random.rand()nm_dict = create_dummy_noise_model.copy()nm_dict["trained_weight"] = nm_dict["trained_weight"] + epsrand_epss.append... | 4 | 40 | 4 | 247 | 11 | 101 | 143 | 101 | tmp_path,img_size,target_ch,create_dummy_noise_model | ['likelihood', 'signal', 'noise_models', 'obs', 'eps', 'gmm', 'rand_epss', 'inp_shape', 'noise_model_config', 'nm', 'nm_dict'] | None | {"Assign": 12, "Expr": 3, "For": 1} | 23 | 43 | 23 | ["range", "np.random.rand", "create_dummy_noise_model.copy", "rand_epss.append", "np.savez", "GaussianMixtureNMConfig", "noise_models.append", "MultiChannelNMConfig", "noise_model_factory", "isinstance", "all", "isinstance", "getattr", "range", "all", "np.allclose", "getattr", "range", "torch.ones", "torch.randn", "nm.... | 0 | [] | The function (test_multi_channel_noise_model_likelihood) defined within the public class called public.The function start at line 101 and ends at 143. It contains 40 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [101.0] and does not return any value. It declares 23.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_gm_noise_model_training | def test_gm_noise_model_training(image_size, max_value, noise_scale):gen = np.random.default_rng(42)signal_normalized = gen.uniform(0, 1, image_size)noise = gen.normal(0, noise_scale, image_size)observation_normalized = signal_normalized + noisesignal = signal_normalized * max_valueobservation = observation_normalized ... | 1 | 29 | 3 | 222 | 17 | 153 | 189 | 153 | image_size,max_value,noise_scale | ['learned_mu', 'signal', 'signal_normalized', 'initial_loss', 'real_mu', 'last_loss', 'noise', 'observation', 'learned_sigma', 'real_sigma', 'noise_image', 'gen', 'signal_tensor', 'training_losses', 'observation_normalized', 'nm_config', 'noise_model'] | None | {"Assign": 18} | 18 | 37 | 18 | ["np.random.default_rng", "gen.uniform", "gen.normal", "GaussianMixtureNMConfig", "signal.min", "signal.max", "GaussianMixtureNoiseModel", "noise_model.fit", "to", "torch.from_numpy", "noise_model.get_gaussian_parameters", "mus.mean", "signal_normalized.mean", "np.allclose", "sigmas.mean", "noise_image.std", "np.allclo... | 0 | [] | The function (test_gm_noise_model_training) defined within the public class called public.The function start at line 153 and ends at 189. It contains 29 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [153.0] and does not return any value. It declares 18.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_noise_model_sampling | def test_noise_model_sampling(image_size, max_value):gen = np.random.default_rng(42)signal = gen.uniform(0, 1, image_size)observation = signal + gen.normal(0, 0.1, signal.shape)signal = signal * max_valueobservation = observation * max_valuenm_config = GaussianMixtureNMConfig(model_type="GaussianMixtureNoiseModel",n_ga... | 1 | 25 | 2 | 170 | 9 | 193 | 220 | 193 | image_size,max_value | ['real_noise', 'signal', 'predicted_noise', 'noise_distribution_difference', 'observation', 'sampled_noise_data', 'gen', 'noise_model', 'nm_config'] | None | {"Assign": 13, "Expr": 1} | 13 | 28 | 13 | ["np.random.default_rng", "gen.uniform", "gen.normal", "GaussianMixtureNMConfig", "signal.min", "signal.max", "GaussianMixtureNoiseModel", "noise_model.fit", "noise_model.sample_observation_from_signal", "wasserstein_distance", "real_noise.ravel", "predicted_noise.ravel", "pytest.mark.parametrize"] | 0 | [] | The function (test_noise_model_sampling) defined within the public class called public.The function start at line 193 and ends at 220. It contains 25 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [193.0] and does not return any value. It declares 13.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_noise_model_in_likelihood_call | def test_noise_model_in_likelihood_call():test_input = torch.rand(256, 256)test_target = torch.rand(256, 256)nm_config = GaussianMixtureNMConfig(model_type="GaussianMixtureNoiseModel", n_gaussian=1)noise_model = GaussianMixtureNoiseModel(nm_config)likelihood = NoiseModelLikelihood(noise_model=noise_model)likelihood.set... | 1 | 11 | 0 | 81 | 5 | 223 | 235 | 223 | ['likelihood', 'test_input', 'noise_model', 'test_target', 'nm_config'] | None | {"Assign": 6, "Expr": 1} | 9 | 13 | 9 | ["torch.rand", "torch.rand", "GaussianMixtureNMConfig", "GaussianMixtureNoiseModel", "NoiseModelLikelihood", "likelihood.set_data_stats", "test_input.mean", "test_input.std", "likelihood"] | 0 | [] | The function (test_noise_model_in_likelihood_call) defined within the public class called public.The function start at line 223 and ends at 235. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, and ... | |
CAREamics_careamics | public | public | 0 | 0 | test_crop_img_shape | def test_crop_img_shape(x, size):res = crop_img_tensor(x, size)assert res.shape[2:] == size | 1 | 3 | 2 | 25 | 1 | 14 | 16 | 14 | x,size | ['res'] | None | {"Assign": 1} | 4 | 3 | 4 | ["crop_img_tensor", "pytest.mark.parametrize", "torch.zeros", "torch.zeros"] | 0 | [] | The function (test_crop_img_shape) defined within the public class called public.The function start at line 14 and ends at 16. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [14.0] and does not return any value. It declares 4.0 functions, and It has 4.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_crop_img_assert | def test_crop_img_assert(x, size):with pytest.raises(ValueError):crop_img_tensor(x, size) | 1 | 3 | 2 | 21 | 0 | 26 | 28 | 26 | x,size | [] | None | {"Expr": 1, "With": 1} | 5 | 3 | 5 | ["pytest.raises", "crop_img_tensor", "pytest.mark.parametrize", "torch.zeros", "torch.zeros"] | 0 | [] | The function (test_crop_img_assert) defined within the public class called public.The function start at line 26 and ends at 28. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [26.0] and does not return any value. It declares 5.0 functions, and It has 5.0 func... |
CAREamics_careamics | public | public | 0 | 0 | test_crop_img_result | def test_crop_img_result(x, size, expected):res = crop_img_tensor(x, size)assert torch.equal(res, expected) | 1 | 3 | 3 | 26 | 1 | 46 | 48 | 46 | x,size,expected | ['res'] | None | {"Assign": 1} | 9 | 3 | 9 | ["crop_img_tensor", "torch.equal", "pytest.mark.parametrize", "reshape", "torch.arange", "torch.tensor", "reshape", "torch.arange", "torch.tensor"] | 0 | [] | The function (test_crop_img_result) defined within the public class called public.The function start at line 46 and ends at 48. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [46.0] and does not return any value. It declares 9.0 functions, and It has 9.0 func... |
CAREamics_careamics | public | public | 0 | 0 | test_pad_img_shape | def test_pad_img_shape(x, size):res = pad_img_tensor(x, size)assert res.shape[2:] == size | 1 | 3 | 2 | 25 | 1 | 58 | 60 | 58 | x,size | ['res'] | None | {"Assign": 1} | 4 | 3 | 4 | ["pad_img_tensor", "pytest.mark.parametrize", "torch.zeros", "torch.zeros"] | 0 | [] | The function (test_pad_img_shape) defined within the public class called public.The function start at line 58 and ends at 60. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [58.0] and does not return any value. It declares 4.0 functions, and It has 4.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_pad_img_assert | def test_pad_img_assert(x, size):with pytest.raises(ValueError):pad_img_tensor(x, size) | 1 | 3 | 2 | 21 | 0 | 70 | 72 | 70 | x,size | [] | None | {"Expr": 1, "With": 1} | 5 | 3 | 5 | ["pytest.raises", "pad_img_tensor", "pytest.mark.parametrize", "torch.zeros", "torch.zeros"] | 0 | [] | The function (test_pad_img_assert) defined within the public class called public.The function start at line 70 and ends at 72. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [70.0] and does not return any value. It declares 5.0 functions, and It has 5.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_pad_img_result | def test_pad_img_result(x, size, expected):res = pad_img_tensor(x, size)assert torch.equal(res, expected) | 1 | 3 | 3 | 26 | 1 | 113 | 115 | 113 | x,size,expected | ['res'] | None | {"Assign": 1} | 9 | 3 | 9 | ["pad_img_tensor", "torch.equal", "pytest.mark.parametrize", "reshape", "torch.arange", "torch.tensor", "reshape", "torch.arange", "torch.tensor"] | 0 | [] | The function (test_pad_img_result) defined within the public class called public.The function start at line 113 and ends at 115. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [113.0] and does not return any value. It declares 9.0 functions, and It has 9.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_smoke_careamics_dset_lvae_prediction | def test_smoke_careamics_dset_lvae_prediction(minimum_lvae_params, gaussian_likelihood_params, predict_logvar, output_channels):minimum_lvae_params["predict_logvar"] = predict_logvarminimum_lvae_params["output_channels"] = output_channelsgaussian_likelihood_params["predict_logvar"] = predict_logvarinput_shape = minimum... | 5 | 39 | 4 | 273 | 14 | 29 | 76 | 29 | minimum_lvae_params,gaussian_likelihood_params,predict_logvar,output_channels | ['dataloader', 'prediction_shape', 'predictions', 'tiled_predictions', 'N_samples', 'inference_dict', 'input_shape', 'inference_config', 'model', 'dataset', 'data_shape', 'likelihood_obj', 'log_vars', 'data'] | None | {"Assign": 18, "Expr": 2, "For": 2, "If": 2} | 13 | 48 | 13 | ["LadderVAE", "GaussianLikelihood", "InferenceConfig", "np.random.random_sample", "InMemoryTiledPredDataset", "DataLoader", "lvae_predict_tiled_batch", "tiled_predictions.append", "log_vars.append", "convert_outputs", "pytest.mark.skip", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_smoke_careamics_dset_lvae_prediction) defined within the public class called public.The function start at line 29 and ends at 76. It contains 39 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [29.0] and does not return any value. It declares 13.0 function... |
CAREamics_careamics | public | public | 0 | 0 | test_lvae_predict_single_sample | def test_lvae_predict_single_sample(minimum_lvae_params, gaussian_likelihood_params, predict_logvar, output_channels):"""Test predictions of a single sample."""minimum_lvae_params["predict_logvar"] = predict_logvarminimum_lvae_params["output_channels"] = output_channelsgaussian_likelihood_params["predict_logvar"] = pre... | 3 | 26 | 4 | 221 | 8 | 81 | 115 | 81 | minimum_lvae_params,gaussian_likelihood_params,predict_logvar,output_channels | ['log_var', 'input_', 'input_shape', 'model', 'x', 'y', 'likelihood_obj', 'tile_info'] | None | {"Assign": 12, "Expr": 1, "If": 2} | 7 | 35 | 7 | ["LadderVAE", "GaussianLikelihood", "torch.rand", "TileInformation", "lvae_predict_tiled_batch", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_lvae_predict_single_sample) defined within the public class called public.The function start at line 81 and ends at 115. It contains 26 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [81.0] and does not return any value. It declares 7.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_lvae_predict_mmse_tiled_batch | def test_lvae_predict_mmse_tiled_batch(minimum_lvae_params, gaussian_likelihood_params, predict_logvar, output_channels):"""Test MMSE prediction."""minimum_lvae_params["predict_logvar"] = predict_logvarminimum_lvae_params["output_channels"] = output_channelsgaussian_likelihood_params["predict_logvar"] = predict_logvari... | 3 | 30 | 4 | 246 | 9 | 120 | 158 | 120 | minimum_lvae_params,gaussian_likelihood_params,predict_logvar,output_channels | ['log_var', 'input_', 'input_shape', 'model', 'x', 'y', 'likelihood_obj', 'tile_info', 'y_std'] | None | {"Assign": 13, "Expr": 1, "If": 2} | 7 | 39 | 7 | ["LadderVAE", "GaussianLikelihood", "torch.rand", "TileInformation", "lvae_predict_mmse_tiled_batch", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_lvae_predict_mmse_tiled_batch) defined within the public class called public.The function start at line 120 and ends at 158. It contains 30 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [120.0] and does not return any value. It declares 7.0 functions, an... |
CAREamics_careamics | public | public | 0 | 0 | test_convert_outputs_tiled | def test_convert_outputs_tiled(ordered_array, batch_size, n_samples):"""Test conversion of output for when prediction is tiled"""# --- simulate outputs from trainer.predicttile_size = (4, 4)overlaps = (2, 2)arr = ordered_array((n_samples, 1, 16, 16))all_tiles = list(extract_tiles(arr, tile_size, overlaps))# combine int... | 4 | 14 | 3 | 166 | 8 | 10 | 27 | 10 | ordered_array,batch_size,n_samples | ['all_tiles', 'predictions', 'tile_size', 'arr', 'tile_infos', 'overlaps', 'tiles', 'prediction_batches'] | None | {"Assign": 8, "Expr": 2, "For": 1} | 14 | 18 | 14 | ["ordered_array", "list", "extract_tiles", "range", "len", "np.concatenate", "prediction_batches.append", "convert_outputs", "np.array_equal", "squeeze", "np.stack", "arr.squeeze", "pytest.mark.parametrize", "pytest.mark.parametrize"] | 0 | [] | The function (test_convert_outputs_tiled) defined within the public class called public.The function start at line 10 and ends at 27. It contains 14 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [10.0] and does not return any value. It declares 14.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_convert_outputs_not_tiled | def test_convert_outputs_not_tiled(ordered_array, batch_size, n_samples):"""Test conversion of output for when prediction is not tiled"""# --- simulate outputs from trainer.predictprediction_batches = [ordered_array((batch_size, 1, 16, 16)) for _ in range(n_samples // batch_size)]predictions = convert_outputs(predictio... | 2 | 9 | 3 | 79 | 2 | 31 | 43 | 31 | ordered_array,batch_size,n_samples | ['prediction_batches', 'predictions'] | None | {"Assign": 2, "Expr": 1} | 9 | 13 | 9 | ["ordered_array", "range", "convert_outputs", "np.array_equal", "squeeze", "np.stack", "squeeze", "np.concatenate", "pytest.mark.parametrize"] | 0 | [] | The function (test_convert_outputs_not_tiled) defined within the public class called public.The function start at line 31 and ends at 43. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [31.0] and does not return any value. It declares 9.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_stitch_tiles_single | def test_stitch_tiles_single(ordered_array, input_shape, tile_size, overlaps):"""Test stitching tiles back together."""arr = ordered_array(input_shape, dtype=int)n_samples = input_shape[0]# extract tilesall_tiles = list(extract_tiles(arr, tile_size, overlaps))tiles = []tile_infos = []sample_id = 0for tile, tile_info in... | 3 | 17 | 4 | 115 | 7 | 24 | 52 | 24 | ordered_array,input_shape,tile_size,overlaps | ['all_tiles', 'arr', 'sample_id', 'result', 'tile_infos', 'tiles', 'n_samples'] | None | {"Assign": 7, "AugAssign": 1, "Expr": 5, "For": 1, "If": 1} | 10 | 29 | 10 | ["ordered_array", "list", "extract_tiles", "tiles.append", "tile_infos.append", "stitch_prediction_single", "np.array_equal", "tiles.clear", "tile_infos.clear", "pytest.mark.parametrize"] | 0 | [] | The function (test_stitch_tiles_single) defined within the public class called public.The function start at line 24 and ends at 52. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [24.0] and does not return any value. It declares 10.0 functions, and It has 10... |
CAREamics_careamics | public | public | 0 | 0 | test_stitch_tiles_multi | def test_stitch_tiles_multi(ordered_array, input_shape, tile_size, overlaps):"""Test stitching tiles back together."""arr = ordered_array(input_shape, dtype=int)n_samples = input_shape[0]# extract tilesall_tiles = list(extract_tiles(arr, tile_size, overlaps))tiles = []tile_infos = []for tile, tile_info in all_tiles:# c... | 3 | 13 | 4 | 107 | 6 | 71 | 90 | 71 | ordered_array,input_shape,tile_size,overlaps | ['all_tiles', 'arr', 'tile_infos', 'stitched', 'tiles', 'n_samples'] | None | {"Assign": 6, "Expr": 3, "For": 2} | 10 | 20 | 10 | ["ordered_array", "list", "extract_tiles", "tiles.append", "tile_infos.append", "stitch_prediction", "enumerate", "np.array_equal", "len", "pytest.mark.parametrize"] | 0 | [] | The function (test_stitch_tiles_multi) defined within the public class called public.The function start at line 71 and ends at 90. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [71.0] and does not return any value. It declares 10.0 functions, and It has 10.... |
CAREamics_careamics | public | public | 0 | 0 | test_empty_compose | def test_empty_compose(ordered_array):array = ordered_array((4, 5, 5))source = array[2:, ...]target = array[:2, ...]# instantiate Composecompose = Compose([])# apply the composed transformsource_transformed, target_transformed = compose(source, target)# check the resultsassert (source_transformed == source).all()assert... | 1 | 8 | 1 | 72 | 4 | 12 | 25 | 12 | ordered_array | ['compose', 'source', 'target', 'array'] | None | {"Assign": 5} | 5 | 14 | 5 | ["ordered_array", "Compose", "compose", "all", "all"] | 0 | [] | The function (test_empty_compose) defined within the public class called public.The function start at line 12 and ends at 25. 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 functions... |
CAREamics_careamics | public | public | 0 | 0 | test_compose_with_target | def test_compose_with_target(ordered_array):seed = 24array = ordered_array((4, 5, 5))source = array[2:, ...]target = array[:2, ...]# transform liststransform_list = [XYFlip(seed=seed), XYRandomRotate90(seed=seed)]transform_list_pydantic = [XYFlipModel(name="XYFlip", seed=seed),XYRandomRotate90Model(name="XYRandomRotate... | 1 | 16 | 1 | 147 | 7 | 28 | 53 | 28 | ordered_array | ['target', 'array', 'compose', 'transform_list_pydantic', 'transform_list', 'source', 'seed'] | None | {"Assign": 10} | 9 | 26 | 9 | ["ordered_array", "XYFlip", "XYRandomRotate90", "XYFlipModel", "XYRandomRotate90Model", "Compose", "compose", "all", "all"] | 0 | [] | The function (test_compose_with_target) defined within the public class called public.The function start at line 28 and ends at 53. 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 9.0 functions, and It has 9.0 fu... |
CAREamics_careamics | public | public | 0 | 0 | test_random_composition | def test_random_composition(ordered_array, shape):"""Test that all the transforms can be composed in arbitrary order.This exclude the N2VManipulate transform, which needs to be the last one."""rng = np.random.default_rng(seed=42)# create arrayarray = ordered_array(shape)mask = ordered_array(shape) + 5# apply transform ... | 6 | 21 | 2 | 202 | 6 | 67 | 100 | 67 | ordered_array,shape | ['transforms', 'array', 'compose', 'mask', 'rng', 'flip_x'] | None | {"Assign": 7, "Expr": 2, "For": 1} | 18 | 34 | 18 | ["np.random.default_rng", "ordered_array", "ordered_array", "range", "rng.choice", "NormalizeModel", "range", "range", "range", "range", "XYFlipModel", "XYRandomRotate90Model", "rng.shuffle", "Compose", "compose", "np.array_equal", "np.array_equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_random_composition) defined within the public class called public.The function start at line 67 and ends at 100. It contains 21 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [67.0] and does not return any value. It declares 18.0 functions, and It has 18... |
CAREamics_careamics | public | public | 0 | 0 | test_compose_additional_arrays | def test_compose_additional_arrays(ordered_array):"""Test additional arrays get tranformed in the same way as the patch."""seed = 24# create inputsshape = (2, 2, 5, 5)array = ordered_array(shape)additional_arrays = {"arr": ordered_array(shape)}# create tranformstransforms = [XYFlipModel(name="XYFlip", seed=seed),XYRand... | 1 | 14 | 1 | 95 | 6 | 103 | 122 | 103 | ordered_array | ['additional_arrays', 'transforms', 'array', 'compose', 'shape', 'seed'] | None | {"Assign": 7, "Expr": 1} | 7 | 20 | 7 | ["ordered_array", "ordered_array", "XYFlipModel", "XYRandomRotate90Model", "Compose", "compose.transform_with_additional_arrays", "np.array_equal"] | 0 | [] | The function (test_compose_additional_arrays) defined within the public class called public.The function start at line 103 and ends at 122. 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 7.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_manipulate_n2v | def test_manipulate_n2v(strategy):"""Test the N2V augmentation."""# create array, adding a channel to simulate a 2D image with channel lastarray = np.arange(16 * 16).reshape((16, 16))[np.newaxis, ...]# create augmentationaug = N2VManipulate(roi_size=5, masked_pixel_percentage=5, strategy=strategy)# apply augmentationau... | 1 | 9 | 1 | 107 | 5 | 14 | 31 | 14 | strategy | ['mask_coords', 'diff_coords', 'augmented', 'array', 'aug'] | None | {"Assign": 6, "Expr": 1} | 11 | 18 | 11 | ["reshape", "np.arange", "N2VManipulate", "aug", "len", "np.array", "np.where", "np.array", "np.where", "np.array_equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_manipulate_n2v) defined within the public class called public.The function start at line 14 and ends at 31. 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 11.0 functions, and It has 11.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_manipulate_n2v_torch | def test_manipulate_n2v_torch(strategy):"""Test the N2V augmentation."""# Create tensor, adding a channel to simulate a 2D image with channel firstarray = torch.arange(16 * 16).reshape(1, 16, 16).float()# create configurationconfig = N2VManipulateModel(roi_size=5, masked_pixel_percentage=5, strategy=strategy.value)# Cr... | 1 | 12 | 1 | 118 | 6 | 38 | 59 | 38 | strategy | ['config', 'diff_coords', 'augmented', 'array', 'mask_coords', 'aug'] | None | {"Assign": 7, "Expr": 1} | 11 | 22 | 11 | ["float", "reshape", "torch.arange", "N2VManipulateModel", "N2VManipulateTorch", "aug", "len", "torch.nonzero", "torch.nonzero", "torch.equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_manipulate_n2v_torch) defined within the public class called public.The function start at line 38 and ends at 59. 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 11.0 functions, and It has 11.0... |
CAREamics_careamics | public | public | 0 | 0 | test_reshape_stats | def test_reshape_stats(ndim):"""Test that reshape stats allows a list of float to be broadcasted to a givennumber of dimensions."""shape = (4,) + (8,) * (ndim - 1)assert len(shape) == ndim# create statsstats = [(i + 1) for i in range(shape[0])]# create test arrayarray = np.ones(shape)# reshape and check that you can pe... | 6 | 19 | 1 | 224 | 8 | 11 | 41 | 11 | ndim | ['div', 'array', 'reshaped', 'shape', 'add', 'sub', 'stats', 'mult'] | None | {"Assign": 8, "Expr": 1, "For": 4} | 13 | 31 | 13 | ["len", "range", "np.ones", "_reshape_stats", "range", "all", "range", "all", "range", "all", "range", "all", "pytest.mark.parametrize"] | 0 | [] | The function (test_reshape_stats) defined within the public class called public.The function start at line 11 and ends at 41. It contains 19 lines of code and it has a cyclomatic complexity of 6. The function does not take any parameters and does not return any value. It declares 13.0 functions, and It has 13.0 functi... |
CAREamics_careamics | public | public | 0 | 0 | test_normalize_denormalize | def test_normalize_denormalize(channels):"""Test the Normalize transform."""# Create data, adding sample dimension for stats computationarray = np.arange(100 * channels).reshape((1, channels, 10, 10))# Compute mean and stdmeans, stds = compute_normalization_stats(image=array)# Create the transformnorm = Normalize(image... | 1 | 16 | 1 | 145 | 4 | 45 | 72 | 45 | channels | ['denorm', 'denormalized', 'array', 'norm'] | None | {"Assign": 6, "Expr": 1} | 14 | 28 | 14 | ["reshape", "np.arange", "compute_normalization_stats", "Normalize", "norm", "np.abs", "normalized.mean", "np.abs", "normalized.std", "Denormalize", "denorm", "all", "np.isclose", "pytest.mark.parametrize"] | 0 | [] | The function (test_normalize_denormalize) defined within the public class called public.The function start at line 45 and ends at 72. 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 14.0 functions, and It has 14.... |
CAREamics_careamics | public | public | 0 | 0 | test_transform_additional_arrays_not_implemented | def test_transform_additional_arrays_not_implemented(ordered_array):"""Test normalize raises not implemented if additional arrays are used"""# create inputsshape = (2, 2, 5, 5)array = ordered_array(shape)additional_arrays = {"arr": ordered_array(shape)}# Compute mean and stdmeans, stds = compute_normalization_stats(ima... | 1 | 11 | 1 | 71 | 4 | 76 | 93 | 76 | ordered_array | ['shape', 'array', 'additional_arrays', 'norm'] | None | {"Assign": 5, "Expr": 2, "With": 1} | 6 | 18 | 6 | ["ordered_array", "ordered_array", "compute_normalization_stats", "Normalize", "pytest.raises", "norm"] | 0 | [] | The function (test_transform_additional_arrays_not_implemented) defined within the public class called public.The function start at line 76 and ends at 93. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 6.0 funct... |
CAREamics_careamics | public | public | 0 | 0 | test_normalize_empty_stats | def test_normalize_empty_stats():input_array = np.random.rand(1, 1, 100, 100)input_stats = Stats([input_array.mean()], [input_array.std()])target_array = np.random.rand(1, 1, 100, 100)target_stats = Stats((), ())with pytest.raises(ValueError):norm = Normalize(image_means=input_stats.means,image_stds=input_stats.stds,ta... | 1 | 21 | 0 | 148 | 5 | 96 | 118 | 96 | ['input_array', 'target_stats', 'norm', 'input_stats', 'target_array'] | None | {"Assign": 6, "Expr": 2, "With": 2} | 12 | 23 | 12 | ["np.random.rand", "Stats", "input_array.mean", "input_array.std", "np.random.rand", "Stats", "pytest.raises", "Normalize", "norm", "pytest.raises", "Normalize", "norm"] | 0 | [] | The function (test_normalize_empty_stats) defined within the public class called public.The function start at line 96 and ends at 118. It contains 21 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 12.0 functions, and It has 12... | |
CAREamics_careamics | public | public | 0 | 0 | test_get_stratified_coords | def test_get_stratified_coords(mask_pixel_perc, shape, num_iterations):"""Test the get_stratified_coords function.Ensure that the array of coordinates is randomly distributed across theimage and that most pixels get selected."""rng = np.random.default_rng(42)# Define the dummy arrayarray = np.zeros(shape)# Iterate over... | 4 | 12 | 3 | 132 | 3 | 24 | 61 | 24 | mask_pixel_perc,shape,num_iterations | ['rng', 'array', 'coords'] | None | {"Assign": 3, "AugAssign": 1, "Expr": 1, "For": 2} | 15 | 38 | 15 | ["np.random.default_rng", "np.zeros", "range", "_get_stratified_coords", "len", "len", "len", "all", "zip", "tuple", "T.tolist", "np.array", "np.sum", "np.sum", "pytest.mark.parametrize"] | 0 | [] | The function (test_get_stratified_coords) defined within the public class called public.The function start at line 24 and ends at 61. It contains 12 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [24.0] and does not return any value. It declares 15.0 functions, and It has ... |
CAREamics_careamics | public | public | 0 | 0 | test_uniform_manipulate | def test_uniform_manipulate(ordered_array, shape):"""Test the uniform_manipulate function.Ensures that the mask corresponds to the manipulated pixels, and that themanipulated pixels have a value taken from a ROI surrounding them."""rng = np.random.default_rng(42)# create the arraypatch = ordered_array(shape)# manipulat... | 3 | 21 | 2 | 179 | 7 | 65 | 108 | 65 | ordered_array,shape | ['mask_coords', 'diff_coords', 'roi', 'patch', 'slices', 'rng', 'coords'] | None | {"Assign": 8, "Expr": 1, "For": 1} | 16 | 44 | 16 | ["np.random.default_rng", "ordered_array", "uniform_manipulate", "np.array", "np.where", "np.array", "np.where", "np.array_equal", "range", "tuple", "slice", "max", "min", "range", "tuple", "pytest.mark.parametrize"] | 0 | [] | The function (test_uniform_manipulate) defined within the public class called public.The function start at line 65 and ends at 108. It contains 21 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [65.0] and does not return any value. It declares 16.0 functions, and It has 16... |
CAREamics_careamics | public | public | 0 | 0 | test_median_manipulate | def test_median_manipulate(ordered_array, shape):"""Test the uniform_manipulate function.Ensures that the mask corresponds to the manipulated pixels, and that themanipulated pixels have a value taken from a ROI surrounding them."""rng = np.random.default_rng(42)# create the arraypatch = ordered_array(shape).astype(np.f... | 3 | 20 | 2 | 198 | 7 | 112 | 155 | 112 | ordered_array,shape | ['mask_coords', 'diff_coords', 'roi', 'patch', 'slices', 'rng', 'coords'] | None | {"Assign": 9, "Expr": 1, "For": 1} | 20 | 44 | 20 | ["np.random.default_rng", "astype", "ordered_array", "median_manipulate", "np.array", "np.where", "np.array", "np.where", "np.array_equal", "range", "tuple", "slice", "max", "min", "range", "tuple", "tuple", "tuple", "np.median", "pytest.mark.parametrize"] | 0 | [] | The function (test_median_manipulate) defined within the public class called public.The function start at line 112 and ends at 155. It contains 20 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [112.0] and does not return any value. It declares 20.0 functions, and It has 2... |
CAREamics_careamics | public | public | 0 | 0 | test_apply_struct_mask | def test_apply_struct_mask(coords, struct_axis, struct_span):"""Test the uniform_manipulate function.Ensures that the mask corresponds to the manipulated pixels, and that themanipulated pixels have a value taken from a ROI surrounding them."""rng = np.random.default_rng(42)struct_params = StructMaskParameters(axis=stru... | 6 | 35 | 3 | 256 | 10 | 162 | 216 | 162 | coords,struct_axis,struct_span | ['transformed', 'struct_params', 'original_patch', 'patch', 'indices_to_mask', 'changed_values', 'rng', 'transform_patch', 'axis', 'coords'] | None | {"Assign": 11, "Expr": 3, "For": 1, "If": 2} | 19 | 55 | 19 | ["np.random.default_rng", "StructMaskParameters", "reshape", "np.arange", "patch.copy", "np.array", "_apply_struct_mask", "np.where", "range", "range", "max", "min", "transformed.append", "transformed.append", "np.array_equal", "np.sort", "np.sort", "np.concatenate", "pytest.mark.parametrize"] | 0 | [] | The function (test_apply_struct_mask) defined within the public class called public.The function start at line 162 and ends at 216. It contains 35 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [162.0] and does not return any value. It declares 19.0 functions, and It has 1... |
CAREamics_careamics | public | public | 0 | 0 | test_apply_struct_mask_3D | def test_apply_struct_mask_3D(coords, struct_axis, struct_span):"""Test the uniform_manipulate function.Ensures that the mask corresponds to the manipulated pixels, and that themanipulated pixels have a value taken from a ROI surrounding them."""rng = np.random.default_rng(42)struct_params = StructMaskParameters(axis=s... | 6 | 40 | 3 | 282 | 10 | 228 | 287 | 228 | coords,struct_axis,struct_span | ['transformed', 'struct_params', 'original_patch', 'patch', 'indices_to_mask', 'changed_values', 'rng', 'transform_patch', 'axis', 'coords'] | None | {"Assign": 11, "Expr": 3, "For": 1, "If": 2} | 19 | 60 | 19 | ["np.random.default_rng", "StructMaskParameters", "reshape", "np.arange", "patch.copy", "np.array", "_apply_struct_mask", "np.where", "range", "range", "max", "min", "transformed.append", "transformed.append", "np.array_equal", "np.sort", "np.sort", "np.concatenate", "pytest.mark.parametrize"] | 0 | [] | The function (test_apply_struct_mask_3D) defined within the public class called public.The function start at line 228 and ends at 287. It contains 40 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [228.0] and does not return any value. It declares 19.0 functions, and It ha... |
CAREamics_careamics | public | public | 0 | 0 | test_get_stratified_coords_torch | def test_get_stratified_coords_torch(mask_pixel_perc, shape, num_iterations):"""Test the get_stratified_coords function.Ensure that the array of coordinates is randomly distributed across theimage and that most pixels get selected."""rng = torch.Generator().manual_seed(42)# Define the dummy tensortensor = torch.zeros(s... | 3 | 13 | 3 | 129 | 4 | 294 | 332 | 294 | mask_pixel_perc,shape,num_iterations | ['tensor', 'indices', 'rng', 'coords'] | None | {"Assign": 4, "AugAssign": 1, "Expr": 1, "For": 2} | 17 | 39 | 17 | ["manual_seed", "torch.Generator", "torch.zeros", "range", "_get_stratified_coords_torch", "coords.numel", "len", "len", "all", "all", "torch.tensor", "tuple", "coords.T.tolist", "torch.sum", "torch.prod", "torch.tensor", "pytest.mark.parametrize"] | 0 | [] | The function (test_get_stratified_coords_torch) defined within the public class called public.The function start at line 294 and ends at 332. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [294.0] and does not return any value. It declares 17.0 functions, and... |
CAREamics_careamics | public | public | 0 | 0 | test_uniform_manipulate_torch | def test_uniform_manipulate_torch(ordered_array, shape):"""Test the uniform_manipulate function.Ensures that the mask corresponds to the manipulated pixels, and that themanipulated pixels have a value taken from a ROI surrounding them."""rng = torch.Generator().manual_seed(42)# Create the tensorpatch = torch.tensor(ord... | 3 | 21 | 2 | 192 | 7 | 336 | 379 | 336 | ordered_array,shape | ['mask_coords', 'diff_coords', 'roi', 'patch', 'slices', 'rng', 'coords'] | None | {"Assign": 8, "Expr": 1, "For": 1} | 17 | 44 | 17 | ["manual_seed", "torch.Generator", "torch.tensor", "ordered_array", "uniform_manipulate_torch", "torch.nonzero", "torch.nonzero", "torch.equal", "range", "tuple", "slice", "max", "min", "range", "tuple", "coords.tolist", "pytest.mark.parametrize"] | 0 | [] | The function (test_uniform_manipulate_torch) defined within the public class called public.The function start at line 336 and ends at 379. It contains 21 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [336.0] and does not return any value. It declares 17.0 functions, and I... |
CAREamics_careamics | public | public | 0 | 0 | test_median_manipulate_torch | def test_median_manipulate_torch(ordered_array, shape):"""Test the median_manipulate function.Ensures that the mask corresponds to the manipulated pixels, and that themanipulated pixels have a value taken from a ROI surrounding them."""rng = torch.Generator().manual_seed(42)# Create the tensorpatch = torch.from_numpy(o... | 4 | 20 | 2 | 236 | 8 | 383 | 425 | 383 | ordered_array,shape | ['diff_coords', 'mask_coords', 'roi', 'patch', 'subpatch_size', 'slices', 'rng', 'coords'] | None | {"Assign": 10, "Expr": 1, "For": 1, "If": 1} | 22 | 43 | 22 | ["manual_seed", "torch.Generator", "float", "torch.from_numpy", "ordered_array", "median_manipulate_torch", "torch.nonzero", "torch.nonzero", "torch.equal", "range", "slice", "slice", "max", "min", "range", "len", "tuple", "roi.numel", "torch.equal", "tuple", "torch.median", "pytest.mark.parametrize"] | 0 | [] | The function (test_median_manipulate_torch) defined within the public class called public.The function start at line 383 and ends at 425. It contains 20 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [383.0] and does not return any value. It declares 22.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_apply_struct_mask_torch | def test_apply_struct_mask_torch(patch_shape, coords, struct_axis, struct_span):"""Test the _apply_struct_mask function.Ensures that the mask corresponds to the manipulated pixels, and that themanipulated pixels have a value taken from a ROI surrounding them."""rng = torch.Generator().manual_seed(42)struct_params = Str... | 6 | 41 | 4 | 291 | 10 | 437 | 498 | 437 | patch_shape,coords,struct_axis,struct_span | ['transformed', 'struct_params', 'original_patch', 'patch', 'indices_to_mask', 'changed_values', 'rng', 'transform_patch', 'axis', 'coords'] | None | {"Assign": 11, "Expr": 3, "For": 1, "If": 2} | 23 | 62 | 23 | ["manual_seed", "torch.Generator", "StructMaskParameters", "float", "reshape", "torch.arange", "torch.prod", "torch.tensor", "patch.clone", "torch.tensor", "coords.unsqueeze", "_apply_struct_mask_torch", "range", "range", "max", "min", "transformed.append", "transformed.append", "torch.equal", "torch.sort", "torch.sort... | 0 | [] | The function (test_apply_struct_mask_torch) defined within the public class called public.The function start at line 437 and ends at 498. It contains 41 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [437.0] and does not return any value. It declares 23.0 functions, and It... |
CAREamics_careamics | public | public | 0 | 0 | test_apply_struct_mask_3D_torch | def test_apply_struct_mask_3D_torch(coords, struct_axis, struct_span):"""Test the _apply_struct_mask function.Ensures that the mask corresponds to the manipulated pixels, and that themanipulated pixels have a value taken from a ROI surrounding them."""rng = torch.Generator().manual_seed(42)struct_params = StructMaskPar... | 6 | 38 | 3 | 286 | 10 | 510 | 567 | 510 | coords,struct_axis,struct_span | ['transformed', 'struct_params', 'original_patch', 'patch', 'indices_to_mask', 'changed_values', 'rng', 'transform_patch', 'axis', 'coords'] | None | {"Assign": 11, "Expr": 3, "For": 1, "If": 2} | 21 | 58 | 21 | ["manual_seed", "torch.Generator", "StructMaskParameters", "float", "reshape", "torch.arange", "patch.clone", "torch.tensor", "coords.unsqueeze", "_apply_struct_mask_torch", "range", "range", "max", "min", "transformed.append", "transformed.append", "torch.equal", "torch.sort", "torch.sort", "torch.cat", "pytest.mark.p... | 0 | [] | The function (test_apply_struct_mask_3D_torch) defined within the public class called public.The function start at line 510 and ends at 567. It contains 38 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [510.0] and does not return any value. It declares 21.0 functions, and ... |
CAREamics_careamics | public | public | 0 | 0 | test_forward | def test_forward(shape):"""Test that the transformations are correct."""array = np.arange(np.prod(shape)).reshape(shape)tensor = torch.Tensor(array)tta = ImageRestorationTTA()augmented = tta.forward(tensor)assert len(augmented) == 8# check that the shape is the samefor aug in augmented:assert aug.shape == tensor.shape#... | 5 | 12 | 1 | 100 | 4 | 23 | 40 | 23 | shape | ['augmented', 'tensor', 'array', 'tta'] | None | {"Assign": 4, "Expr": 1, "For": 3, "If": 1} | 11 | 18 | 11 | ["reshape", "np.arange", "np.prod", "torch.Tensor", "ImageRestorationTTA", "tta.forward", "len", "enumerate", "enumerate", "torch.allclose", "pytest.mark.parametrize"] | 1 | ["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.69485146_mgaido91_fbk_fairseq_st.tests.speech_recognition.test_vggtransformer_py.VGGTransformerEncoderTest.test_forward"] | The function (test_forward) defined within the public class called public.The function start at line 23 and ends at 40. It contains 12 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 11.0 functions, It has 11.0 functions called ... |
CAREamics_careamics | public | public | 0 | 0 | test_same_transforms | def test_same_transforms(shape):"""Check that all arrays produced by the rotation and fliptransforms are generated by the TTA.Note that the transforms require no sample dimension."""array = np.arange(np.prod(shape)).reshape(shape)tensor = torch.Tensor(array)# apply forward transformationtta = ImageRestorationTTA()augme... | 3 | 11 | 1 | 108 | 6 | 54 | 76 | 54 | shape | ['augmented', 'array', 'flip', 'tensor', 'tta', 'rot'] | None | {"Assign": 8, "Expr": 1, "For": 1} | 15 | 23 | 15 | ["reshape", "np.arange", "np.prod", "torch.Tensor", "ImageRestorationTTA", "tta.forward", "XYRandomRotate90", "XYFlip", "range", "rot", "flip", "any", "torch.allclose", "torch.Tensor", "pytest.mark.parametrize"] | 0 | [] | The function (test_same_transforms) defined within the public class called public.The function start at line 54 and ends at 76. It contains 11 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 15.0 functions, and It has 15.0 func... |
CAREamics_careamics | public | public | 0 | 0 | test_backward | def test_backward(shape):"""Test that the backward transformation returns the original tensor."""array = np.arange(np.prod(shape)).reshape(shape)tensor = torch.Tensor(array)# apply forward transformationtta = ImageRestorationTTA()augmented = tta.forward(tensor)# apply backward transformationoriginal = tta.backward(augm... | 1 | 7 | 1 | 62 | 5 | 94 | 105 | 94 | shape | ['augmented', 'array', 'tensor', 'tta', 'original'] | None | {"Assign": 5, "Expr": 1} | 9 | 12 | 9 | ["reshape", "np.arange", "np.prod", "torch.Tensor", "ImageRestorationTTA", "tta.forward", "tta.backward", "torch.allclose", "pytest.mark.parametrize"] | 0 | [] | The function (test_backward) defined within the public class called public.The function start at line 94 and ends at 105. 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 9.0 functions, and It has 9.0 functions cal... |
CAREamics_careamics | public | public | 0 | 0 | test_p_wrong_values | def test_p_wrong_values():"""Test that an error is raised for wrong probability values."""with pytest.raises(ValueError):XYFlip(p=-1)with pytest.raises(ValueError):XYFlip(p=2) | 1 | 5 | 0 | 34 | 0 | 7 | 13 | 7 | [] | None | {"Expr": 3, "With": 2} | 4 | 7 | 4 | ["pytest.raises", "XYFlip", "pytest.raises", "XYFlip"] | 0 | [] | The function (test_p_wrong_values) defined within the public class called public.The function start at line 7 and ends at 13. 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 functions... | |
CAREamics_careamics | public | public | 0 | 0 | test_no_flip_error | def test_no_flip_error():"""Test that an error is raised if no axis is flippable."""with pytest.raises(ValueError):XYFlip(flip_x=False, flip_y=False) | 1 | 3 | 0 | 23 | 0 | 16 | 19 | 16 | [] | None | {"Expr": 2, "With": 1} | 2 | 4 | 2 | ["pytest.raises", "XYFlip"] | 0 | [] | The function (test_no_flip_error) defined within the public class called public.The function start at line 16 and ends at 19. 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_flip_xy | def test_flip_xy(ordered_array, shape):"""Test flipping for 2D and 3D arrays."""# create arrayarray: np.ndarray = ordered_array(shape)# create augmentationaug = XYFlip(p=1, seed=42)r = np.random.default_rng(seed=42)# potential flipsaxes = [-2, -1]flips = [np.flip(array, axis=axis) for axis in axes]# apply augmentation ... | 3 | 11 | 2 | 111 | 5 | 33 | 54 | 33 | ordered_array,shape | ['r', 'flips', 'axes', 'axis', 'aug'] | None | {"AnnAssign": 1, "Assign": 6, "Expr": 2, "For": 1} | 10 | 22 | 10 | ["ordered_array", "XYFlip", "np.random.default_rng", "np.flip", "range", "r.random", "aug", "r.choice", "np.array_equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_flip_xy) defined within the public class called public.The function start at line 33 and ends at 54. It contains 11 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [33.0] and does not return any value. It declares 10.0 functions, and It has 10.0 functions... |
CAREamics_careamics | public | public | 0 | 0 | test_additional_arrays_flip_xy | def test_additional_arrays_flip_xy(ordered_array, shape):"""Test flipping for 2D and 3D arrays."""# create arrayarray: np.ndarray = ordered_array(shape)additional_arrays = {"arr": ordered_array(shape)}# create augmentationaug = XYFlip(p=1, seed=42)r = np.random.default_rng(seed=42)# potential flipsaxes = [-2, -1]flips ... | 3 | 13 | 2 | 137 | 6 | 68 | 91 | 68 | ordered_array,shape | ['additional_arrays', 'r', 'flips', 'axes', 'axis', 'aug'] | None | {"AnnAssign": 1, "Assign": 7, "Expr": 2, "For": 1} | 12 | 24 | 12 | ["ordered_array", "ordered_array", "XYFlip", "np.random.default_rng", "np.flip", "range", "r.random", "aug", "r.choice", "np.array_equal", "np.array_equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_additional_arrays_flip_xy) defined within the public class called public.The function start at line 68 and ends at 91. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [68.0] and does not return any value. It declares 12.0 functions, and It ... |
CAREamics_careamics | public | public | 0 | 0 | test_flip_single_axis | def test_flip_single_axis(ordered_array, shape, flip_x):"""Test flipping for 2D and 3D arrays."""# create arrayarray: np.ndarray = ordered_array(shape)# create augmentationaug = XYFlip(flip_x=flip_x, flip_y=not flip_x, p=1)# potential flipsaxis = -1 if flip_x else -2# apply augmentation 5 timesfor _ in range(5):augment... | 3 | 7 | 3 | 81 | 2 | 109 | 124 | 109 | ordered_array,shape,flip_x | ['axis', 'aug'] | None | {"AnnAssign": 1, "Assign": 3, "Expr": 1, "For": 1} | 7 | 16 | 7 | ["ordered_array", "XYFlip", "range", "aug", "np.array_equal", "np.flip", "pytest.mark.parametrize"] | 0 | [] | The function (test_flip_single_axis) defined within the public class called public.The function start at line 109 and ends at 124. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [109.0] and does not return any value. It declares 7.0 functions, and It has 7.0 ... |
CAREamics_careamics | public | public | 0 | 0 | test_flip_mask | def test_flip_mask(ordered_array):"""Test flipping masks in 3D."""# create arrayarray = ordered_array((4, 2, 2, 2))mask = array[2:, ...]array = array[:2, ...]# create augmentationaug = XYFlip(p=1, seed=42)r = np.random.default_rng(seed=42)# potential flips on Y and X axesaxes = [-2, -1]array_flips = [np.flip(array, axi... | 4 | 15 | 1 | 168 | 8 | 127 | 150 | 127 | ordered_array | ['r', 'array', 'array_flips', 'mask', 'axes', 'axis', 'mask_flips', 'aug'] | None | {"Assign": 10, "Expr": 2, "For": 1} | 11 | 24 | 11 | ["ordered_array", "XYFlip", "np.random.default_rng", "np.flip", "np.flip", "range", "aug", "r.random", "r.choice", "np.array_equal", "np.array_equal"] | 0 | [] | The function (test_flip_mask) defined within the public class called public.The function start at line 127 and ends at 150. It contains 15 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 11.0 functions, and It has 11.0 function... |
CAREamics_careamics | public | public | 0 | 0 | test_p | def test_p(ordered_array):"""Test that the probability of flipping is respected."""# create arrayarray = ordered_array((2, 2, 2))# create augmentation that never appliesaug = XYFlip(p=0.0, seed=42)# apply augmentation 5 timesfor _ in range(5):augmented, *_ = aug(array)assert np.array_equal(augmented, array)# create aug... | 3 | 10 | 1 | 99 | 2 | 153 | 174 | 153 | ordered_array | ['aug', 'array'] | None | {"Assign": 5, "Expr": 1, "For": 2} | 9 | 22 | 9 | ["ordered_array", "XYFlip", "range", "aug", "np.array_equal", "XYFlip", "range", "aug", "np.array_equal"] | 0 | [] | The function (test_p) defined within the public class called public.The function start at line 153 and ends at 174. 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 9.0 functions, and It has 9.0 functions called i... |
CAREamics_careamics | public | public | 0 | 0 | test_xy_rotate | def test_xy_rotate(ordered_array, shape):"""Test rotation for 2D and 3D arrays with a fixed seed."""# create arrayarray = ordered_array(shape)# create augmentationaug = XYRandomRotate90(p=1, seed=42)r = np.random.default_rng(seed=42)axes = (2, 3) if len(array.shape) == 4 else (1, 2)rots = [np.rot90(array, k=1, axes=axe... | 3 | 14 | 2 | 152 | 5 | 18 | 39 | 18 | ordered_array,shape | ['r', 'array', 'rots', 'axes', 'aug'] | None | {"Assign": 6, "Expr": 2, "For": 1} | 13 | 22 | 13 | ["ordered_array", "XYRandomRotate90", "np.random.default_rng", "len", "np.rot90", "np.rot90", "np.rot90", "range", "r.random", "aug", "np.array_equal", "r.integers", "pytest.mark.parametrize"] | 0 | [] | The function (test_xy_rotate) defined within the public class called public.The function start at line 18 and ends at 39. It contains 14 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [18.0] and does not return any value. It declares 13.0 functions, and It has 13.0 functio... |
CAREamics_careamics | public | public | 0 | 0 | test_additional_arrays_xy_rotate | def test_additional_arrays_xy_rotate(ordered_array, shape):"""Test rotation for 2D and 3D arrays with a fixed seed."""# create arrayarray: np.ndarray = ordered_array(shape)additional_arrays = {"arr": ordered_array(shape)}# create augmentationaug = XYRandomRotate90(p=1, seed=42)r = np.random.default_rng(seed=42)axes = (... | 3 | 16 | 2 | 182 | 5 | 53 | 76 | 53 | ordered_array,shape | ['additional_arrays', 'r', 'rots', 'axes', 'aug'] | None | {"AnnAssign": 1, "Assign": 6, "Expr": 2, "For": 1} | 15 | 24 | 15 | ["ordered_array", "ordered_array", "XYRandomRotate90", "np.random.default_rng", "len", "np.rot90", "np.rot90", "np.rot90", "range", "r.random", "aug", "np.array_equal", "r.integers", "np.array_equal", "pytest.mark.parametrize"] | 0 | [] | The function (test_additional_arrays_xy_rotate) defined within the public class called public.The function start at line 53 and ends at 76. It contains 16 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [53.0] and does not return any value. It declares 15.0 functions, and I... |
CAREamics_careamics | public | public | 0 | 0 | test_mask_rotate | def test_mask_rotate(ordered_array):"""Test rotating masks in 3D."""aug = XYRandomRotate90(p=1, seed=42)r = np.random.default_rng(seed=42)# create arrayarray = ordered_array((4, 2, 2, 2))mask = array[2:, ...]array = array[:2, ...]# potential rotationsaxes = (2, 3)# 3Darray_rots = [np.rot90(array, k=1, axes=axes),np.rot... | 2 | 23 | 1 | 230 | 8 | 79 | 109 | 79 | ordered_array | ['r', 'array', 'array_rots', 'n_rot', 'mask', 'axes', 'aug', 'mask_rots'] | None | {"Assign": 10, "Expr": 2, "For": 1} | 15 | 31 | 15 | ["XYRandomRotate90", "np.random.default_rng", "ordered_array", "np.rot90", "np.rot90", "np.rot90", "np.rot90", "np.rot90", "np.rot90", "range", "r.random", "aug", "r.integers", "np.array_equal", "np.array_equal"] | 0 | [] | The function (test_mask_rotate) defined within the public class called public.The function start at line 79 and ends at 109. It contains 23 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 15.0 functions, and It has 15.0 functio... |
CAREamics_careamics | public | public | 0 | 0 | test_p | def test_p(ordered_array):"""Test that the probability of rotation is respected."""# create arrayarray = ordered_array((2, 2, 2))# create augmentationaug = XYRandomRotate90(p=0.0, seed=42)# apply augmentation 5 timesfor _ in range(5):augmented, *_ = aug(array)assert np.array_equal(augmented, array)# create augmentation... | 3 | 10 | 1 | 99 | 2 | 112 | 133 | 112 | ordered_array | ['aug', 'array'] | None | {"Assign": 5, "Expr": 1, "For": 2} | 9 | 22 | 9 | ["ordered_array", "XYRandomRotate90", "range", "aug", "np.array_equal", "XYRandomRotate90", "range", "aug", "np.array_equal"] | 0 | [] | The function (test_p) defined within the public class called public.The function start at line 112 and ends at 133. 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 9.0 functions, and It has 9.0 functions called i... |
CAREamics_careamics | public | public | 0 | 0 | test_autocorrelation | def test_autocorrelation():"""Test that the autocorrelation is normalized to the zero-shift value and that thisvalue is centered."""rng = np.random.default_rng(42)# create a random imageimage = rng.random((5, 5))center = 2# compute autocorrelationautocorr = autocorrelation(image)assert autocorr.shape == image.shape# ch... | 1 | 8 | 0 | 87 | 4 | 6 | 23 | 6 | ['autocorr', 'rng', 'center', 'image'] | None | {"Assign": 4, "Expr": 1} | 6 | 18 | 6 | ["np.random.default_rng", "rng.random", "autocorrelation", "np.isclose", "autocorr.max", "np.isclose"] | 0 | [] | The function (test_autocorrelation) defined within the public class called public.The function start at line 6 and ends at 23. 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 6.0 functions, and It has 6.0 function... | |
CAREamics_careamics | public | public | 0 | 0 | test_correlation | def test_correlation():"""Test the autocorrelation of an image with bands."""image = np.zeros((10, 10))for i in range(image.shape[0]):if i % 2 == 0:image[i] = 1# compute autocorrelationautocorr = autocorrelation(image)assert autocorr.shape == image.shape# check that each band maximizes the autocorrelationfor i in range... | 5 | 12 | 0 | 108 | 2 | 26 | 42 | 26 | ['autocorr', 'image'] | None | {"Assign": 3, "Expr": 1, "For": 2, "If": 2} | 6 | 17 | 6 | ["np.zeros", "range", "autocorrelation", "range", "np.allclose", "np.allclose"] | 0 | [] | The function (test_correlation) defined within the public class called public.The function start at line 26 and ends at 42. It contains 12 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 6.0 functions, and It has 6.0 functions ... | |
CAREamics_careamics | public | public | 0 | 0 | test_base_enum | def test_base_enum():"""Test that BaseEnum allows the `in` operator with values."""assert "b" in MyEnum | 1 | 2 | 0 | 9 | 0 | 10 | 12 | 10 | [] | None | {"Expr": 1} | 0 | 3 | 0 | [] | 0 | [] | The function (test_base_enum) defined within the public class called public.The function start at line 10 and ends at 12. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value.. | |
CAREamics_careamics | public | public | 0 | 0 | test_cwd | def test_cwd(tmp_path: Path):"""Test cwd context manager."""current_path = Path(".").absolute()assert current_path != tmp_path.absolute()# change contextwith cwd(tmp_path):assert Path(".").absolute() == tmp_path.absolute()# create a filefile_path = Path("test.txt")file_path.touch()assert Path(tmp_path, "test.txt").abso... | 1 | 9 | 1 | 84 | 2 | 6 | 21 | 6 | tmp_path | ['file_path', 'current_path'] | None | {"Assign": 2, "Expr": 2, "With": 1} | 14 | 16 | 14 | ["absolute", "Path", "tmp_path.absolute", "cwd", "absolute", "Path", "tmp_path.absolute", "Path", "file_path.touch", "exists", "absolute", "Path", "absolute", "Path"] | 0 | [] | The function (test_cwd) defined within the public class called public.The function start at line 6 and ends at 21. 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 14.0 functions, and It has 14.0 functions called i... |
CAREamics_careamics | public | public | 0 | 0 | test_read_logger | def test_read_logger(tmp_path, minimum_n2v_configuration):config = Configuration(**minimum_n2v_configuration)config.training_config.lightning_trainer_config = {"max_epochs": 10}array = np.arange(32 * 32).reshape((32, 32))with cwd(tmp_path):careamist = CAREamist(config)careamist.train(train_source=array)losses = read_cs... | 2 | 14 | 2 | 107 | 4 | 11 | 29 | 11 | tmp_path,minimum_n2v_configuration | ['config', 'careamist', 'losses', 'array'] | None | {"Assign": 5, "Expr": 1, "For": 1, "With": 1} | 9 | 19 | 9 | ["Configuration", "reshape", "np.arange", "cwd", "CAREamist", "careamist.train", "read_csv_logger", "len", "len"] | 0 | [] | The function (test_read_logger) defined within the public class called public.The function start at line 11 and ends at 29. It contains 14 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [11.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_get_logger | def test_get_logger(tmp_path: Path):logger = get_logger("test", log_path=tmp_path / "test.log")logger.info("test")assert (tmp_path / "test.log").exists() | 1 | 4 | 1 | 35 | 1 | 8 | 11 | 8 | tmp_path | ['logger'] | None | {"Assign": 1, "Expr": 1} | 3 | 4 | 3 | ["get_logger", "logger.info", "exists"] | 0 | [] | The function (test_get_logger) defined within the public class called public.The function start at line 8 and ends at 11. 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 functions cal... |
CAREamics_careamics | public | public | 0 | 0 | test_progress_bar_update | def test_progress_bar_update(max_value, epoch, num_epochs, mode):progress_bar = ProgressBar(max_value=max_value, epoch=epoch, num_epochs=num_epochs, mode=mode)for step in range(2):progress_bar.update(step, batch_size=1)assert progress_bar._seen_so_far == stepif progress_bar.max_value is not None:assert progress_bar.spi... | 3 | 11 | 4 | 78 | 1 | 18 | 29 | 18 | max_value,epoch,num_epochs,mode | ['progress_bar'] | None | {"Assign": 1, "Expr": 1, "For": 1, "If": 1} | 5 | 12 | 5 | ["ProgressBar", "range", "progress_bar.update", "next", "pytest.mark.parametrize"] | 0 | [] | The function (test_progress_bar_update) defined within the public class called public.The function start at line 18 and ends at 29. It contains 11 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [18.0] and does not return any value. It declares 5.0 functions, and It has 5.0... |
CAREamics_careamics | public | public | 0 | 0 | test_zero_mean | def test_zero_mean(x: np.ndarray):assert np.allclose(_zero_mean(x), x - x.mean()) | 1 | 2 | 1 | 27 | 0 | 28 | 29 | 28 | x | [] | None | {} | 8 | 2 | 8 | ["np.allclose", "_zero_mean", "x.mean", "pytest.mark.parametrize", "np.array", "np.array", "torch.tensor", "torch.tensor"] | 0 | [] | The function (test_zero_mean) defined within the public class called public.The function start at line 28 and ends at 29. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 8.0 functions, and It has 8.0 functions cal... |
CAREamics_careamics | public | public | 0 | 0 | test_scale_invariant_psnr | def test_scale_invariant_psnr(gt: np.ndarray, pred: np.ndarray, result: float):assert scale_invariant_psnr(gt, pred) == pytest.approx(result, rel=5e-3) | 1 | 2 | 3 | 39 | 0 | 40 | 41 | 40 | gt,pred,result | [] | None | {} | 7 | 2 | 7 | ["scale_invariant_psnr", "pytest.approx", "pytest.mark.parametrize", "np.array", "np.array", "np.array", "np.array"] | 0 | [] | The function (test_scale_invariant_psnr) defined within the public class called public.The function start at line 40 and ends at 41. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [40.0] and does not return any value. It declares 7.0 functions, and It has 7.0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.