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
stitch_predictions
def stitch_predictions(predictions, dset, smoothening_pixelcount=0):"""Args:smoothening_pixelcount: number of pixels which can be interpolated"""assert smoothening_pixelcount >= 0 and isinstance(smoothening_pixelcount, int)extra_padding = dset.per_side_overlap_pixelcount()# if there are more channels, use all of them.s...
6
33
3
244
8
754
800
754
predictions,dset,smoothening_pixelcount
['output', 'extra_padding', 'shape', 'cropped_pred_list', 'mask', 'cropped_pred_i', 'frame_shape', 'loc']
Returns
{"Assign": 11, "AugAssign": 1, "Expr": 2, "For": 3, "If": 1, "Return": 1}
14
47
14
["isinstance", "dset.per_side_overlap_pixelcount", "list", "dset.get_data_shape", "max", "np.zeros", "dset.get_data_shape", "range", "get_location_from_idx", "range", "remove_pad", "cropped_pred_list.append", "update_loc_for_final_insertion", "range"]
0
[]
The function (stitch_predictions) defined within the public class called public.The function start at line 754 and ends at 800. It contains 33 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [754.0], and this function return a value. It declares 14.0 functions, and It has 1...
CAREamics_careamics
public
public
0
0
stitch_predictions_new
def stitch_predictions_new(predictions, dset):"""Args:smoothening_pixelcount: number of pixels which can be interpolated"""# Commented out since it is not used as of now# if isinstance(dset, MultiFileDset):# cum_count = 0# output = []# for dset in dset.dsets:# cnt = dset.idx_manager.total_grid_count()# output.append(# ...
11
35
2
436
11
804
884
804
predictions,dset
['output', 'gs', 'pe', 'rs', 'shape', 'vgs', 'mng', 'ge', 'ps', 're', 'vge']
Returns
{"Assign": 16, "Expr": 1, "For": 3, "If": 5, "Return": 1}
19
81
19
["list", "dset.get_data_shape", "max", "np.zeros", "range", "np.array", "mng.get_location_from_dataset_idx", "mng.patch_offset", "np.array", "max", "np.array", "min", "zip", "range", "len", "range", "len", "len", "ValueError"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.get_single_file_predictions"]
The function (stitch_predictions_new) defined within the public class called public.The function start at line 804 and ends at 884. It contains 35 lines of code and it has a cyclomatic complexity of 11. It takes 2 parameters, represented as [804.0], and this function return a value. It declares 19.0 functions, It has 1...
CAREamics_careamics
public
public
0
0
stitch_predictions_general
def stitch_predictions_general(predictions, dset):"""Stitching for the dataset with multiple files of different shape."""mng = dset.idx_manager# TODO assert all shapes are equal len# adjust number of channels to match with prediction shape #TODO ugly, refac!shapes = []for shape in dset.get_data_shapes()[0]:shapes.appen...
13
58
2
471
13
887
965
887
predictions,dset
['patch_end', 'output', 'sample_idx', 'shapes', 'valid_grid_start', 'relative_start', 'grid_start', 'mng', 'patch_start', 'valid_grid_end', 'grid_coords', 'relative_end', 'grid_end']
Returns
{"Assign": 17, "Expr": 2, "For": 4, "If": 5, "Return": 1}
18
79
18
["dset.get_data_shapes", "shapes.append", "np.zeros", "range", "np.array", "mng.get_location_from_patch_idx", "mng.patch_offset", "np.array", "max", "np.array", "min", "zip", "range", "len", "range", "len", "len", "ValueError"]
0
[]
The function (stitch_predictions_general) defined within the public class called public.The function start at line 887 and ends at 965. It contains 58 lines of code and it has a cyclomatic complexity of 13. It takes 2 parameters, represented as [887.0], and this function return a value. It declares 18.0 functions, and ...
CAREamics_careamics
public
public
0
0
_init_config
def _init_config():"""Create a default config object with all the required fields."""config = ml_collections.ConfigDict()config.data = ml_collections.ConfigDict()config.model = ml_collections.ConfigDict()config.loss = ml_collections.ConfigDict()config.training = ml_collections.ConfigDict()config.workdir = os.getcwd()co...
1
9
0
64
1
13
29
13
['config']
Returns
{"Assign": 7, "Expr": 1, "Return": 1}
6
17
6
["ml_collections.ConfigDict", "ml_collections.ConfigDict", "ml_collections.ConfigDict", "ml_collections.ConfigDict", "ml_collections.ConfigDict", "os.getcwd"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.get_config_py.get_config"]
The function (_init_config) defined within the public class called public.The function start at line 13 and ends at 29. It contains 9 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declares 6.0 functions, It has 6.0 functions called...
CAREamics_careamics
public
public
0
0
get_config
def get_config():config = _init_config()data = config.datadata.image_size = 128# the patch size# data.grid_size = 32 # the retained sub-patch when doing inner tilingdata.multiscale_lowres_count = (None# todo: this one will be an issue in current careamics)data.num_channels = 2# in careamics probably in lvae pydantic mo...
1
44
0
210
5
32
84
32
['config', 'training', 'model', 'loss', 'data']
Returns
{"Assign": 36, "Return": 1}
1
53
1
["_init_config"]
83
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3584344_influxgraph_influxgraph.influxgraph._version_py.get_versions", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3649567_noirello_bonsai.tests.conftest_py.basedn", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Cr...
The function (get_config) defined within the public class called public.The function start at line 32 and ends at 84. It contains 44 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declare 1.0 function, It has 1.0 function called ins...
CAREamics_careamics
LadderVAELight
public
0
1
__init__
def __init__(self,config: ml_collections.ConfigDict,data_mean: Dict[str, torch.Tensor],data_std: Dict[str, torch.Tensor],target_ch: int,):"""Here we will do the following:- initialize the model (from LadderVAE class)- initialize the parameters related to the training and loss.NOTE:Some of the model attributes are defin...
4
53
5
351
0
28
113
28
self,config,data_mean,data_std,target_ch
[]
None
{"Assign": 34, "Expr": 2, "If": 2}
8
86
8
["__init__", "super", "LadderVAE", "config.model.get", "mode", "MetricMonitor", "RunningPSNR", "range"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called LadderVAELight, that inherit another class.The function start at line 28 and ends at 113. It contains 53 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [28.0] and does not return any value. It declares 8.0 funct...
CAREamics_careamics
LadderVAELight
public
0
1
forward
def forward(self, x: Any) -> Any:return self.model(x)
1
2
2
18
0
115
116
115
self,x
[]
Any
{"Return": 1}
1
2
1
["self.model"]
54
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3646986_mapbox_mapbox_sdk_py.tests.test_geocoder_py.test_geocoder_forward", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3646986_mapbox_mapbox_sdk_py.tests.test_geocoder_py.test_geocoder_forward_bbox", "_.content.g...
The function (forward) defined within the public class called LadderVAELight, that inherit another class.The function start at line 115 and ends at 116. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [115.0] and does not return any value. It declare 1.0 functi...
CAREamics_careamics
LadderVAELight
public
0
1
training_step
def training_step(self, batch: torch.Tensor, batch_idx: int, enable_logging: bool = True) -> Dict[str, torch.Tensor]:if self.current_epoch == 0 and batch_idx == 0:self.log("val_psnr", 1.0, on_epoch=True)# Pre-processing of inputsx, target = batch[:2]self.set_params_to_same_device_as(x)x_normalized = self.normalize_inpu...
19
93
4
647
0
118
239
118
self,batch,batch_idx,enable_logging
[]
Dict[str, torch.Tensor]
{"Assign": 27, "Expr": 9, "For": 1, "If": 12, "Return": 2}
37
122
37
["self.log", "self.set_params_to_same_device_as", "self.normalize_input", "repeat", "self.normalize_target", "all", "reshape", "len", "self.forward", "F.center_crop", "self.get_reconstruction_loss", "any", "torch.isnan", "cuda", "torch.Tensor", "LossType.name", "self.get_kl_divergence_loss", "self.get_kl_divergence_los...
0
[]
The function (training_step) defined within the public class called LadderVAELight, that inherit another class.The function start at line 118 and ends at 239. It contains 93 lines of code and it has a cyclomatic complexity of 19. It takes 4 parameters, represented as [118.0] and does not return any value. It declares 3...
CAREamics_careamics
LadderVAELight
public
0
1
validation_step
def validation_step(self, batch: torch.Tensor, batch_idx: int):# Pre-processing of inputsx, target = batch[:2]self.set_params_to_same_device_as(x)x_normalized = self.normalize_input(x)if self.reconstruction_mode:# only for experimental purposetarget_normalized = x_normalized[:, :1].repeat(1, 2, 1, 1)target = Nonemask =...
9
51
3
404
0
241
303
241
self,batch,batch_idx
[]
None
{"Assign": 21, "Expr": 5, "For": 1, "If": 6, "Return": 1}
24
63
24
["self.set_params_to_same_device_as", "self.normalize_input", "repeat", "self.normalize_target", "all", "reshape", "len", "self.forward", "out.chunk", "F.center_crop", "self.reconstruction_loss_musplit_denoisplit", "self.get_reconstruction_loss", "range", "update", "RangeInvariantPsnr", "clone", "clone", "channels_rinv...
0
[]
The function (validation_step) defined within the public class called LadderVAELight, that inherit another class.The function start at line 241 and ends at 303. It contains 51 lines of code and it has a cyclomatic complexity of 9. It takes 3 parameters, represented as [241.0] and does not return any value. It declares ...
CAREamics_careamics
LadderVAELight
public
0
1
on_validation_epoch_end
def on_validation_epoch_end(self):psnr_arr = []for i in range(len(self.channels_psnr)):psnr = self.channels_psnr[i].get()if psnr is None:psnr_arr = Nonebreakpsnr_arr.append(psnr.cpu().numpy())self.channels_psnr[i].reset()if psnr_arr is not None:psnr = np.mean(psnr_arr)self.log("val_psnr", psnr, on_epoch=True)else:self....
5
17
1
146
0
322
340
322
self
[]
None
{"Assign": 5, "Expr": 5, "For": 1, "If": 3}
12
19
12
["range", "len", "get", "psnr_arr.append", "numpy", "psnr.cpu", "reset", "np.mean", "self.log", "self.log", "max", "self.log"]
0
[]
The function (on_validation_epoch_end) defined within the public class called LadderVAELight, that inherit another class.The function start at line 322 and ends at 340. It contains 17 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 decla...
CAREamics_careamics
LadderVAELight
public
0
1
predict_step
def predict_step(self, batch: torch.Tensor, batch_idx: Any) -> Any:raise NotImplementedError("predict_step is not implemented")
1
2
3
22
0
342
343
342
self,batch,batch_idx
[]
Any
{}
1
2
1
["NotImplementedError"]
0
[]
The function (predict_step) defined within the public class called LadderVAELight, that inherit another class.The function start at line 342 and ends at 343. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [342.0] and does not return any value. It declare 1.0 f...
CAREamics_careamics
LadderVAELight
public
0
1
configure_optimizers
def configure_optimizers(self):optimizer = torch.optim.Adamax(self.parameters(), lr=self.lr, weight_decay=0)scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer,self.lr_scheduler_mode,patience=self.lr_scheduler_patience,factor=0.5,min_lr=1e-12,verbose=True,)return {"optimizer": optimizer,"lr_scheduler": sch...
1
15
1
85
0
345
360
345
self
[]
Returns
{"Assign": 2, "Return": 1}
3
16
3
["torch.optim.Adamax", "self.parameters", "torch.optim.lr_scheduler.ReduceLROnPlateau"]
0
[]
The function (configure_optimizers) defined within the public class called LadderVAELight, that inherit another class.The function start at line 345 and ends at 360. It contains 15 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It decl...
CAREamics_careamics
LadderVAELight
public
0
1
get_reconstruction_loss
def get_reconstruction_loss(self,reconstruction: torch.Tensor,target: torch.Tensor,input: torch.Tensor,splitting_mask: torch.Tensor = None,return_predicted_img: bool = False,likelihood_obj: LikelihoodModule = None,) -> Dict[str, torch.Tensor]:"""Parameters----------reconstruction: torch.Tensor,target: torch.Tensorinput...
6
32
7
214
0
363
411
363
self,reconstruction,target,input,splitting_mask,return_predicted_img,likelihood_obj
[]
Dict[str, torch.Tensor]
{"Assign": 7, "Expr": 1, "For": 1, "If": 3, "Return": 2}
10
49
10
["self._get_reconstruction_loss_vector", "bool", "torch.ones_like", "sum", "len", "range", "sum", "len", "torch.mean", "len"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_py._reconstruction_loss_musplit_denoisplit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_...
The function (get_reconstruction_loss) defined within the public class called LadderVAELight, that inherit another class.The function start at line 363 and ends at 411. It contains 32 lines of code and it has a cyclomatic complexity of 6. It takes 7 parameters, represented as [363.0] and does not return any value. It d...
CAREamics_careamics
LadderVAELight
public
0
1
_get_reconstruction_loss_vector
def _get_reconstruction_loss_vector(self,reconstruction: torch.Tensor,target: torch.Tensor,input: torch.Tensor,return_predicted_img: bool = False,likelihood_obj: LikelihoodModule = None,):"""Parameters----------return_predicted_img: boolIf set to `True`, the besides the loss, the reconstructed image is also returned.De...
16
75
6
521
0
413
508
413
self,reconstruction,target,input,return_predicted_img,likelihood_obj
[]
Returns
{"Assign": 20, "Expr": 1, "For": 2, "If": 8, "Return": 2}
11
96
11
["range", "likelihood_obj", "self._get_weighted_likelihood", "compute_batch_mean", "range", "compute_batch_mean", "self.get_mixed_prediction", "self.model.likelihood.log_likelihood", "compute_batch_mean", "NotImplementedError", "compute_exclusion_loss"]
0
[]
The function (_get_reconstruction_loss_vector) defined within the public class called LadderVAELight, that inherit another class.The function start at line 413 and ends at 508. It contains 75 lines of code and it has a cyclomatic complexity of 16. It takes 6 parameters, represented as [413.0], and this function return ...
CAREamics_careamics
LadderVAELight
public
0
1
reconstruction_loss_musplit_denoisplit
def reconstruction_loss_musplit_denoisplit(self, out, target_normalized):if self.model.predict_logvar is not None:out_mean, _ = out.chunk(2, dim=1)else:out_mean = outrecons_loss_nm = (-1 * self.model.likelihood_NM(out_mean, target_normalized)[0].mean())recons_loss_gm = -1 * self.model.likelihood_gm(out, target_normaliz...
2
13
3
101
0
510
523
510
self,out,target_normalized
[]
Returns
{"Assign": 5, "If": 1, "Return": 1}
5
14
5
["out.chunk", "mean", "self.model.likelihood_NM", "mean", "self.model.likelihood_gm"]
0
[]
The function (reconstruction_loss_musplit_denoisplit) defined within the public class called LadderVAELight, that inherit another class.The function start at line 510 and ends at 523. It contains 13 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [510.0], and this function r...
CAREamics_careamics
LadderVAELight
public
0
1
_get_weighted_likelihood
def _get_weighted_likelihood(self, ll):"""Each of the channels gets multiplied with a different weight."""if self.ch1_recons_w == 1 and self.ch2_recons_w == 1:return llassert ll.shape[1] == 2, "This function is only for 2 channel images"mask1 = torch.zeros((len(ll), ll.shape[1], 1, 1), device=ll.device)mask1[:, 0] = 1m...
3
9
2
126
0
525
539
525
self,ll
[]
Returns
{"Assign": 4, "Expr": 1, "If": 1, "Return": 2}
4
15
4
["torch.zeros", "len", "torch.zeros", "len"]
0
[]
The function (_get_weighted_likelihood) defined within the public class called LadderVAELight, that inherit another class.The function start at line 525 and ends at 539. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [525.0], and this function return a value. ...
CAREamics_careamics
LadderVAELight
public
0
1
get_kl_weight
def get_kl_weight(self):"""KL loss can be weighted depending whether any annealing procedure is used.This function computes the weight of the KL loss in case of annealing."""if self.kl_annealing == True:# calculate relative weightkl_weight = (self.current_epoch - self.kl_start) * (1.0 / self.kl_annealtime)# clamp to [0...
4
13
1
87
0
541
561
541
self
[]
Returns
{"Assign": 4, "Expr": 1, "If": 3, "Return": 2}
2
21
2
["min", "max"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_py.denoisplit_loss", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_py.hdn_loss", "_.content...
The function (get_kl_weight) defined within the public class called LadderVAELight, that inherit another class.The function start at line 541 and ends at 561. It contains 13 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters, and this function return a value. It declares 2....
CAREamics_careamics
LadderVAELight
public
0
1
get_kl_divergence_loss_usplit
def get_kl_divergence_loss_usplit(self, topdown_layer_data_dict: Dict[str, torch.Tensor]) -> torch.Tensor:""" """kl = torch.cat([kl_layer.unsqueeze(1) for kl_layer in topdown_layer_data_dict["kl"]], dim=1)# NOTE: kl.shape = (16,4) 16 is batch size. 4 is number of layers.# Values are sum() and so are of the order 30000#...
3
12
2
115
0
563
585
563
self,topdown_layer_data_dict
[]
torch.Tensor
{"Assign": 5, "Expr": 1, "For": 1, "Return": 1}
6
23
6
["torch.cat", "kl_layer.unsqueeze", "range", "np.prod", "mean", "free_bits_kl"]
0
[]
The function (get_kl_divergence_loss_usplit) defined within the public class called LadderVAELight, that inherit another class.The function start at line 563 and ends at 585. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [563.0] and does not return any value...
CAREamics_careamics
LadderVAELight
public
0
1
get_kl_divergence_loss
def get_kl_divergence_loss(self, topdown_layer_data_dict, kl_key="kl"):"""kl[i] for each i has length batch_sizeresulting kl shape: (batch_size, layers)"""kl = torch.cat([kl_layer.unsqueeze(1) for kl_layer in topdown_layer_data_dict[kl_key]],dim=1,)# As compared to uSplit kl divergence,# more by a factor of 4 just beca...
2
8
3
69
0
587
608
587
self,topdown_layer_data_dict,kl_key
[]
Returns
{"Assign": 3, "Expr": 1, "Return": 1}
5
22
5
["torch.cat", "kl_layer.unsqueeze", "sum", "free_bits_kl", "np.prod"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_py._get_kl_divergence_loss_denoisplit", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_py._g...
The function (get_kl_divergence_loss) defined within the public class called LadderVAELight, that inherit another class.The function start at line 587 and ends at 608. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [587.0], and this function return a value. It...
CAREamics_careamics
LadderVAELight
public
0
1
normalize_input
def normalize_input(self, x):if self.model.normalized_input:return xreturn (x - self.data_mean["input"].mean()) / self.data_std["input"].mean()
2
4
2
42
0
611
614
611
self,x
[]
Returns
{"If": 1, "Return": 2}
2
4
2
["mean", "mean"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3719451_ethereum_pyrlp.tests.core.test_json_py.normalize_input", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70555013_embeddings_benchmark_mteb.mteb.models.jina_models_py.JinaV4Wrapper.score_single_vector", "_.con...
The function (normalize_input) defined within the public class called LadderVAELight, that inherit another class.The function start at line 611 and ends at 614. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [611.0], and this function return a value. It declar...
CAREamics_careamics
LadderVAELight
public
0
1
normalize_target
def normalize_target(self, target, batch=None):return (target - self.data_mean["target"]) / self.data_std["target"]
1
2
3
29
0
616
617
616
self,target,batch
[]
Returns
{"Return": 1}
0
2
0
[]
0
[]
The function (normalize_target) defined within the public class called LadderVAELight, that inherit another class.The function start at line 616 and ends at 617. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [616.0], and this function return a value..
CAREamics_careamics
LadderVAELight
public
0
1
unnormalize_target
def unnormalize_target(self, target_normalized):return target_normalized * self.data_std["target"] + self.data_mean["target"]
1
2
2
23
0
619
620
619
self,target_normalized
[]
Returns
{"Return": 1}
0
2
0
[]
0
[]
The function (unnormalize_target) defined within the public class called LadderVAELight, that inherit another class.The function start at line 619 and ends at 620. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [619.0], and this function return a value..
CAREamics_careamics
LadderVAELight
public
0
1
global_step
def global_step(self) -> int:"""Global step."""return self._global_step
1
2
1
12
0
640
642
640
self
[]
int
{"Expr": 1, "Return": 1}
0
3
0
[]
0
[]
The function (global_step) defined within the public class called LadderVAELight, that inherit another class.The function start at line 640 and ends at 642. 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
LadderVAELight
public
0
1
increment_global_step
def increment_global_step(self):"""Increments global step by 1."""self._global_step += 1
1
2
1
11
0
644
646
644
self
[]
None
{"AugAssign": 1, "Expr": 1}
0
3
0
[]
0
[]
The function (increment_global_step) defined within the public class called LadderVAELight, that inherit another class.The function start at line 644 and ends at 646. 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
LadderVAELight
public
0
1
set_params_to_same_device_as
def set_params_to_same_device_as(self, correct_device_tensor: torch.Tensor):self.model.likelihood.set_params_to_same_device_as(correct_device_tensor)if isinstance(self.data_mean, torch.Tensor):if self.data_mean.device != correct_device_tensor.device:self.data_mean = self.data_mean.to(correct_device_tensor.device)self.d...
6
11
2
139
0
648
659
648
self,correct_device_tensor
[]
None
{"Assign": 4, "Expr": 1, "For": 1, "If": 4}
8
12
8
["self.model.likelihood.set_params_to_same_device_as", "isinstance", "self.data_mean.to", "self.data_std.to", "isinstance", "self.data_mean.items", "v.to", "to"]
0
[]
The function (set_params_to_same_device_as) defined within the public class called LadderVAELight, that inherit another class.The function start at line 648 and ends at 659. It contains 11 lines of code and it has a cyclomatic complexity of 6. It takes 2 parameters, represented as [648.0] and does not return any value....
CAREamics_careamics
LadderVAELight
public
0
1
get_mixed_prediction
def get_mixed_prediction(self, prediction, prediction_logvar, data_mean, data_std, channel_weights=None):pred_unorm = prediction * data_std["target"] + data_mean["target"]if channel_weights is None:channel_weights = 1if self._input_is_sum:mixed_prediction = torch.sum(pred_unorm * channel_weights, dim=1, keepdim=True)el...
8
35
6
234
0
661
701
661
self,prediction,prediction_logvar,data_mean,data_std,channel_weights
[]
Returns
{"Assign": 12, "AugAssign": 1, "For": 1, "If": 5, "Return": 1}
9
41
9
["torch.sum", "torch.mean", "mean", "mean", "torch.all", "torch.exp", "torch.square", "range", "torch.log"]
0
[]
The function (get_mixed_prediction) defined within the public class called LadderVAELight, that inherit another class.The function start at line 661 and ends at 701. It contains 35 lines of code and it has a cyclomatic complexity of 8. It takes 6 parameters, represented as [661.0], and this function return a value. It ...
CAREamics_careamics
RunningPSNR
public
0
0
__init__
def __init__(self):# number of elements seen so far during the epochself.N = None# running sum of the MSE over the self.N elements seen so farself.mse_sum = None# running max and min values of the self.N target images seen so farself.max = self.min = Noneself.reset()
1
5
1
29
0
19
26
19
self
[]
None
{"Assign": 3, "Expr": 1}
1
8
1
["self.reset"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called RunningPSNR.The function start at line 19 and ends at 26. It contains 5 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 function, It has 1.0 function called insid...
CAREamics_careamics
RunningPSNR
public
0
0
reset
def reset(self):"""Used to reset the running PSNR (usually called at the end of each epoch)."""self.mse_sum = 0self.N = 0self.max = self.min = None
1
4
1
25
0
28
34
28
self
[]
None
{"Assign": 3, "Expr": 1}
0
7
0
[]
21
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3547924_wavecomp_git_repo.main_py._BasicAuthHandler.http_error_auth_reqed", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3547924_wavecomp_git_repo.main_py._DigestAuthHandler.http_error_auth_reqed", "_.content.gdriv...
The function (reset) defined within the public class called RunningPSNR.The function start at line 28 and ends at 34. 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 has 21.0 functions calling this function which are ["_.co...
CAREamics_careamics
RunningPSNR
public
0
0
update
def update(self, rec: torch.Tensor, tar: torch.Tensor) -> None:"""Given a batch of reconstructed and target images, it updates the MSE and.Parameters----------rec: torch.TensorBatch of reconstructed images (B, H, W).tar: torch.TensorBatch of target images (B, H, W)."""ins_max = torch.max(tar).item()ins_min = torch.min(...
2
14
3
155
0
36
60
36
self,rec,tar
[]
None
{"Assign": 8, "AugAssign": 2, "Expr": 1, "If": 1}
13
25
13
["item", "torch.max", "item", "torch.min", "max", "min", "torch.mean", "mse.view", "len", "torch.nansum", "len", "torch.sum", "torch.isnan"]
409
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3468756_plone_plone_app_cmsui.src.plone.app.cmsui.addmenu_py.AddNewContentForm.update", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3508200_spiral_project_daybed.daybed.backends.memory.__init___py.MemoryBackend.pu...
The function (update) defined within the public class called RunningPSNR.The function start at line 36 and ends at 60. It contains 14 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [36.0] and does not return any value. It declares 13.0 functions, It has 13.0 functions calle...
CAREamics_careamics
RunningPSNR
public
0
0
get
def get(self):"""The get the actual PSNR value given the running statistics."""if self.N == 0 or self.N is None:return Nonermse = torch.sqrt(self.mse_sum / self.N)return 20 * torch.log10((self.max - self.min) / rmse)
3
5
1
54
0
62
69
62
self
[]
Returns
{"Assign": 1, "Expr": 1, "If": 1, "Return": 2}
2
8
2
["torch.sqrt", "torch.log10"]
2,119
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.parsers.schwab_equity_award_json_py.SchwabTransaction.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.28233542_gluufederation_community_edition_containers.py...
The function (get) defined within the public class called RunningPSNR.The function start at line 62 and ends at 69. It contains 5 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters, and this function return a value. It declares 2.0 functions, It has 2.0 functions called ins...
CAREamics_careamics
public
public
0
0
zero_mean
def zero_mean(x):return x - torch.mean(x, dim=1, keepdim=True)
1
2
1
22
0
72
73
72
x
[]
Returns
{"Return": 1}
1
2
1
["torch.mean"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.RangeInvariantPsnr", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.fix", "_.con...
The function (zero_mean) defined within the public class called public.The function start at line 72 and ends at 73. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declare 1.0 function, It has 1.0 function called insid...
CAREamics_careamics
public
public
0
0
fix_range
def fix_range(gt, x):a = torch.sum(gt * x, dim=1, keepdim=True) / (torch.sum(x * x, dim=1, keepdim=True))return x * a
1
3
2
48
1
76
78
76
gt,x
['a']
Returns
{"Assign": 1, "Return": 1}
2
3
2
["torch.sum", "torch.sum"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.fix"]
The function (fix_range) defined within the public class called public.The function start at line 76 and ends at 78. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [76.0], and this function return a value. It declares 2.0 functions, It has 2.0 functions called...
CAREamics_careamics
public
public
0
0
fix
def fix(gt, x):gt_ = zero_mean(gt)return fix_range(gt_, zero_mean(x))
1
3
2
23
1
81
83
81
gt,x
['gt_']
Returns
{"Assign": 1, "Return": 1}
3
3
3
["zero_mean", "fix_range", "zero_mean"]
5
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.78400723_sagemath_sagetrac_mirror.src.sage.schemes.elliptic_curves.ell_curve_isogeny_py.fill_isogeny_matrix", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94875337_Realiserad_fish_ai.src.fish_ai.tests.fix_test_py.t...
The function (fix) defined within the public class called public.The function start at line 81 and ends at 83. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [81.0], and this function return a value. It declares 3.0 functions, It has 3.0 functions called insid...
CAREamics_careamics
public
public
0
0
_PSNR_internal
def _PSNR_internal(gt, pred, range_=None):if range_ is None:range_ = torch.max(gt, dim=1).values - torch.min(gt, dim=1).valuesmse = torch.mean((gt - pred) ** 2, dim=1)return 20 * torch.log10(range_ / torch.sqrt(mse))
2
5
3
77
2
86
91
86
gt,pred,range_
['range_', 'mse']
Returns
{"Assign": 2, "If": 1, "Return": 1}
5
6
5
["torch.max", "torch.min", "torch.mean", "torch.log10", "torch.sqrt"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.PSNR", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.RangeInvariantPsnr"]
The function (_PSNR_internal) defined within the public class called public.The function start at line 86 and ends at 91. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [86.0], and this function return a value. It declares 5.0 functions, It has 5.0 functions c...
CAREamics_careamics
public
public
0
0
PSNR
def PSNR(gt, pred, range_=None):"""Compute PSNR.Parameters----------gt: arrayGround truth image.pred: arrayPredicted image."""assert len(gt.shape) == 3, "Images must be in shape: (batch,H,W)"gt = gt.view(len(gt), -1)pred = pred.view(len(gt), -1)return _PSNR_internal(gt, pred, range_=range_)
1
5
3
62
2
95
110
95
gt,pred,range_
['gt', 'pred']
Returns
{"Assign": 2, "Expr": 1, "Return": 1}
6
16
6
["len", "gt.view", "len", "pred.view", "len", "_PSNR_internal"]
0
[]
The function (PSNR) defined within the public class called public.The function start at line 95 and ends at 110. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [95.0], and this function return a value. It declares 6.0 functions, and It has 6.0 functions calle...
CAREamics_careamics
public
public
0
0
RangeInvariantPsnr
def RangeInvariantPsnr(gt: torch.Tensor, pred: torch.Tensor):"""NOTE: Works only for grayscale images.Adapted from https://github.com/juglab/ScaleInvPSNR/blob/master/psnr.pyIt rescales the prediction to ensure that the prediction has the same range as the ground truth."""assert len(gt.shape) == 3, "Images must be in sh...
1
9
2
133
4
114
127
114
gt,pred
['gt_', 'gt', 'ra', 'pred']
Returns
{"Assign": 4, "Expr": 1, "Return": 1}
13
14
13
["len", "gt.view", "len", "pred.view", "len", "torch.max", "torch.min", "torch.std", "zero_mean", "torch.std", "_PSNR_internal", "zero_mean", "fix"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.lightning_module_py.LadderVAELight.validation_step"]
The function (RangeInvariantPsnr) defined within the public class called public.The function start at line 114 and ends at 127. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [114.0], and this function return a value. It declares 13.0 functions, It has 13.0 fu...
CAREamics_careamics
public
public
0
0
_avg_psnr
def _avg_psnr(target, prediction, psnr_fn):output = np.mean([psnr_fn(target[i : i + 1], prediction[i : i + 1]).item()for i in range(len(prediction))])return round(output, 2)
2
8
3
59
1
130
137
130
target,prediction,psnr_fn
['output']
Returns
{"Assign": 1, "Return": 1}
6
8
6
["np.mean", "item", "psnr_fn", "range", "len", "round"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.avg_psnr", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.avg_range_inv_psnr", "...
The function (_avg_psnr) defined within the public class called public.The function start at line 130 and ends at 137. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [130.0], and this function return a value. It declares 6.0 functions, It has 6.0 functions cal...
CAREamics_careamics
public
public
0
0
avg_range_inv_psnr
def avg_range_inv_psnr(target, prediction):return _avg_psnr(target, prediction, RangeInvariantPsnr)
1
2
2
16
0
140
141
140
target,prediction
[]
Returns
{"Return": 1}
1
2
1
["_avg_psnr"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.compute_masked_psnr"]
The function (avg_range_inv_psnr) defined within the public class called public.The function start at line 140 and ends at 141. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [140.0], and this function return a value. It declare 1.0 function, It has 1.0 functi...
CAREamics_careamics
public
public
0
0
avg_psnr
def avg_psnr(target, prediction):return _avg_psnr(target, prediction, PSNR)
1
2
2
16
0
144
145
144
target,prediction
[]
Returns
{"Return": 1}
1
2
1
["_avg_psnr"]
0
[]
The function (avg_psnr) defined within the public class called public.The function start at line 144 and ends at 145. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [144.0], and this function return a value. It declare 1.0 function, and It has 1.0 function ca...
CAREamics_careamics
public
public
0
0
compute_masked_psnr
def compute_masked_psnr(mask, tar1, tar2, pred1, pred2):mask = mask.astype(bool)mask = mask[..., 0]tmp_tar1 = tar1[mask].reshape((len(tar1), -1, 1))tmp_pred1 = pred1[mask].reshape((len(tar1), -1, 1))tmp_tar2 = tar2[mask].reshape((len(tar2), -1, 1))tmp_pred2 = pred2[mask].reshape((len(tar2), -1, 1))psnr1 = avg_range_inv...
1
10
5
133
7
148
157
148
mask,tar1,tar2,pred1,pred2
['tmp_tar1', 'psnr1', 'psnr2', 'tmp_tar2', 'mask', 'tmp_pred1', 'tmp_pred2']
Returns
{"Assign": 8, "Return": 1}
11
10
11
["mask.astype", "reshape", "len", "reshape", "len", "reshape", "len", "reshape", "len", "avg_range_inv_psnr", "avg_range_inv_psnr"]
0
[]
The function (compute_masked_psnr) defined within the public class called public.The function start at line 148 and ends at 157. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 5 parameters, represented as [148.0], and this function return a value. It declares 11.0 functions, and It has ...
CAREamics_careamics
public
public
0
0
avg_ssim
def avg_ssim(target, prediction):ssim = [structural_similarity(target[i], prediction[i], data_range=(target[i].max() - target[i].min()))for i in range(len(target))]return np.mean(ssim), np.std(ssim)
2
8
2
69
1
160
167
160
target,prediction
['ssim']
Returns
{"Assign": 1, "Return": 1}
7
8
7
["structural_similarity", "max", "min", "range", "len", "np.mean", "np.std"]
0
[]
The function (avg_ssim) defined within the public class called public.The function start at line 160 and ends at 167. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [160.0], and this function return a value. It declares 7.0 functions, and It has 7.0 functions...
CAREamics_careamics
public
public
0
0
range_invariant_multiscale_ssim
def range_invariant_multiscale_ssim(gt_, pred_):"""Computes range invariant multiscale ssim for one channel.This has the benefit that it is invariant to scalar multiplications in the prediction."""shape = gt_.shapegt_ = torch.Tensor(gt_.reshape((shape[0], -1)))pred_ = torch.Tensor(pred_.reshape((shape[0], -1)))gt_ = ze...
1
13
2
140
4
171
188
171
gt_,pred_
['gt_', 'ms_ssim', 'shape', 'pred_']
Returns
{"Assign": 9, "Expr": 1, "Return": 1}
16
18
16
["torch.Tensor", "gt_.reshape", "torch.Tensor", "pred_.reshape", "zero_mean", "zero_mean", "fix", "pred_.reshape", "gt_.reshape", "MultiScaleStructuralSimilarityIndexMeasure", "gt_.max", "gt_.min", "item", "ms_ssim", "torch.Tensor", "torch.Tensor"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.metrics_py.compute_multiscale_ssim"]
The function (range_invariant_multiscale_ssim) defined within the public class called public.The function start at line 171 and ends at 188. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [171.0], and this function return a value. It declares 16.0 functions, ...
CAREamics_careamics
public
public
0
0
compute_multiscale_ssim
def compute_multiscale_ssim(gt_, pred_, range_invariant=True):"""Computes multiscale ssim for each channel.Args:gt_: ground truth image with shape (N, H, W, C)pred_: predicted image with shape (N, H, W, C)range_invariant: whether to use range invariant multiscale ssim"""ms_ssim_values = {i: None for i in range(gt_.shap...
5
16
3
154
5
191
214
191
gt_,pred_,range_invariant
['output', 'tar_tmp', 'ms_ssim', 'pred_tmp', 'ms_ssim_values']
Returns
{"Assign": 7, "Expr": 1, "For": 1, "If": 1, "Return": 1}
11
24
11
["range", "range", "range_invariant_multiscale_ssim", "MultiScaleStructuralSimilarityIndexMeasure", "tar_tmp.max", "tar_tmp.min", "item", "ms_ssim", "torch.Tensor", "torch.Tensor", "range"]
0
[]
The function (compute_multiscale_ssim) defined within the public class called public.The function start at line 191 and ends at 214. It contains 16 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [191.0], and this function return a value. It declares 11.0 functions, and It ...
CAREamics_careamics
public
public
0
0
create_dataset
def create_dataset(config,datadir,eval_datasplit_type=DataSplitType.Val,raw_data_dict=None,skip_train_dataset=False,kwargs_dict=None,):if kwargs_dict is None:kwargs_dict = {}datapath = datadir# Hard-coded parameters (used to be in the config file)normalized_input = Trueuse_one_mu_std = Truetrain_aug_rotate = Falseenabl...
11
107
6
484
13
53
176
53
config,datadir,eval_datasplit_type,raw_data_dict,skip_train_dataset,kwargs_dict
['val_data_kwargs', 'use_one_mu_std', 'normalized_input', 'max_val', 'datapath', 'train_aug_rotate', 'lowres_supervision', 'train_data_kwargs', 'enable_random_cropping', 'kwargs_dict', 'val_data', 'padding_kwargs', 'train_data']
Returns
{"Assign": 24, "Expr": 2, "If": 5, "Return": 1}
10
124
10
["kwargs_dict.pop", "LCMultiChDloader", "train_data.get_max_val", "LCMultiChDloader", "MultiChDloader", "train_data.get_max_val", "MultiChDloader", "train_data.compute_mean_std", "train_data.set_mean_std", "val_data.set_mean_std"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94533096_lancedb_lancedb.python.python.tests.test_table_py.test_input_data_type", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.dataset_ng.data_module_py.Careamic...
The function (create_dataset) defined within the public class called public.The function start at line 53 and ends at 176. It contains 107 lines of code and it has a cyclomatic complexity of 11. It takes 6 parameters, represented as [53.0], and this function return a value. It declares 10.0 functions, It has 10.0 funct...
CAREamics_careamics
public
public
0
0
create_model_and_train
def create_model_and_train(config: ml_collections.ConfigDict,data_mean: Dict[str, torch.Tensor],data_std: Dict[str, torch.Tensor],logger: WandbLogger,checkpoint_callback: ModelCheckpoint,train_loader: DataLoader,val_loader: DataLoader,):# tensorboard previous files.for filename in glob.glob(config.workdir + "/events*")...
5
48
7
320
8
179
239
179
config,data_mean,data_std,logger,checkpoint_callback,train_loader,val_loader
['_', 'target_ch', 'checkpoint', 'trainer', 'callbacks', 'model', 'estop_mode', 'estop_monitor']
None
{"Assign": 9, "Expr": 5, "For": 2, "If": 2}
18
61
18
["glob.glob", "os.remove", "glob.glob", "os.remove", "config.data.get", "LadderVAELight", "print", "torch.load", "model.load_state_dict", "config.model.get", "mode", "MetricMonitor", "EarlyStopping", "LearningRateMonitor", "logger.experiment.config.update", "config.to_dict", "pl.Trainer", "trainer.fit"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.train_lvae_py.train_network"]
The function (create_model_and_train) defined within the public class called public.The function start at line 179 and ends at 239. It contains 48 lines of code and it has a cyclomatic complexity of 5. It takes 7 parameters, represented as [179.0] and does not return any value. It declares 18.0 functions, It has 18.0 f...
CAREamics_careamics
public
public
0
0
train_network
def train_network(train_loader: DataLoader,val_loader: DataLoader,data_mean: Dict[str, torch.Tensor],data_std: Dict[str, torch.Tensor],config: ml_collections.ConfigDict,model_name: str,logdir: str,):ckpt_monitor = config.model.get("monitor", "val_loss")ckpt_mode = MetricMonitor(ckpt_monitor).mode()checkpoint_callback =...
1
34
7
171
4
242
276
242
train_loader,val_loader,data_mean,data_std,config,model_name,logdir
['checkpoint_callback', 'ckpt_mode', 'ckpt_monitor', 'logger']
None
{"Assign": 5, "Expr": 1}
7
35
7
["config.model.get", "mode", "MetricMonitor", "ModelCheckpoint", "WandbLogger", "os.path.join", "create_model_and_train"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.train_lvae_py.main"]
The function (train_network) defined within the public class called public.The function start at line 242 and ends at 276. It contains 34 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [242.0] and does not return any value. It declares 7.0 functions, It has 7.0 functions ca...
CAREamics_careamics
public
public
0
0
main
def main(argv):config = FLAGS.configassert os.path.exists(FLAGS.workdir)cur_workdir, relative_path = get_workdir(config, FLAGS.workdir, FLAGS.use_max_version)print(f"Saving training to {cur_workdir}")config.workdir = cur_workdirconfig.exptname = relative_pathconfig.hostname = socket.gethostname()config.datadir = FLAGS....
3
50
1
246
6
279
338
279
argv
['raw_data_dict', 'config', 'train_dloader', 'shuffle', 'batch_size', 'val_dloader']
None
{"Assign": 15, "Expr": 4, "If": 2}
13
60
13
["os.path.exists", "get_workdir", "print", "socket.gethostname", "set_logger", "ml_collections.FrozenConfigDict", "log_config", "create_dataset", "get_mean_std_dict_for_model", "DataLoader", "DataLoader", "train_network", "ValueError"]
332
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.main_py.init", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3625043_uber_tchannel_python.tests.test_tcurl_py.test_tcurl_health", "_.content.gdrive.MyDrive.Phd_Thesis...
The function (main) defined within the public class called public.The function start at line 279 and ends at 338. It contains 50 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 13.0 functions, It has 13.0 functions called inside...
CAREamics_careamics
public
public
0
0
log_config
def log_config(config: ml_collections.ConfigDict, cur_workdir: str) -> None:# Saving config file.with open(os.path.join(cur_workdir, "config.pkl"), "wb") as f:pickle.dump(config, f)print(f"Saved config to {cur_workdir}/config.pkl")
1
4
2
47
0
17
21
17
config,cur_workdir
[]
None
{"Expr": 2, "With": 1}
4
5
4
["open", "os.path.join", "pickle.dump", "print"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.train_lvae_py.main"]
The function (log_config) defined within the public class called public.The function start at line 17 and ends at 21. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [17.0] and does not return any value. It declares 4.0 functions, It has 4.0 functions called in...
CAREamics_careamics
public
public
0
0
set_logger
def set_logger(workdir: str) -> None:os.makedirs(workdir, exist_ok=True)fstream = open(os.path.join(workdir, "stdout.txt"), "w")handler = logging.StreamHandler(fstream)formatter = logging.Formatter("%(levelname)s - %(filename)s - %(asctime)s - %(message)s")handler.setFormatter(formatter)logger = logging.getLogger()logg...
1
11
1
77
4
24
34
24
workdir
['fstream', 'formatter', 'handler', 'logger']
None
{"Assign": 4, "Expr": 4}
9
11
9
["os.makedirs", "open", "os.path.join", "logging.StreamHandler", "logging.Formatter", "handler.setFormatter", "logging.getLogger", "logger.addHandler", "logger.setLevel"]
12
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3917005_sergeypirogov_webdriver_manager.tests.test_custom_logger_py.test_custom_logger", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94656748_elastic_connectors.connectors.service_cli_py.run", "_.content.gdrive.My...
The function (set_logger) defined within the public class called public.The function start at line 24 and ends at 34. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 9.0 functions, It has 9.0 functions called insi...
CAREamics_careamics
public
public
0
0
get_new_model_version
def get_new_model_version(model_dir: str) -> str:"""A model will have multiple runs. Each run will have a different version."""versions = []for version_dir in os.listdir(model_dir):try:versions.append(int(version_dir))except:print(f"Invalid subdirectory:{model_dir}/{version_dir}. Only integer versions are allowed")exit...
4
13
1
58
1
37
52
37
model_dir
['versions']
str
{"Assign": 1, "Expr": 4, "For": 1, "If": 1, "Return": 2, "Try": 1}
7
16
7
["os.listdir", "versions.append", "int", "print", "exit", "len", "max"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.train_utils_py.get_workdir"]
The function (get_new_model_version) defined within the public class called public.The function start at line 37 and ends at 52. It contains 13 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 7.0 functions, It has 7.0 functions ...
CAREamics_careamics
public
public
0
0
get_model_name
def get_model_name(config: ml_collections.ConfigDict) -> str:return "LVAE_denoiSplit"
1
2
1
13
0
55
56
55
config
[]
str
{"Return": 1}
0
2
0
[]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94953499_langflow_ai_langflow.src.lfx.src.lfx.components.agents.agent_py.AgentComponent.get_agent_requirements", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.94953499_langflow_ai_langflow.src.lfx.src.lfx.components...
The function (get_model_name) defined within the public class called public.The function start at line 55 and ends at 56. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It has 4.0 functions calling this function which are ["_...
CAREamics_careamics
public
public
0
0
get_workdir
def get_workdir(config: ml_collections.ConfigDict,root_dir: str,use_max_version: bool,nested_call: int = 0,):rel_path = datetime.now().strftime("%y%m")cur_workdir = os.path.join(root_dir, rel_path)Path(cur_workdir).mkdir(exist_ok=True)rel_path = os.path.join(rel_path, get_model_name(config))cur_workdir = os.path.join(r...
5
33
4
219
3
59
98
59
config,root_dir,use_max_version,nested_call
['rel_path', 'version', 'cur_workdir']
Returns
{"Assign": 9, "Expr": 5, "If": 3, "Return": 2, "Try": 1}
23
40
23
["strftime", "datetime.now", "os.path.join", "mkdir", "Path", "os.path.join", "get_model_name", "os.path.join", "mkdir", "Path", "int", "get_new_model_version", "os.path.join", "str", "os.path.join", "get_new_model_version", "os.path.join", "mkdir", "Path", "print", "time.sleep", "ValueError", "get_workdir"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.train_lvae_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.train_utils_py.get_workdir"]
The function (get_workdir) defined within the public class called public.The function start at line 59 and ends at 98. It contains 33 lines of code and it has a cyclomatic complexity of 5. It takes 4 parameters, represented as [59.0], and this function return a value. It declares 23.0 functions, It has 23.0 functions c...
CAREamics_careamics
public
public
0
0
get_mean_std_dict_for_model
def get_mean_std_dict_for_model(config, train_dset):"""Computes the mean and std for the model. This will be subsequently passed to the model."""mean_dict, std_dict = train_dset.get_mean_std()return deepcopy(mean_dict), deepcopy(std_dict)
1
3
2
27
0
101
107
101
config,train_dset
[]
Returns
{"Assign": 1, "Expr": 1, "Return": 1}
3
7
3
["train_dset.get_mean_std", "deepcopy", "deepcopy"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.train_lvae_py.main"]
The function (get_mean_std_dict_for_model) defined within the public class called public.The function start at line 101 and ends at 107. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [101.0], and this function return a value. It declares 3.0 functions, It has...
CAREamics_careamics
MetricMonitor
public
0
0
__init__
def __init__(self, metric):assert metric in ["val_loss", "val_psnr"]self.metric = metric
1
3
2
20
0
111
113
111
self,metric
[]
None
{"Assign": 1}
0
3
0
[]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called MetricMonitor.The function start at line 111 and ends at 113. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [111.0] and does not return any value. It has 8182.0 functions calling this function whi...
CAREamics_careamics
MetricMonitor
public
0
0
mode
def mode(self):if self.metric == "val_loss":return "min"elif self.metric == "val_psnr":return "max"else:raise ValueError(f"Invalid metric:{self.metric}")
3
7
1
31
0
115
121
115
self
[]
Returns
{"If": 2, "Return": 2}
1
7
1
["ValueError"]
8
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3950162_vpelletier_python_libusb1.examples.hotplug_advanced_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.56769247_dmwm_cmsspark.src.python.CMSSpark.dbs_hdfs_eos_py.generate_parquet", "_.content.gdrive.MyD...
The function (mode) defined within the public class called MetricMonitor.The function start at line 115 and ends at 121. It contains 7 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters, and this function return a value. It declare 1.0 function, It has 1.0 function called i...
CAREamics_careamics
MicroSplitDataConfig
public
0
1
__init__
def __init__(self, **data):# Convert string data_type to enum if neededif "data_type" in data and isinstance(data["data_type"], str):try:data["data_type"] = DataType[data["data_type"]]except KeyError:# Keep original value to let validation handle the errorpasssuper().__init__(**data)
4
7
2
50
0
125
133
125
self,**data
[]
None
{"Assign": 1, "Expr": 1, "If": 1, "Try": 1}
3
9
3
["isinstance", "__init__", "super"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called MicroSplitDataConfig, that inherit another class.The function start at line 125 and ends at 133. It contains 7 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [125.0] and does not return any value. It declares 3....
CAREamics_careamics
LCMultiChDloader
public
0
1
__init__
def __init__(self,data_config: MicroSplitDataConfig,datapath: Union[str, Path],load_data_fn: Optional[Callable] = None,val_fraction: float = 0.1,test_fraction: float = 0.1,allow_generation: bool = False,):self._padding_kwargs = (data_config.padding_kwargs# mode=padding_mode, constant_values=constant_value)self._uncorre...
5
54
7
347
0
20
82
20
self,data_config,datapath,load_data_fn,val_fraction,test_fraction,allow_generation
[]
None
{"Assign": 10, "Expr": 3, "For": 1, "If": 2}
16
63
16
["__init__", "super", "isinstance", "isinstance", "range", "len", "astype", "resize", "astype", "ds_data.max", "max", "ds_data.max", "max", "self._scaled_data.append", "resize", "self._scaled_noise_data.append"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called LCMultiChDloader, that inherit another class.The function start at line 20 and ends at 82. It contains 54 lines of code and it has a cyclomatic complexity of 5. It takes 7 parameters, represented as [20.0] and does not return any value. It declares 16.0 fun...
CAREamics_careamics
LCMultiChDloader
public
0
1
reduce_data
def reduce_data(self, t_list=None, h_start=None, h_end=None, w_start=None, w_end=None):assert t_list is not Noneassert h_start is Noneassert h_end is Noneassert w_start is Noneassert w_end is Noneself._data = self._data[t_list].copy()self._scaled_data = [self._scaled_data[i][t_list].copy() for i in range(len(self._scal...
4
23
6
175
0
84
110
84
self,t_list,h_start,h_end,w_start,w_end
[]
None
{"Assign": 5, "Expr": 2, "If": 1}
11
27
11
["copy", "copy", "range", "len", "copy", "copy", "range", "len", "len", "self.set_img_sz", "print"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.78400723_sagemath_sagetrac_mirror.src.sage.rings.finite_rings.finite_field_pari_ffelt_py.FiniteField_pari_ffelt.__reduce__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.78400723_sagemath_sagetrac_mirror.src.sage.r...
The function (reduce_data) defined within the public class called LCMultiChDloader, that inherit another class.The function start at line 84 and ends at 110. It contains 23 lines of code and it has a cyclomatic complexity of 4. It takes 6 parameters, represented as [84.0] and does not return any value. It declares 11.0...
CAREamics_careamics
LCMultiChDloader
public
0
1
_init_msg
def _init_msg(self):msg = super()._init_msg()msg += f" Pad:{self._padding_kwargs}"if self._uncorrelated_channels:msg += f" UncorrChProbab:{self._uncorrelated_channel_probab}"return msg
2
6
1
29
0
112
117
112
self
[]
Returns
{"Assign": 1, "AugAssign": 2, "If": 1, "Return": 1}
2
6
2
["_init_msg", "super"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.dataset.lc_dataset_py.LCMultiChDloader._init_msg", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.data...
The function (_init_msg) defined within the public class called LCMultiChDloader, that inherit another class.The function start at line 112 and ends at 117. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters, and this function return a value. It declares 2.0 f...
CAREamics_careamics
LCMultiChDloader
public
0
1
_load_scaled_img
def _load_scaled_img(self, scaled_index, index: Union[int, tuple[int, int]]) -> tuple[np.ndarray, np.ndarray]:if isinstance(index, int):idx = indexelse:idx, _ = index# tidx = self.idx_manager.get_t(idx)patch_loc_list = self.idx_manager.get_patch_location_from_dataset_idx(idx)nidx = patch_loc_list[0]imgs = self._scaled_...
7
17
3
189
0
119
138
119
self,scaled_index,index
[]
tuple[np.ndarray, np.ndarray]
{"Assign": 10, "If": 2, "Return": 1}
8
20
8
["isinstance", "self.idx_manager.get_patch_location_from_dataset_idx", "tuple", "range", "tuple", "range", "np.sqrt", "tuple"]
0
[]
The function (_load_scaled_img) defined within the public class called LCMultiChDloader, that inherit another class.The function start at line 119 and ends at 138. It contains 17 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [119.0] and does not return any value. It declar...
CAREamics_careamics
LCMultiChDloader
public
0
1
_crop_img
def _crop_img(self, img: np.ndarray, patch_start_loc: tuple):"""Here, h_start, w_start could be negative. That simply means we need to pick the content from 0. So,the cropped image will be smaller than self._img_sz * self._img_sz"""max_len_vals = list(self.idx_manager.data_shape[1:-1])max_len_vals[-2:] = img.shape[-2:]...
1
6
3
60
0
140
149
140
self,img,patch_start_loc
[]
Returns
{"Assign": 2, "Expr": 1, "Return": 1}
2
10
2
["list", "self._crop_img_with_padding"]
0
[]
The function (_crop_img) defined within the public class called LCMultiChDloader, that inherit another class.The function start at line 140 and ends at 149. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [140.0], and this function return a value. It declares 2...
CAREamics_careamics
LCMultiChDloader
public
0
1
_get_img
def _get_img(self, index: int):"""Returns the primary patch along with low resolution patches centered on the primary patch."""# Noise_tuples is populated when there is synthetic noise in training# Should have similar type of noise with the noise model# Starting with microsplit, dump the noise, use it instead as an aug...
10
47
2
330
0
151
209
151
self,index
[]
Returns
{"Assign": 20, "Expr": 2, "For": 2, "If": 2, "Return": 1}
19
59
19
["self._load_img", "self._get_random_hw", "np.random.choice", "self._get_deterministic_loc", "self._crop_flip_img", "self._crop_flip_img", "list", "range", "len", "range", "self._load_scaled_img", "self._crop_flip_img", "range", "len", "append", "tuple", "np.concatenate", "range", "len"]
0
[]
The function (_get_img) defined within the public class called LCMultiChDloader, that inherit another class.The function start at line 151 and ends at 209. It contains 47 lines of code and it has a cyclomatic complexity of 10. It takes 2 parameters, represented as [151.0], and this function return a value. It declares ...
CAREamics_careamics
LCMultiChDloader
public
0
1
__getitem__
def __getitem__(self, index: Union[int, tuple[int, int]]):img_tuples, noise_tuples = self._get_img(index)if self._uncorrelated_channels:assert (self._input_idx is None), "Uncorrelated channels is not implemented when there is a separate input channel."if np.random.rand() < self._uncorrelated_channel_probab:img_tuples_n...
16
47
2
359
0
211
274
211
self,index
[]
Returns
{"Assign": 21, "Expr": 3, "For": 2, "If": 10, "Return": 2}
25
64
25
["self._get_img", "np.random.rand", "len", "range", "len", "np.random.randint", "len", "self._get_img", "np.random.rand", "self.replace_with_empty_patch", "self._rotate", "len", "np.sqrt", "x.copy", "input_tuples.append", "self._compute_input", "len", "zip", "self._compute_target", "self.normalize_target", "output.appe...
30
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3535398_idsia_brainstorm.brainstorm.structure.buffer_views_py.BufferView.__getitem__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3573634_xray7224_pypump.pypump.models.feed_py.Lists.__getitem__", "_.content.gdriv...
The function (__getitem__) defined within the public class called LCMultiChDloader, that inherit another class.The function start at line 211 and ends at 274. It contains 47 lines of code and it has a cyclomatic complexity of 16. It takes 2 parameters, represented as [211.0], and this function return a value. It declar...
CAREamics_careamics
MultiChDloaderRef
public
0
0
__init__
def __init__(self,data_config: MicroSplitDataConfig,fpath: str,load_data_fn: Callable,val_fraction: float = None,test_fraction: float = None,):""" """self._data_type = data_config.data_typeself._fpath = Path(fpath)self._data = Noneself._3Ddata = False# TODO wtf it was 5Dself._tiling_mode = data_config.tiling_mode# by d...
13
98
6
544
0
20
147
20
self,data_config,fpath,load_data_fn,val_fraction,test_fraction
[]
None
{"Assign": 45, "Expr": 5, "If": 5, "Try": 1}
10
128
10
["Path", "self.load_data", "self.get_data_shapes", "print", "self.set_img_sz", "EmptyPatchFetcher", "self.rm_bkground_set_max_val_and_upperclip_data", "A.Compose", "A.Flip", "A.RandomRotate90"]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called MultiChDloaderRef.The function start at line 20 and ends at 147. It contains 98 lines of code and it has a cyclomatic complexity of 13. It takes 6 parameters, represented as [20.0] and does not return any value. It declares 10.0 functions, It has 10.0 funct...
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_data_shapes
def get_data_shapes(self):if self._3Ddata:# TODO we assume images don't have a channel dimension[[im.shape if len(im.shape) == 4 else (1, *im.shape)for im in self._data[ch]]for ch in range(len(self._data))]else:return [[im.shape if len(im.shape) == 3 else (1, *im.shape)for im in self._data[ch]]for ch in range(len(self....
8
17
1
105
0
154
170
154
self
[]
Returns
{"Expr": 1, "If": 1, "Return": 1}
6
17
6
["len", "range", "len", "len", "range", "len"]
0
[]
The function (get_data_shapes) defined within the public class called MultiChDloaderRef.The function start at line 154 and ends at 170. It contains 17 lines of code and it has a cyclomatic complexity of 8. The function does not take any parameters, and this function return a value. It declares 6.0 functions, and It ha...
CAREamics_careamics
MultiChDloaderRef
public
0
0
load_data
def load_data(self,data_config: MicroSplitDataConfig,datasplit_type: DataSplitType,load_data_fn: Callable,val_fraction=None,test_fraction=None,allow_generation=None,):self._data = load_data_fn(data_config,self._fpath,datasplit_type,val_fraction=val_fraction,test_fraction=test_fraction,allow_generation=allow_generation,...
1
17
7
57
0
172
188
172
self,data_config,datasplit_type,load_data_fn,val_fraction,test_fraction,allow_generation
[]
None
{"Assign": 1}
1
17
1
["load_data_fn"]
12
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3919742_opendatacube_datacube_stats.datacube_stats.main_py.load_process_save_chunk", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3959435_kscsdk_ksc_sdk_python.kscore.session_py.Session.get_data", "_.content.gdrive...
The function (load_data) defined within the public class called MultiChDloaderRef.The function start at line 172 and ends at 188. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [172.0] and does not return any value. It declare 1.0 function, It has 1.0 functio...
CAREamics_careamics
MultiChDloaderRef
public
0
0
save_background
def save_background(self, channel_idx, frame_idx, background_value):self._background_values[frame_idx, channel_idx] = background_value
1
2
4
21
0
193
194
193
self,channel_idx,frame_idx,background_value
[]
None
{"Assign": 1}
0
2
0
[]
0
[]
The function (save_background) defined within the public class called MultiChDloaderRef.The function start at line 193 and ends at 194. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [193.0] and does not return any value..
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_background
def get_background(self, channel_idx, frame_idx):return self._background_values[frame_idx, channel_idx]
1
2
3
18
0
196
197
196
self,channel_idx,frame_idx
[]
Returns
{"Return": 1}
0
2
0
[]
0
[]
The function (get_background) defined within the public class called MultiChDloaderRef.The function start at line 196 and ends at 197. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [196.0], and this function return a value..
CAREamics_careamics
MultiChDloaderRef
public
0
0
rm_bkground_set_max_val_and_upperclip_data
def rm_bkground_set_max_val_and_upperclip_data(self, max_val, datasplit_type):# self.remove_background() # TODO revisitself.set_max_val(max_val, datasplit_type)self.upperclip_data()
1
3
3
22
0
199
202
199
self,max_val,datasplit_type
[]
None
{"Expr": 2}
2
4
2
["self.set_max_val", "self.upperclip_data"]
0
[]
The function (rm_bkground_set_max_val_and_upperclip_data) defined within the public class called MultiChDloaderRef.The function start at line 199 and ends at 202. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [199.0] and does not return any value. It declares...
CAREamics_careamics
MultiChDloaderRef
public
0
0
upperclip_data
def upperclip_data(self):for ch_idx, data in enumerate(self._data):if self.max_val[ch_idx] is not None:for idx in range(len(data)):data[idx][data[idx] > self.max_val[ch_idx]] = self.max_val[ch_idx]
4
5
1
63
0
204
208
204
self
[]
None
{"Assign": 1, "For": 2, "If": 1}
3
5
3
["enumerate", "range", "len"]
0
[]
The function (upperclip_data) defined within the public class called MultiChDloaderRef.The function start at line 204 and ends at 208. It contains 5 lines of code and it has a cyclomatic complexity of 4. The function does not take any parameters and does not return any value. It declares 3.0 functions, and It has 3.0 ...
CAREamics_careamics
MultiChDloaderRef
public
0
0
compute_max_val
def compute_max_val(self):# TODO add channelwise quantile ?return [max([np.quantile(im, self._quantile) for im in ch]) for ch in self._data]
3
4
1
33
0
210
214
210
self
[]
Returns
{"Return": 1}
2
5
2
["max", "np.quantile"]
0
[]
The function (compute_max_val) defined within the public class called MultiChDloaderRef.The function start at line 210 and ends at 214. It contains 4 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters, and this function return a value. It declares 2.0 functions, and It has...
CAREamics_careamics
MultiChDloaderRef
public
0
0
set_max_val
def set_max_val(self, max_val, datasplit_type):if max_val is None:assert datasplit_type in [DataSplitType.Train, DataSplitType.All]self.max_val = self.compute_max_val()else:assert max_val is not Noneself.max_val = max_val
2
7
3
47
0
216
222
216
self,max_val,datasplit_type
[]
None
{"Assign": 2, "If": 1}
1
7
1
["self.compute_max_val"]
0
[]
The function (set_max_val) defined within the public class called MultiChDloaderRef.The function start at line 216 and ends at 222. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [216.0] and does not return any value. It declare 1.0 function, and It has 1.0 f...
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_max_val
def get_max_val(self):return self.max_val
1
2
1
9
0
224
225
224
self
[]
Returns
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.dataset.multifile_dataset_py.MultiFileDset.get_max_val"]
The function (get_max_val) defined within the public class called MultiChDloaderRef.The function start at line 224 and ends at 225. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 1.0 function calling this function ...
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_img_sz
def get_img_sz(self):return self._img_sz
1
2
1
9
0
227
228
227
self
[]
Returns
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.dataset.multifile_dataset_py.MultiFileDset.get_img_sz"]
The function (get_img_sz) defined within the public class called MultiChDloaderRef.The function start at line 227 and ends at 228. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 1.0 function calling this function w...
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_num_frames
def get_num_frames(self):"""Returns the number of the longest channel."""return max(self.idx_manager.total_grid_count()[0])
1
2
1
20
0
230
232
230
self
[]
Returns
{"Expr": 1, "Return": 1}
2
3
2
["max", "self.idx_manager.total_grid_count"]
0
[]
The function (get_num_frames) defined within the public class called MultiChDloaderRef.The function start at line 230 and ends at 232. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declares 2.0 functions, and It has ...
CAREamics_careamics
MultiChDloaderRef
public
0
0
reduce_data
def reduce_data(self,t_list=None,z_start=None,z_end=None,h_start=None,h_end=None,w_start=None,w_end=None,):raise NotImplementedError("Not implemented")
1
11
8
39
0
234
244
234
self,t_list,z_start,z_end,h_start,h_end,w_start,w_end
[]
None
{}
1
11
1
["NotImplementedError"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.78400723_sagemath_sagetrac_mirror.src.sage.rings.finite_rings.finite_field_pari_ffelt_py.FiniteField_pari_ffelt.__reduce__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.78400723_sagemath_sagetrac_mirror.src.sage.r...
The function (reduce_data) defined within the public class called MultiChDloaderRef.The function start at line 234 and ends at 244. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 8 parameters, represented as [234.0] and does not return any value. It declare 1.0 function, It has 1.0 funct...
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_idx_manager_shapes
def get_idx_manager_shapes(self, patch_size: int, grid_size: Union[int, tuple[int, int, int]]):numC = len(self._data_shapes)if self._3Ddata:patch_shape = (1, self._depth3D, patch_size, patch_size)if isinstance(grid_size, int):grid_shape = (1, 1, grid_size, grid_size)else:assert len(grid_size) == 3assert all([g <= p for...
4
19
3
159
0
246
265
246
self,patch_size,grid_size
[]
Returns
{"Assign": 6, "If": 2, "Return": 1}
6
20
6
["len", "isinstance", "len", "all", "zip", "isinstance"]
0
[]
The function (get_idx_manager_shapes) defined within the public class called MultiChDloaderRef.The function start at line 246 and ends at 265. It contains 19 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [246.0], and this function return a value. It declares 6.0 functions,...
CAREamics_careamics
MultiChDloaderRef
public
0
0
set_img_sz
def set_img_sz(self, image_size, grid_size: Union[int, tuple[int, int, int]]):"""If one wants to change the image size on the go, then this can be used.Args:image_size: size of one patchgrid_size: frame is divided into square grids of this size. A patch centered on a grid having size `image_size` is returned."""# hacky...
1
10
3
75
0
267
284
267
self,image_size,grid_size
[]
None
{"Assign": 5, "Expr": 1}
2
18
2
["self.get_idx_manager_shapes", "GridIndexManagerRef"]
0
[]
The function (set_img_sz) defined within the public class called MultiChDloaderRef.The function start at line 267 and ends at 284. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [267.0] and does not return any value. It declares 2.0 functions, and It has 2.0...
CAREamics_careamics
MultiChDloaderRef
public
0
0
__len__
def __len__(self):# If channel length is not equal, return the longestreturn max(self.idx_manager.total_grid_count()[0])
1
2
1
19
0
286
288
286
self
[]
Returns
{"Return": 1}
2
3
2
["max", "self.idx_manager.total_grid_count"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3576232_vmware_liota.packages.examples.kura.kura_integrate_iotcc_py.sub_callback", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3665918_alvinwan_neural_backed_decision_trees.nbdt.data.imagenet_py._TinyImagenet200Va...
The function (__len__) defined within the public class called MultiChDloaderRef.The function start at line 286 and ends at 288. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It declares 2.0 functions, It has 2.0 function...
CAREamics_careamics
MultiChDloaderRef
public
0
0
_init_msg
def _init_msg(self,):msg = (f"[{self.__class__.__name__}] Train:{int(self._is_train)} Sz:{self._img_sz}")dim_sizes = [self.idx_manager.get_individual_dim_grid_count(dim)for dim in range(len(self._data.shape))]dim_sizes = ",".join([str(x) for x in dim_sizes])msg += f" N:{self.N} NumPatchPerN:{self._repeat_factor}"msg +=...
10
32
1
151
0
290
327
290
self
[]
Returns
{"Assign": 3, "AugAssign": 13, "If": 7, "Return": 1}
7
38
7
["int", "self.idx_manager.get_individual_dim_grid_count", "range", "len", "join", "str", "self.idx_manager.total_grid_count"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.dataset.lc_dataset_py.LCMultiChDloader._init_msg", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.data...
The function (_init_msg) defined within the public class called MultiChDloaderRef.The function start at line 290 and ends at 327. It contains 32 lines of code and it has a cyclomatic complexity of 10. The function does not take any parameters, and this function return a value. It declares 7.0 functions, It has 7.0 func...
CAREamics_careamics
MultiChDloaderRef
public
0
0
_crop_imgs
def _crop_imgs(self, ch_idx: int, patch_idx: int, img: np.ndarray):h, w = img.shape[-2:]if self._img_sz is None:return (img,{"h": [0, h], "w": [0, w], "hflip": False, "wflip": False},)if self._enable_random_cropping:# this parameter is ambiguous. It toggles between random/deterministic patchingpatch_start_loc = self._g...
4
17
4
144
0
329
349
329
self,ch_idx,patch_idx,img
[]
Returns
{"Assign": 5, "If": 3, "Return": 2}
4
21
4
["self._get_random_hw", "np.random.choice", "self._get_deterministic_loc", "self._crop_flip_img"]
0
[]
The function (_crop_imgs) defined within the public class called MultiChDloaderRef.The function start at line 329 and ends at 349. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 4 parameters, represented as [329.0], and this function return a value. It declares 4.0 functions, and It has...
CAREamics_careamics
MultiChDloaderRef
public
0
0
_crop_img
def _crop_img(self, img: np.ndarray, patch_start_loc: tuple):if self._tiling_mode in [TilingMode.TrimBoundary, TilingMode.ShiftBoundary]:# In training, this is used.# NOTE: It is my opinion that if I just use self._crop_img_with_padding, it will work perfectly fine.# The only benefit this if else loop provides is that ...
3
17
3
134
0
351
373
351
self,img,patch_start_loc
[]
Returns
{"Assign": 7, "If": 2, "Return": 2}
2
23
2
["np.array", "self._crop_img_with_padding"]
0
[]
The function (_crop_img) defined within the public class called MultiChDloaderRef.The function start at line 351 and ends at 373. It contains 17 lines of code and it has a cyclomatic complexity of 3. It takes 3 parameters, represented as [351.0], and this function return a value. It declares 2.0 functions, and It has ...
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_begin_end_padding
def get_begin_end_padding(self, start_pos, end_pos, max_len):"""The effect is that the image with size self._grid_sz is in the center of the patch with sufficientpadding on all four sides so that the final patch size is self._img_sz."""pad_start = 0pad_end = 0if start_pos < 0:pad_start = -1 * start_pospad_end = max(0, ...
2
7
4
43
0
375
387
375
self,start_pos,end_pos,max_len
[]
Returns
{"Assign": 4, "Expr": 1, "If": 1, "Return": 1}
1
13
1
["max"]
0
[]
The function (get_begin_end_padding) defined within the public class called MultiChDloaderRef.The function start at line 375 and ends at 387. It contains 7 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [375.0], and this function return a value. It declare 1.0 function, and...
CAREamics_careamics
MultiChDloaderRef
public
0
0
_crop_img_with_padding
def _crop_img_with_padding(self, img: np.ndarray, patch_start_loc, max_len_vals=None):if max_len_vals is None:max_len_vals = self.idx_manager.data_shape[1:-1]patch_end_loc = np.array(patch_start_loc, dtype=int) + np.array(self.idx_manager.patch_shape[1:-1], dtype=int)boundary_crossed = []valid_slice = []padding = [[0, ...
7
36
4
294
0
389
429
389
self,img,patch_start_loc,max_len_vals
[]
Returns
{"Assign": 10, "Expr": 3, "For": 1, "If": 4, "Return": 1}
11
41
11
["np.array", "np.array", "zip", "boundary_crossed.append", "valid_slice.append", "max", "min", "self.get_begin_end_padding", "padding.append", "np.all", "np.pad"]
0
[]
The function (_crop_img_with_padding) defined within the public class called MultiChDloaderRef.The function start at line 389 and ends at 429. It contains 36 lines of code and it has a cyclomatic complexity of 7. It takes 4 parameters, represented as [389.0], and this function return a value. It declares 11.0 functions...
CAREamics_careamics
MultiChDloaderRef
public
0
0
_crop_flip_img
def _crop_flip_img(self, img: np.ndarray, patch_start_loc: tuple, h_flip: bool, w_flip: bool):new_img = self._crop_img(img, patch_start_loc)if h_flip:new_img = new_img[..., ::-1, :]if w_flip:new_img = new_img[..., :, ::-1]return new_img.astype(np.float32)
3
9
5
72
0
431
440
431
self,img,patch_start_loc,h_flip,w_flip
[]
Returns
{"Assign": 3, "If": 2, "Return": 1}
2
10
2
["self._crop_img", "new_img.astype"]
0
[]
The function (_crop_flip_img) defined within the public class called MultiChDloaderRef.The function start at line 431 and ends at 440. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [431.0], and this function return a value. It declares 2.0 functions, and It ...
CAREamics_careamics
MultiChDloaderRef
public
0
0
_load_img
def _load_img(self, ch_idx: int, patch_idx: int) -> tuple[np.ndarray, np.ndarray]:"""Returns the channels and also the respective noise channels."""patch_loc_list = self.idx_manager.get_patch_location_from_patch_idx(ch_idx, patch_idx)# TODO we should be adding channel dim here probablyimg = self._data[ch_idx][patch_loc...
1
6
3
53
0
442
451
442
self,ch_idx,patch_idx
[]
tuple[np.ndarray, np.ndarray]
{"Assign": 2, "Expr": 1, "Return": 1}
1
10
1
["self.idx_manager.get_patch_location_from_patch_idx"]
0
[]
The function (_load_img) defined within the public class called MultiChDloaderRef.The function start at line 442 and ends at 451. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [442.0] and does not return any value. It declare 1.0 function, and It has 1.0 fun...
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_mean_std
def get_mean_std(self):return self._mean, self._std
1
2
1
13
0
453
454
453
self
[]
Returns
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.dataset.multifile_dataset_py.MultiFileDset.get_mean_std"]
The function (get_mean_std) defined within the public class called MultiChDloaderRef.The function start at line 453 and ends at 454. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 1.0 function calling this function...
CAREamics_careamics
MultiChDloaderRef
public
0
0
set_mean_std
def set_mean_std(self, mean_val, std_val):self._mean = mean_valself._std = std_val
1
3
3
19
0
456
458
456
self,mean_val,std_val
[]
None
{"Assign": 2}
0
3
0
[]
0
[]
The function (set_mean_std) defined within the public class called MultiChDloaderRef.The function start at line 456 and ends at 458. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [456.0] and does not return any value..
CAREamics_careamics
MultiChDloaderRef
public
0
0
normalize_target
def normalize_target(self, target):mean_dict, std_dict = self.get_mean_std()mean_ = mean_dict["target"]# .squeeze(0)std_ = std_dict["target"]# .squeeze(0)return (target - mean_) / std_
1
5
2
36
0
460
464
460
self,target
[]
Returns
{"Assign": 3, "Return": 1}
1
5
1
["self.get_mean_std"]
0
[]
The function (normalize_target) defined within the public class called MultiChDloaderRef.The function start at line 460 and ends at 464. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [460.0], and this function return a value. It declare 1.0 function, and It ...
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_grid_size
def get_grid_size(self):return self._grid_sz
1
2
1
9
0
466
467
466
self
[]
Returns
{"Return": 1}
0
2
0
[]
0
[]
The function (get_grid_size) defined within the public class called MultiChDloaderRef.The function start at line 466 and ends at 467. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value..
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_idx_manager
def get_idx_manager(self):return self.idx_manager
1
2
1
9
0
469
470
469
self
[]
Returns
{"Return": 1}
0
2
0
[]
0
[]
The function (get_idx_manager) defined within the public class called MultiChDloaderRef.The function start at line 469 and ends at 470. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value..
CAREamics_careamics
MultiChDloaderRef
public
0
0
per_side_overlap_pixelcount
def per_side_overlap_pixelcount(self):return (self._img_sz - self._grid_sz) // 2
1
2
1
16
0
472
473
472
self
[]
Returns
{"Return": 1}
0
2
0
[]
0
[]
The function (per_side_overlap_pixelcount) defined within the public class called MultiChDloaderRef.The function start at line 472 and ends at 473. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value..
CAREamics_careamics
MultiChDloaderRef
public
0
0
_get_deterministic_loc
def _get_deterministic_loc(self, ch_idx: int, patch_idx: int):"""It returns the top-left corner of the patch corresponding to index."""loc_list = self.idx_manager.get_patch_location_from_patch_idx(ch_idx, patch_idx)# last dim is channel. we need to take the third and the second last element.return loc_list[2:]
1
3
3
32
0
475
481
475
self,ch_idx,patch_idx
[]
Returns
{"Assign": 1, "Expr": 1, "Return": 1}
1
7
1
["self.idx_manager.get_patch_location_from_patch_idx"]
0
[]
The function (_get_deterministic_loc) defined within the public class called MultiChDloaderRef.The function start at line 475 and ends at 481. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [475.0], and this function return a value. It declare 1.0 function, an...
CAREamics_careamics
MultiChDloaderRef
public
0
0
crop_probablities
def crop_probablities(self, ch_idx):sizes = np.array([np.prod(x.shape) for x in self._data[ch_idx]])return sizes / sizes.sum()
2
3
2
41
0
484
486
484
self,ch_idx
[]
Returns
{"Assign": 1, "Return": 1}
3
3
3
["np.array", "np.prod", "sizes.sum"]
0
[]
The function (crop_probablities) defined within the public class called MultiChDloaderRef.The function start at line 484 and ends at 486. It contains 3 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [484.0], and this function return a value. It declares 3.0 functions, and ...
CAREamics_careamics
MultiChDloaderRef
public
0
0
sample_crop
def sample_crop(self, ch_idx):idx = Nonecount = 0while idx is None:count += 1idx = np.random.choice(len(self._data[ch_idx]), p=self.crop_probablities(ch_idx))data = self._data[ch_idx][idx]# TODO no channel and S dim ?# changed for ndimif all(d >= self._img_sz for d in data.shape[-2:]):# TODO dims were hardcodedh = np.r...
7
24
2
217
0
488
515
488
self,ch_idx
[]
Returns
{"Assign": 8, "AugAssign": 1, "If": 3, "Return": 3, "While": 1}
9
28
9
["np.random.choice", "len", "self.crop_probablities", "all", "np.random.randint", "np.random.randint", "len", "np.random.randint", "ValueError"]
0
[]
The function (sample_crop) defined within the public class called MultiChDloaderRef.The function start at line 488 and ends at 515. It contains 24 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [488.0], and this function return a value. It declares 9.0 functions, and It ha...
CAREamics_careamics
MultiChDloaderRef
public
0
0
_l2
def _l2(self, x):return np.sqrt(np.mean(np.array(x) ** 2))
1
2
2
26
0
517
518
517
self,x
[]
Returns
{"Return": 1}
3
2
3
["np.sqrt", "np.mean", "np.array"]
0
[]
The function (_l2) defined within the public class called MultiChDloaderRef.The function start at line 517 and ends at 518. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [517.0], and this function return a value. It declares 3.0 functions, and It has 3.0 fun...
CAREamics_careamics
MultiChDloaderRef
public
0
0
compute_mean_std
def compute_mean_std(self, allow_for_validation_data=False):"""Note that we must compute this only for training data."""if self._3Ddata:raise NotImplementedError("Not implemented for 3D data")if self._input_is_sum:mean_tar_dict = defaultdict(list)std_tar_dict = defaultdict(list)mean_inp = []std_inp = []for _ in range(3...
7
33
2
324
0
520
563
520
self,allow_for_validation_data
[]
Returns
{"Assign": 14, "AugAssign": 1, "Expr": 8, "For": 4, "If": 2, "Return": 1}
37
44
37
["NotImplementedError", "defaultdict", "defaultdict", "range", "range", "len", "self.sample_crop", "append", "np.mean", "append", "np.std", "crops.append", "mean_inp.append", "np.mean", "std_inp.append", "np.std", "defaultdict", "defaultdict", "len", "range", "append", "np.mean", "append", "self._l2", "reshape", "np.ar...
0
[]
The function (compute_mean_std) defined within the public class called MultiChDloaderRef.The function start at line 520 and ends at 563. It contains 33 lines of code and it has a cyclomatic complexity of 7. It takes 2 parameters, represented as [520.0], and this function return a value. It declares 37.0 functions, and ...
CAREamics_careamics
MultiChDloaderRef
public
0
0
set_mean_std
def set_mean_std(self, mean_val, std_val):self._mean = mean_valself._std = std_val
1
3
3
19
0
565
567
456
self,mean_val,std_val
[]
None
{"Assign": 2}
0
3
0
[]
0
[]
The function (set_mean_std) defined within the public class called MultiChDloaderRef.The function start at line 565 and ends at 567. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [456.0] and does not return any value..
CAREamics_careamics
MultiChDloaderRef
public
0
0
get_mean_std
def get_mean_std(self):return self._mean, self._std
1
2
1
13
0
569
570
453
self
[]
Returns
{"Return": 1}
0
2
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.dataset.multifile_dataset_py.MultiFileDset.get_mean_std"]
The function (get_mean_std) defined within the public class called MultiChDloaderRef.The function start at line 569 and ends at 570. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters, and this function return a value. It has 1.0 function calling this function...
CAREamics_careamics
MultiChDloaderRef
public
0
0
_get_random_hw
def _get_random_hw(self, h: int, w: int):"""Random starting position for the crop for the img with index `index`."""if h != self._img_sz:h_start = np.random.choice(h - self._img_sz)w_start = np.random.choice(w - self._img_sz)else:h_start = 0w_start = 0return h_start, w_start
2
8
3
61
0
572
582
572
self,h,w
[]
Returns
{"Assign": 4, "Expr": 1, "If": 1, "Return": 1}
2
11
2
["np.random.choice", "np.random.choice"]
0
[]
The function (_get_random_hw) defined within the public class called MultiChDloaderRef.The function start at line 572 and ends at 582. It contains 8 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [572.0], and this function return a value. It declares 2.0 functions, and It ...