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
HyperParametersCallback
public
0
1
__init__
def __init__(self, config: Configuration) -> None:"""Constructor.Parameters----------config : ConfigurationCAREamics configuration to be saved as hyperparameter in the model."""self.config = config
1
2
2
17
0
27
36
27
self,config
[]
None
{"Assign": 1, "Expr": 1}
0
10
0
[]
8,182
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.15197461_googleapis_python_cloud_core.google.cloud._helpers.__init___py._LocalStack.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16798231_kapji_capital_gains_calculator.cgt_calc.exceptions_py.AmountMissi...
The function (__init__) defined within the public class called HyperParametersCallback, that inherit another class.The function start at line 27 and ends at 36. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [27.0] and does not return any value. It has 8182.0 ...
CAREamics_careamics
HyperParametersCallback
public
0
1
on_train_start
def on_train_start(self, trainer: Trainer, pl_module: LightningModule) -> None:"""Update the hyperparameters of the model with the configuration on train start.Parameters----------trainer : TrainerPyTorch Lightning trainer, unused.pl_module : LightningModulePyTorch Lightning module."""pl_module.hparams.update(self.conf...
1
2
3
30
0
38
49
38
self,trainer,pl_module
[]
None
{"Expr": 2}
2
12
2
["pl_module.hparams.update", "self.config.model_dump"]
0
[]
The function (on_train_start) defined within the public class called HyperParametersCallback, that inherit another class.The function start at line 38 and ends at 49. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [38.0] and does not return any value. It decla...
CAREamics_careamics
ProgressBarCallback
public
0
1
init_train_tqdm
def init_train_tqdm(self) -> tqdm:"""Override this to customize the tqdm bar for training.Returns-------tqdmA tqdm bar."""bar = tqdm(desc="Training",position=(2 * self.process_position),disable=self.is_disabled,leave=True,dynamic_ncols=True,file=sys.stdout,smoothing=0,)return bar
1
11
1
53
0
14
31
14
self
[]
tqdm
{"Assign": 1, "Expr": 1, "Return": 1}
1
18
1
["tqdm"]
0
[]
The function (init_train_tqdm) defined within the public class called ProgressBarCallback, that inherit another class.The function start at line 14 and ends at 31. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1....
CAREamics_careamics
ProgressBarCallback
public
0
1
init_validation_tqdm
def init_validation_tqdm(self) -> tqdm:"""Override this to customize the tqdm bar for validation.Returns-------tqdmA tqdm bar."""# The main progress bar doesn't exist in `trainer.validate()`has_main_bar = self.train_progress_bar is not Nonebar = tqdm(desc="Validating",position=(2 * self.process_position + has_main_bar)...
1
11
1
59
0
33
51
33
self
[]
tqdm
{"Assign": 2, "Expr": 1, "Return": 1}
1
19
1
["tqdm"]
0
[]
The function (init_validation_tqdm) defined within the public class called ProgressBarCallback, that inherit another class.The function start at line 33 and ends at 51. 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 decla...
CAREamics_careamics
ProgressBarCallback
public
0
1
init_test_tqdm
def init_test_tqdm(self) -> tqdm:"""Override this to customize the tqdm bar for testing.Returns-------tqdmA tqdm bar."""bar = tqdm(desc="Testing",position=(2 * self.process_position),disable=self.is_disabled,leave=True,dynamic_ncols=False,ncols=100,file=sys.stdout,)return bar
1
11
1
53
0
53
70
53
self
[]
tqdm
{"Assign": 1, "Expr": 1, "Return": 1}
1
18
1
["tqdm"]
0
[]
The function (init_test_tqdm) defined within the public class called ProgressBarCallback, that inherit another class.The function start at line 53 and ends at 70. It contains 11 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0...
CAREamics_careamics
ProgressBarCallback
public
0
1
get_metrics
def get_metrics(self, trainer: Trainer, pl_module: LightningModule) -> dict[str, Union[int, str, float, dict[str, float]]]:"""Override this to customize the metrics displayed in the progress bar.Parameters----------trainer : TrainerThe trainer object.pl_module : LightningModuleThe LightningModule object, unused.Returns...
1
5
3
45
0
72
90
72
self,trainer,pl_module
[]
dict[str, Union[int, str, float, dict[str, float]]]
{"Assign": 1, "Expr": 1, "Return": 1}
0
19
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3704533_opentsdb_tcollector.collectors.available.software.long_lived.mapr_metrics_py.Metrics2TSD.run"]
The function (get_metrics) defined within the public class called ProgressBarCallback, that inherit another class.The function start at line 72 and ends at 90. It contains 5 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [72.0] and does not return any value. It has 1.0 func...
CAREamics_careamics
public
public
0
0
get_sample_file_path
def get_sample_file_path(dataset: Union[IterableTiledPredDataset, IterablePredDataset], sample_id: int) -> Path:"""Get the file path for a particular sample.Parameters----------dataset : IterableTiledPredDataset or IterablePredDatasetDataset.sample_id : intSample ID, the index of the file in the dataset `dataset`.Retur...
1
4
2
26
0
10
28
10
dataset,sample_id
[]
Path
{"Expr": 1, "Return": 1}
0
19
0
[]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.callbacks.prediction_writer_callback.write_strategy_py.CacheTiles.write_batch", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.car...
The function (get_sample_file_path) defined within the public class called public.The function start at line 10 and ends at 28. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [10.0] and does not return any value. It has 4.0 functions calling this function whic...
CAREamics_careamics
public
public
0
0
create_write_file_path
def create_write_file_path(dirpath: Path, file_path: Path, write_extension: str) -> Path:"""Create the file name for the output file.Takes the original file path, changes the directory to `dirpath` and changesthe extension to `write_extension`.Parameters----------dirpath : pathlib.PathThe output directory to write file...
1
6
3
38
2
31
56
31
dirpath,file_path,write_extension
['file_path', 'file_name']
Path
{"Assign": 2, "Expr": 1, "Return": 1}
2
26
2
["with_suffix", "Path"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.callbacks.prediction_writer_callback.write_strategy_py.CacheTiles.write_batch", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.car...
The function (create_write_file_path) defined within the public class called public.The function start at line 31 and ends at 56. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [31.0] and does not return any value. It declares 2.0 functions, It has 2.0 functio...
CAREamics_careamics
PredictionWriterCallback
public
0
1
__init__
def __init__(self,write_strategy: WriteStrategy,dirpath: Union[Path, str] = "predictions",):"""A PyTorch Lightning callback to save predictions.Parameters----------write_strategy : WriteStrategyA strategy for writing predictions.dirpath : pathlib.Path or str, default="predictions"The path to the directory where predict...
1
10
3
57
0
53
80
53
self,write_strategy,dirpath
[]
None
{"AnnAssign": 3, "Expr": 3}
3
28
3
["__init__", "super", "self._init_dirpath"]
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 PredictionWriterCallback, that inherit another class.The function start at line 53 and ends at 80. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [53.0] and does not return any value. It declares ...
CAREamics_careamics
PredictionWriterCallback
public
0
1
from_write_func_params
def from_write_func_params(cls,write_type: SupportedWriteType,tiled: bool,write_func: WriteFunc | None = None,write_extension: str | None = None,write_func_kwargs: dict[str, Any] | None = None,dirpath: Union[Path, str] = "predictions",) -> PredictionWriterCallback:# TODO: change type hint to self (find out how)"""Initi...
1
17
7
93
0
83
129
83
cls,write_type,tiled,write_func,write_extension,write_func_kwargs,dirpath
[]
PredictionWriterCallback
{"Assign": 1, "Expr": 1, "Return": 1}
2
47
2
["create_write_strategy", "cls"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.lightning.callbacks.prediction_writer_callback.test_prediction_writer_callback_py.test_from_write_func_params"]
The function (from_write_func_params) defined within the public class called PredictionWriterCallback, that inherit another class.The function start at line 83 and ends at 129. It contains 17 lines of code and it has a cyclomatic complexity of 1. It takes 7 parameters, represented as [83.0] and does not return any valu...
CAREamics_careamics
PredictionWriterCallback
public
0
1
_init_dirpath
def _init_dirpath(self, dirpath):"""Initialize directory path. Should only be called from `__init__`.Parameters----------dirpath : pathlib.PathSee `__init__` description."""dirpath = Path(dirpath)if not dirpath.is_absolute():dirpath = Path.cwd() / dirpathlogger.warning("Prediction output directory is not absolute, abso...
2
9
2
44
0
131
147
131
self,dirpath
[]
None
{"Assign": 3, "Expr": 2, "If": 1}
4
17
4
["Path", "dirpath.is_absolute", "Path.cwd", "logger.warning"]
0
[]
The function (_init_dirpath) defined within the public class called PredictionWriterCallback, that inherit another class.The function start at line 131 and ends at 147. It contains 9 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [131.0] and does not return any value. It de...
CAREamics_careamics
PredictionWriterCallback
public
0
1
setup
def setup(self, trainer: Trainer, pl_module: LightningModule, stage: str) -> None:"""Create the prediction output directory when predict begins.Called when fit, validate, test, predict, or tune begins.Parameters----------trainer : TrainerPyTorch Lightning trainer.pl_module : LightningModulePyTorch Lightning module.stag...
2
5
4
57
0
149
168
149
self,trainer,pl_module,stage
[]
None
{"Expr": 4, "If": 1}
4
20
4
["setup", "super", "logger.info", "self.dirpath.mkdir"]
23
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16418165_szabgab_pydigger_com.PyDigger.fetch_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3584344_influxgraph_influxgraph.setup_py.run_setup", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output....
The function (setup) defined within the public class called PredictionWriterCallback, that inherit another class.The function start at line 149 and ends at 168. It contains 5 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [149.0] and does not return any value. It declares 4...
CAREamics_careamics
PredictionWriterCallback
public
0
1
write_on_batch_end
def write_on_batch_end(self,trainer: Trainer,pl_module: LightningModule,prediction: Any,# TODO: change to expected typebatch_indices: Sequence[int] | None,batch: Any,# TODO: change to expected typebatch_idx: int,dataloader_idx: int,) -> None:"""Write predictions at the end of a batch.The method of prediction is determi...
5
38
8
156
0
170
234
170
self,trainer,pl_module,prediction,batch_indices,batch,batch_idx,dataloader_idx
[]
None
{"AnnAssign": 3, "Expr": 2, "If": 2, "Return": 1}
5
65
5
["isinstance", "isinstance", "isinstance", "TypeError", "self.write_strategy.write_batch"]
0
[]
The function (write_on_batch_end) defined within the public class called PredictionWriterCallback, that inherit another class.The function start at line 170 and ends at 234. It contains 38 lines of code and it has a cyclomatic complexity of 5. It takes 8 parameters, represented as [170.0] and does not return any value....
CAREamics_careamics
WriteStrategy
public
1
1
write_batch
def write_batch(self,trainer: Trainer,pl_module: LightningModule,prediction: Any,# TODO: change to expected typebatch_indices: Sequence[int] | None,batch: Any,# TODO: change to expected typebatch_idx: int,dataloader_idx: int,dirpath: Path,) -> None:"""WriteStrategy subclasses must contain this function to write a batch...
1
11
9
46
0
23
55
23
self,trainer,pl_module,prediction,batch_indices,batch,batch_idx,dataloader_idx,dirpath
[]
None
{"Expr": 1}
0
33
0
[]
0
[]
The function (write_batch) defined within the public class called WriteStrategy, implement an interface, and it inherit another class.The function start at line 23 and ends at 55. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [23.0] and does not return any v...
CAREamics_careamics
CacheTiles
public
0
1
__init__
def __init__(self,write_func: WriteFunc,write_extension: str,write_func_kwargs: dict[str, Any],) -> None:"""A write strategy that will cache tiles.Tiles are cached until a whole image is predicted on. Then the stitchedprediction is saved.Parameters----------write_func : WriteFuncFunction used to save predictions.write_...
1
12
4
81
0
88
117
88
self,write_func,write_extension,write_func_kwargs
[]
None
{"AnnAssign": 5, "Expr": 2}
2
30
2
["__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 CacheTiles, that inherit another class.The function start at line 88 and ends at 117. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [88.0] and does not return any value. It declares 2.0 functions...
CAREamics_careamics
CacheTiles
public
0
1
last_tiles
def last_tiles(self) -> list[bool]:"""List of bool to determine whether each tile in the cache is the last tile.Returns-------list of boolWhether each tile in the tile cache is the last tile."""return [tile_info.last_tile for tile_info in self.tile_info_cache]
2
2
1
23
0
120
129
120
self
[]
list[bool]
{"Expr": 1, "Return": 1}
0
10
0
[]
0
[]
The function (last_tiles) defined within the public class called CacheTiles, that inherit another class.The function start at line 120 and ends at 129. It contains 2 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value..
CAREamics_careamics
WriteStrategy
public
1
1
write_batch
def write_batch(self,trainer: Trainer,pl_module: LightningModule,prediction: tuple[NDArray, list[TileInformation]],batch_indices: Sequence[int] | None,batch: tuple[NDArray, list[TileInformation]],batch_idx: int,dataloader_idx: int,dirpath: Path,) -> None:"""Cache tiles until the last tile is predicted; save the stitche...
4
38
9
246
0
131
200
131
self,trainer,pl_module,prediction,batch_indices,batch,batch_idx,dataloader_idx,dirpath
[]
None
{"Expr": 1}
0
33
0
[]
0
[]
The function (write_batch) defined within the public class called WriteStrategy, implement an interface, and it inherit another class.The function start at line 131 and ends at 200. It contains 38 lines of code and it has a cyclomatic complexity of 4. It takes 9 parameters, represented as [131.0] and does not return an...
CAREamics_careamics
CacheTiles
public
0
1
_has_last_tile
def _has_last_tile(self) -> bool:"""Whether a last tile is contained in the cached tiles.Returns-------boolWhether a last tile is contained in the cached tiles."""return any(self.last_tiles)
1
2
1
15
0
202
211
202
self
[]
bool
{"Expr": 1, "Return": 1}
1
10
1
["any"]
0
[]
The function (_has_last_tile) defined within the public class called CacheTiles, that inherit another class.The function start at line 202 and ends at 211. It contains 2 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1.0 functio...
CAREamics_careamics
CacheTiles
public
0
1
_clear_cache
def _clear_cache(self) -> None:"""Remove the tiles in the cache up to the first last tile."""index = self._last_tile_index()self.tile_cache = self.tile_cache[index + 1 :]self.tile_info_cache = self.tile_info_cache[index + 1 :]
1
4
1
41
0
213
217
213
self
[]
None
{"Assign": 3, "Expr": 1}
1
5
1
["self._last_tile_index"]
0
[]
The function (_clear_cache) defined within the public class called CacheTiles, that inherit another class.The function start at line 213 and ends at 217. 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 declare 1.0 function,...
CAREamics_careamics
CacheTiles
public
0
1
_last_tile_index
def _last_tile_index(self) -> int:"""Find the index of the last tile in the tile cache.Returns-------intIndex of last tile.Raises------ValueErrorIf there is no last tile in the tile cache."""last_tiles = self.last_tilesif not any(last_tiles):raise ValueError("No last tile in the tile cache.")index = np.where(last_tiles...
2
6
1
41
0
219
237
219
self
[]
int
{"Assign": 2, "Expr": 1, "If": 1, "Return": 1}
3
19
3
["any", "ValueError", "np.where"]
0
[]
The function (_last_tile_index) defined within the public class called CacheTiles, that inherit another class.The function start at line 219 and ends at 237. It contains 6 lines of code and it has a cyclomatic complexity of 2. The function does not take any parameters and does not return any value. It declares 3.0 func...
CAREamics_careamics
CacheTiles
public
0
1
_get_image_tiles
def _get_image_tiles(self) -> tuple[list[NDArray], list[TileInformation]]:"""Get the tiles corresponding to a single image.Returns-------tuple of (list of numpy.ndarray, list of TileInformation)Tiles and tile information to stitch together a full image."""index = self._last_tile_index()tiles = self.tile_cache[: index +...
1
5
1
52
0
239
251
239
self
[]
tuple[list[NDArray], list[TileInformation]]
{"Assign": 3, "Expr": 1, "Return": 1}
1
13
1
["self._last_tile_index"]
0
[]
The function (_get_image_tiles) defined within the public class called CacheTiles, that inherit another class.The function start at line 239 and ends at 251. 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 funct...
CAREamics_careamics
WriteStrategy
public
1
1
write_batch
def write_batch(self,trainer: Trainer,pl_module: LightningModule,prediction: Any,batch_indices: Sequence[int] | None,batch: Any,batch_idx: int,dataloader_idx: int,dirpath: Path,) -> None:"""Write tiles to zarr file.Parameters----------trainer : TrainerPyTorch Lightning Trainer.pl_module : LightningModulePyTorch Lightni...
1
12
9
48
0
257
294
257
self,trainer,pl_module,prediction,batch_indices,batch,batch_idx,dataloader_idx,dirpath
[]
None
{"Expr": 1}
0
33
0
[]
0
[]
The function (write_batch) defined within the public class called WriteStrategy, implement an interface, and it inherit another class.The function start at line 257 and ends at 294. It contains 12 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [257.0] and does not return an...
CAREamics_careamics
CacheTiles
public
0
1
__init__
def __init__(self,write_func: WriteFunc,write_extension: str,write_func_kwargs: dict[str, Any],) -> None:"""A strategy for writing image predictions (i.e. un-tiled predictions).Parameters----------write_func : WriteFuncFunction used to save predictions.write_extension : strExtension added to prediction file paths.write...
1
10
4
59
0
320
342
320
self,write_func,write_extension,write_func_kwargs
[]
None
{"AnnAssign": 5, "Expr": 2}
2
30
2
["__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 CacheTiles, that inherit another class.The function start at line 320 and ends at 342. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [320.0] and does not return any value. It declares 2.0 functio...
CAREamics_careamics
WriteStrategy
public
1
1
write_batch
def write_batch(self,trainer: Trainer,pl_module: LightningModule,prediction: NDArray,batch_indices: Sequence[int] | None,batch: NDArray,batch_idx: int,dataloader_idx: int,dirpath: Path,) -> None:"""Save full images.Parameters----------trainer : TrainerPyTorch Lightning Trainer.pl_module : LightningModulePyTorch Lightni...
4
28
9
175
0
344
399
344
self,trainer,pl_module,prediction,batch_indices,batch,batch_idx,dataloader_idx,dirpath
[]
None
{"Expr": 1}
0
33
0
[]
0
[]
The function (write_batch) defined within the public class called WriteStrategy, implement an interface, and it inherit another class.The function start at line 344 and ends at 399. It contains 28 lines of code and it has a cyclomatic complexity of 4. It takes 9 parameters, represented as [344.0] and does not return an...
CAREamics_careamics
public
public
0
0
create_write_strategy
def create_write_strategy(write_type: SupportedWriteType,tiled: bool,write_func: WriteFunc | None = None,write_extension: str | None = None,write_func_kwargs: dict[str, Any] | None = None,) -> WriteStrategy:"""Create a write strategy from convenient parameters.Parameters----------write_type : {"tiff", "custom"}The data...
3
28
5
126
4
11
76
11
write_type,tiled,write_func,write_extension,write_func_kwargs
['write_func', 'write_extension', 'write_strategy', 'write_func_kwargs']
WriteStrategy
{"AnnAssign": 1, "Assign": 5, "Expr": 1, "If": 2, "Return": 1}
4
66
4
["select_write_func", "select_write_extension", "WriteImage", "_create_tiled_write_strategy"]
7
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.callbacks.prediction_writer_callback.prediction_writer_callback_py.PredictionWriterCallback.from_write_func_params", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3...
The function (create_write_strategy) defined within the public class called public.The function start at line 11 and ends at 76. It contains 28 lines of code and it has a cyclomatic complexity of 3. It takes 5 parameters, represented as [11.0] and does not return any value. It declares 4.0 functions, It has 4.0 functio...
CAREamics_careamics
public
public
0
0
_create_tiled_write_strategy
def _create_tiled_write_strategy(write_type: SupportedWriteType,write_func: WriteFunc | None,write_extension: str | None,write_func_kwargs: dict[str, Any],) -> WriteStrategy:"""Create a tiled write strategy.Either `CacheTiles` for caching tiles until a whole image is predicted or`WriteTilesZarr` for writing tiles direc...
2
18
4
84
2
79
129
79
write_type,write_func,write_extension,write_func_kwargs
['write_func', 'write_extension']
WriteStrategy
{"Assign": 2, "Expr": 1, "If": 1, "Return": 1}
4
51
4
["NotImplementedError", "select_write_func", "select_write_extension", "CacheTiles"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.callbacks.prediction_writer_callback.write_strategy_factory_py.create_write_strategy"]
The function (_create_tiled_write_strategy) defined within the public class called public.The function start at line 79 and ends at 129. It contains 18 lines of code and it has a cyclomatic complexity of 2. It takes 4 parameters, represented as [79.0] and does not return any value. It declares 4.0 functions, It has 4.0...
CAREamics_careamics
public
public
0
0
select_write_func
def select_write_func(write_type: SupportedWriteType, write_func: WriteFunc | None = None) -> WriteFunc:"""Return a function to write images.If `write_type` is "custom" then `write_func`, otherwise the known write functionis selected.Parameters----------write_type : {"tiff", "custom"}The data type to save as, includes ...
3
13
2
50
1
132
176
132
write_type,write_func
['write_func']
WriteFunc
{"Assign": 2, "Expr": 1, "If": 2, "Return": 1}
2
45
2
["ValueError", "get_write_func"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.callbacks.prediction_writer_callback.write_strategy_factory_py._create_tiled_write_strategy", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_car...
The function (select_write_func) defined within the public class called public.The function start at line 132 and ends at 176. It contains 13 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [132.0] and does not return any value. It declares 2.0 functions, It has 2.0 function...
CAREamics_careamics
public
public
0
0
select_write_extension
def select_write_extension(write_type: SupportedWriteType, write_extension: str | None = None) -> str:"""Return an extension to add to file paths.If `write_type` is "custom" then `write_extension`, otherwise the knownwrite extension is selected.Parameters----------write_type : {"tiff", "custom"}The data type to save as...
3
12
2
60
1
179
215
179
write_type,write_extension
['write_extension']
str
{"AnnAssign": 1, "Assign": 2, "Expr": 1, "If": 2, "Return": 1}
3
37
3
["SupportedData", "ValueError", "write_type_.get_extension"]
4
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.callbacks.prediction_writer_callback.write_strategy_factory_py._create_tiled_write_strategy", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_car...
The function (select_write_extension) defined within the public class called public.The function start at line 179 and ends at 215. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [179.0] and does not return any value. It declares 3.0 functions, It has 3.0 fun...
CAREamics_careamics
CareamicsDataModule
public
0
1
__init__
def __init__(self,data_config: NGDataConfig,*,train_data: Any | None = None,train_data_target: Any | None = None,val_data: Any | None = None,val_data_target: Any | None = None,pred_data: Any | None = None,pred_data_target: Any | None = None,read_source_func: Callable | None = None,read_kwargs: dict[str, Any] | None = N...
5
46
16
286
0
178
278
178
self,data_config,train_data,train_data_target,val_data,val_data_target,pred_data,pred_data_target,extension_filter,val_percentage,val_minimum_split,use_in_memory
[]
None
{"Expr": 1}
0
15
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 CareamicsDataModule, that inherit another class.The function start at line 178 and ends at 278. It contains 46 lines of code and it has a cyclomatic complexity of 5. It takes 16 parameters, represented as [178.0] and does not return any value. It has 8182.0...
CAREamics_careamics
CareamicsDataModule
public
0
1
_validate_input_target_type_consistency
def _validate_input_target_type_consistency(self,input_data: InputType,target_data: InputType | None,) -> None:"""Validate if the input and target data types are consistent.Parameters----------input_data : InputTypeInput data, can be a path to a folder, a list of paths, or a numpy array.target_data : Optional[InputType...
8
22
3
110
0
280
311
280
self,input_data,target_data
[]
None
{"Expr": 1, "If": 5}
17
32
17
["isinstance", "type", "ValueError", "type", "type", "isinstance", "isinstance", "len", "len", "ValueError", "len", "len", "isinstance", "type", "ValueError", "type", "type"]
0
[]
The function (_validate_input_target_type_consistency) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 280 and ends at 311. It contains 22 lines of code and it has a cyclomatic complexity of 8. It takes 3 parameters, represented as [280.0] and does not r...
CAREamics_careamics
CareamicsDataModule
public
0
1
_list_files_in_directory
def _list_files_in_directory(self,input_data,target_data=None,) -> tuple[list[Path], list[Path] | None]:"""List files from input and target directories.Parameters----------input_data : InputTypeInput data, can be a path to a folder, a list of paths, or a numpy array.target_data : Optional[InputType]Target data, can be ...
2
16
3
89
0
313
344
313
self,input_data,target_data
[]
tuple[list[Path], list[Path] | None]
{"Assign": 4, "Expr": 2, "If": 1, "Return": 2}
5
32
5
["Path", "list_files", "Path", "list_files", "validate_source_target_files"]
0
[]
The function (_list_files_in_directory) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 313 and ends at 344. It contains 16 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [313.0] and does not return any value...
CAREamics_careamics
CareamicsDataModule
public
0
1
_convert_paths_to_pathlib
def _convert_paths_to_pathlib(self,input_data,target_data=None,) -> tuple[list[Path], list[Path] | None]:"""Create a list of file paths from the input and target data.Parameters----------input_data : InputTypeInput data, can be a path to a folder, a list of paths, or a numpy array.target_data : Optional[InputType]Targe...
6
16
3
91
0
346
377
346
self,input_data,target_data
[]
tuple[list[Path], list[Path] | None]
{"Assign": 2, "Expr": 2, "If": 1, "Return": 2}
5
32
5
["isinstance", "Path", "isinstance", "Path", "validate_source_target_files"]
0
[]
The function (_convert_paths_to_pathlib) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 346 and ends at 377. It contains 16 lines of code and it has a cyclomatic complexity of 6. It takes 3 parameters, represented as [346.0] and does not return any valu...
CAREamics_careamics
CareamicsDataModule
public
0
1
_validate_array_input
def _validate_array_input(self,input_data: InputType,target_data: InputType | None,) -> tuple[Any, Any]:"""Validate if the input data is a numpy array.Parameters----------input_data : InputTypeInput data, can be a path to a folder, a list of paths, or a numpy array.target_data : Optional[InputType]Target data, can be N...
4
15
3
75
0
379
408
379
self,input_data,target_data
[]
tuple[Any, Any]
{"Assign": 2, "Expr": 1, "If": 2, "Return": 2}
4
30
4
["isinstance", "isinstance", "ValueError", "type"]
0
[]
The function (_validate_array_input) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 379 and ends at 408. It contains 15 lines of code and it has a cyclomatic complexity of 4. It takes 3 parameters, represented as [379.0] and does not return any value. I...
CAREamics_careamics
CareamicsDataModule
public
0
1
_validate_path_input
def _validate_path_input(self, input_data: InputType, target_data: InputType | None) -> tuple[list[Path], list[Path] | None]:"""Validate if the input data is a path or a list of paths.Parameters----------input_data : InputTypeInput data, can be a path to a folder, a list of paths, or a numpy array.target_data : Optiona...
5
21
3
117
0
410
446
410
self,input_data,target_data
[]
tuple[list[Path], list[Path] | None]
{"Assign": 2, "Expr": 1, "If": 4, "Return": 2}
8
37
8
["isinstance", "isinstance", "self._list_files_in_directory", "isinstance", "isinstance", "self._convert_paths_to_pathlib", "ValueError", "type"]
0
[]
The function (_validate_path_input) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 410 and ends at 446. It contains 21 lines of code and it has a cyclomatic complexity of 5. It takes 3 parameters, represented as [410.0] and does not return any value. It...
CAREamics_careamics
CareamicsDataModule
public
0
1
_validate_custom_input
def _validate_custom_input(self, input_data, target_data) -> tuple[Any, Any]:"""Convert custom input data to a list of file paths.Parameters----------input_data : InputTypeInput data, can be a path to a folder, a list of paths, or a numpy array.target_data : Optional[InputType]Target data, can be None, a path to a fold...
7
24
3
134
0
448
487
448
self,input_data,target_data
[]
tuple[Any, Any]
{"Assign": 2, "Expr": 1, "If": 6, "Return": 4}
8
40
8
["isinstance", "isinstance", "self._list_files_in_directory", "isinstance", "isinstance", "isinstance", "self._convert_paths_to_pathlib", "ValueError"]
0
[]
The function (_validate_custom_input) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 448 and ends at 487. It contains 24 lines of code and it has a cyclomatic complexity of 7. It takes 3 parameters, represented as [448.0] and does not return any value. ...
CAREamics_careamics
CareamicsDataModule
public
0
1
_initialize_data_pair
def _initialize_data_pair(self,input_data: InputType | None,target_data: InputType | None,) -> tuple[Any, Any]:"""Initialize a pair of input and target data.Parameters----------input_data : InputTypeInput data, can be None, a path to a folder, a list of paths, or a numpyarray.target_data : Optional[InputType]Target dat...
11
42
3
227
0
489
552
489
self,input_data,target_data
[]
tuple[Any, Any]
{"Expr": 2, "If": 10, "Return": 6}
21
64
21
["self._validate_input_target_type_consistency", "isinstance", "self._validate_array_input", "isinstance", "isinstance", "self._validate_array_input", "ValueError", "type", "ValueError", "type", "isinstance", "self._validate_path_input", "isinstance", "isinstance", "self._validate_path_input", "ValueError", "type", "Va...
0
[]
The function (_initialize_data_pair) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 489 and ends at 552. It contains 42 lines of code and it has a cyclomatic complexity of 11. It takes 3 parameters, represented as [489.0] and does not return any value. ...
CAREamics_careamics
CareamicsDataModule
public
0
1
setup
def setup(self, stage: str) -> None:"""Setup datasets.Lightning hook that is called at the beginning of fit (train + validate),validate, test, or predict. Creates the datasets for a given stage.Parameters----------stage : strThe stage to set up datasets for.Is either 'fit', 'validate', 'test', or 'predict'.Raises------...
4
59
2
345
0
554
630
554
self,stage
[]
None
{"Assign": 7, "Expr": 2, "If": 3}
6
77
6
["create_dataset", "self.config.set_means_and_stds", "create_dataset", "create_dataset", "create_dataset", "NotImplementedError"]
23
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.16418165_szabgab_pydigger_com.PyDigger.fetch_py.main", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3584344_influxgraph_influxgraph.setup_py.run_setup", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output....
The function (setup) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 554 and ends at 630. It contains 59 lines of code and it has a cyclomatic complexity of 4. It takes 2 parameters, represented as [554.0] and does not return any value. It declares 6.0 f...
CAREamics_careamics
CareamicsDataModule
public
0
1
train_dataloader
def train_dataloader(self) -> DataLoader:"""Create a dataloader for training.Returns-------DataLoaderTraining dataloader."""return DataLoader(self.train_dataset,batch_size=self.batch_size,collate_fn=default_collate,**self.config.train_dataloader_params,)
1
7
1
33
0
632
646
632
self
[]
DataLoader
{"Expr": 1, "Return": 1}
1
15
1
["DataLoader"]
0
[]
The function (train_dataloader) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 632 and ends at 646. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare ...
CAREamics_careamics
CareamicsDataModule
public
0
1
val_dataloader
def val_dataloader(self) -> DataLoader:"""Create a dataloader for validation.Returns-------DataLoaderValidation dataloader."""return DataLoader(self.val_dataset,batch_size=self.batch_size,collate_fn=default_collate,**self.config.val_dataloader_params,)
1
7
1
33
0
648
662
648
self
[]
DataLoader
{"Expr": 1, "Return": 1}
1
15
1
["DataLoader"]
0
[]
The function (val_dataloader) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 648 and ends at 662. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declare 1....
CAREamics_careamics
CareamicsDataModule
public
0
1
predict_dataloader
def predict_dataloader(self) -> DataLoader:"""Create a dataloader for prediction.Returns-------DataLoaderPrediction dataloader."""return DataLoader(self.predict_dataset,batch_size=self.batch_size,collate_fn=default_collate,**self.config.test_dataloader_params,)
1
7
1
33
0
664
678
664
self
[]
DataLoader
{"Expr": 1, "Return": 1}
1
15
1
["DataLoader"]
0
[]
The function (predict_dataloader) defined within the public class called CareamicsDataModule, that inherit another class.The function start at line 664 and ends at 678. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declar...
CAREamics_careamics
CAREModule
public
0
1
__init__
def __init__(self, algorithm_config: Union[CAREAlgorithm, dict]) -> None:"""Instantiate CARE DataModule.Parameters----------algorithm_config : CAREAlgorithm or dictConfiguration for the CARE algorithm, either as a CAREAlgorithm instance ora dictionary."""super().__init__(algorithm_config)assert isinstance(algorithm_con...
3
12
2
75
0
28
47
28
self,algorithm_config
[]
None
{"AnnAssign": 1, "Assign": 2, "Expr": 2, "If": 2}
4
20
4
["__init__", "super", "isinstance", "ValueError"]
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 CAREModule, that inherit another class.The function start at line 28 and ends at 47. It contains 12 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [28.0] and does not return any value. It declares 4.0 functions,...
CAREamics_careamics
CAREModule
public
0
1
training_step
def training_step(self,batch: tuple[ImageRegionData, ImageRegionData],batch_idx: Any,) -> Any:"""Training step for CARE module.Parameters----------batch : (ImageRegionData, ImageRegionData)A tuple containing the input data and the target data.batch_idx : AnyThe index of the current batch in the training loop.Returns---...
1
10
3
76
0
49
76
49
self,batch,batch_idx
[]
Any
{"Assign": 3, "Expr": 2, "Return": 1}
3
28
3
["self.model", "self.loss_func", "self._log_training_stats"]
0
[]
The function (training_step) defined within the public class called CAREModule, that inherit another class.The function start at line 49 and ends at 76. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [49.0] and does not return any value. It declares 3.0 funct...
CAREamics_careamics
CAREModule
public
0
1
validation_step
def validation_step(self,batch: tuple[ImageRegionData, ImageRegionData],batch_idx: Any,) -> None:"""Validation step for CARE module.Parameters----------batch : (ImageRegionData, ImageRegionData)A tuple containing the input data and the target data.batch_idx : AnyThe index of the current batch in the training loop."""x,...
1
10
3
84
0
78
97
78
self,batch,batch_idx
[]
None
{"Assign": 3, "Expr": 3}
4
20
4
["self.model", "self.loss_func", "self.metrics", "self._log_validation_stats"]
0
[]
The function (validation_step) defined within the public class called CAREModule, that inherit another class.The function start at line 78 and ends at 97. It contains 10 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [78.0] and does not return any value. It declares 4.0 fun...
CAREamics_careamics
N2VModule
public
0
1
__init__
def __init__(self, algorithm_config: Union[N2VAlgorithm, dict]) -> None:"""Instantiate N2V DataModule.Parameters----------algorithm_config : N2VAlgorithm or dictConfiguration for the N2V algorithm, either as an N2VAlgorithm instance or adictionary."""super().__init__(algorithm_config)assert isinstance(algorithm_config,...
1
9
2
51
0
28
46
28
self,algorithm_config
[]
None
{"Assign": 2, "Expr": 2}
4
19
4
["__init__", "super", "isinstance", "N2VManipulateTorch"]
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 N2VModule, that inherit another class.The function start at line 28 and ends at 46. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [28.0] and does not return any value. It declares 4.0 functions, I...
CAREamics_careamics
N2VModule
public
0
1
_load_best_checkpoint
def _load_best_checkpoint(self) -> None:"""Load the best checkpoint for N2V model."""logger.warning("Loading best checkpoint for N2V model. Note that for N2V, ""the checkpoint with the best validation metrics may not necessarily ""have the best denoising performance.")super()._load_best_checkpoint()
1
7
1
23
0
48
55
48
self
[]
None
{"Expr": 3}
3
8
3
["logger.warning", "_load_best_checkpoint", "super"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.dataset_ng.lightning_modules.n2v_module_py.N2VModule._load_best_checkpoint"]
The function (_load_best_checkpoint) defined within the public class called N2VModule, that inherit another class.The function start at line 48 and ends at 55. It contains 7 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 3.0 fu...
CAREamics_careamics
N2VModule
public
0
1
training_step
def training_step(self,batch: Union[tuple[ImageRegionData], tuple[ImageRegionData, ImageRegionData]],batch_idx: Any,) -> Any:"""Training step for N2V model.Parameters----------batch : ImageRegionData or (ImageRegionData, ImageRegionData)A tuple containing the input data and the target data.batch_idx : AnyThe index of t...
1
11
3
89
0
57
83
57
self,batch,batch_idx
[]
Any
{"Assign": 4, "Expr": 2, "Return": 1}
4
27
4
["self.n2v_manipulate", "self.model", "self.loss_func", "self._log_training_stats"]
0
[]
The function (training_step) defined within the public class called N2VModule, that inherit another class.The function start at line 57 and ends at 83. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [57.0] and does not return any value. It declares 4.0 functi...
CAREamics_careamics
N2VModule
public
0
1
validation_step
def validation_step(self,batch: Union[tuple[ImageRegionData], tuple[ImageRegionData, ImageRegionData]],batch_idx: Any,) -> None:"""Validation step for N2V model.Parameters----------batch : ImageRegionData or (ImageRegionData, ImageRegionData)A tuple containing the input data and the target data.batch_idx : AnyThe index...
1
11
3
95
0
85
106
85
self,batch,batch_idx
[]
None
{"Assign": 4, "Expr": 3}
5
22
5
["self.n2v_manipulate", "self.model", "self.loss_func", "self.metrics", "self._log_validation_stats"]
0
[]
The function (validation_step) defined within the public class called N2VModule, that inherit another class.The function start at line 85 and ends at 106. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [85.0] and does not return any value. It declares 5.0 fun...
CAREamics_careamics
UnetModule
public
0
1
__init__
def __init__(self, algorithm_config: Union[CAREAlgorithm, N2VAlgorithm, N2NAlgorithm, dict]) -> None:"""Instantiate UNet DataModule.Parameters----------algorithm_config : CAREAlgorithm, N2VAlgorithm, N2NAlgorithm, or dictConfiguration for the algorithm, either as an instance of a specificalgorithm class or a dictionary...
2
10
2
81
0
32
55
32
self,algorithm_config
[]
None
{"AnnAssign": 1, "Assign": 4, "Expr": 2, "If": 1}
8
24
8
["__init__", "super", "isinstance", "algorithm_factory", "UNet", "algorithm_config.model.model_dump", "MetricCollection", "PeakSignalNoiseRatio"]
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 UnetModule, that inherit another class.The function start at line 32 and ends at 55. It contains 10 lines of code and it has a cyclomatic complexity of 2. It takes 2 parameters, represented as [32.0] and does not return any value. It declares 8.0 functions,...
CAREamics_careamics
UnetModule
public
0
1
forward
def forward(self, x: Any) -> Any:"""Default forward method.Parameters----------x : AnyInput data.Returns-------AnyOutput from the model."""return self.model(x)
1
2
2
19
0
57
70
57
self,x
[]
Any
{"Expr": 1, "Return": 1}
1
14
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 UnetModule, that inherit another class.The function start at line 57 and ends at 70. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [57.0] and does not return any value. It declare 1.0 function, It ...
CAREamics_careamics
UnetModule
public
0
1
_log_training_stats
def _log_training_stats(self, loss: Any, batch_size: Any) -> None:"""Log training statistics.Parameters----------loss : AnyThe loss value for the current training step.batch_size : AnyThe size of the batch used in the current training step."""self.log("train_loss",loss,on_step=True,on_epoch=True,prog_bar=True,logger=Tr...
2
23
3
112
0
72
104
72
self,loss,batch_size
[]
None
{"Assign": 3, "Expr": 3, "If": 1}
4
33
4
["self.log", "self.optimizers", "isinstance", "self.log"]
0
[]
The function (_log_training_stats) defined within the public class called UnetModule, that inherit another class.The function start at line 72 and ends at 104. It contains 23 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [72.0] and does not return any value. It declares 4....
CAREamics_careamics
UnetModule
public
0
1
_log_validation_stats
def _log_validation_stats(self, loss: Any, batch_size: Any) -> None:"""Log validation statistics.Parameters----------loss : AnyThe loss value for the current validation step.batch_size : AnyThe size of the batch used in the current validation step."""self.log("val_loss",loss,on_step=False,on_epoch=True,prog_bar=True,lo...
1
11
3
65
0
106
125
106
self,loss,batch_size
[]
None
{"Expr": 3}
2
20
2
["self.log", "self.log_dict"]
0
[]
The function (_log_validation_stats) defined within the public class called UnetModule, that inherit another class.The function start at line 106 and ends at 125. It contains 11 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [106.0] and does not return any value. It declare...
CAREamics_careamics
UnetModule
public
0
1
_load_best_checkpoint
def _load_best_checkpoint(self) -> None:"""Load the best checkpoint from the trainer's checkpoint callback."""if (not hasattr(self.trainer, "checkpoint_callback")or self.trainer.checkpoint_callback is None):logger.warning("No checkpoint callback found, cannot load best checkpoint.")returnbest_model_path = self.trainer....
5
14
1
88
0
127
142
127
self
[]
None
{"Assign": 2, "Expr": 5, "If": 2, "Return": 1}
6
16
6
["hasattr", "logger.warning", "logger.info", "torch.load", "self.load_state_dict", "logger.warning"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.dataset_ng.lightning_modules.n2v_module_py.N2VModule._load_best_checkpoint"]
The function (_load_best_checkpoint) defined within the public class called UnetModule, that inherit another class.The function start at line 127 and ends at 142. It contains 14 lines of code and it has a cyclomatic complexity of 5. The function does not take any parameters and does not return any value. It declares 6....
CAREamics_careamics
UnetModule
public
0
1
predict_step
def predict_step(self,batch: Union[tuple[ImageRegionData], tuple[ImageRegionData, ImageRegionData]],batch_idx: Any,load_best_checkpoint=False,) -> Any:"""Default predict step.Parameters----------batch : ImageRegionData or (ImageRegionData, ImageRegionData)A tuple containing the input data and optionally the target data...
3
27
4
159
0
144
190
144
self,batch,batch_idx,load_best_checkpoint
[]
Any
{"Assign": 8, "Expr": 2, "If": 1, "Return": 1}
7
47
7
["self._load_best_checkpoint", "numpy", "cpu", "self.model", "Denormalize", "denormalize", "ImageRegionData"]
0
[]
The function (predict_step) defined within the public class called UnetModule, that inherit another class.The function start at line 144 and ends at 190. It contains 27 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [144.0] and does not return any value. It declares 7.0 fun...
CAREamics_careamics
UnetModule
public
0
1
configure_optimizers
def configure_optimizers(self) -> Any:"""Configure optimizers.Returns-------AnyA dictionary containing the optimizer and learning rate scheduler."""optimizer_func = get_optimizer(self.config.optimizer.name)optimizer = optimizer_func(self.model.parameters(), **self.config.optimizer.parameters)scheduler_func = get_schedu...
1
12
1
83
0
192
212
192
self
[]
Any
{"Assign": 4, "Expr": 1, "Return": 1}
5
21
5
["get_optimizer", "optimizer_func", "self.model.parameters", "get_scheduler", "scheduler_func"]
0
[]
The function (configure_optimizers) defined within the public class called UnetModule, that inherit another class.The function start at line 192 and ends at 212. It contains 12 lines of code and it has a cyclomatic complexity of 1. The function does not take any parameters and does not return any value. It declares 5.0...
CAREamics_careamics
public
public
0
0
loss_factory
def loss_factory(loss: Union[SupportedLoss, str]) -> Callable:"""Return loss function.Parameters----------loss : Union[SupportedLoss, str]Requested loss.Returns-------CallableLoss function.Raises------NotImplementedErrorIf the loss is unknown."""if loss == SupportedLoss.N2V:return n2v_loss# elif loss_type == SupportedL...
8
17
1
86
0
37
80
37
loss
[]
Callable
{"Expr": 1, "If": 7, "Return": 7}
1
44
1
["NotImplementedError"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.lightning_module_py.FCNModule.__init__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lightning.lightning_module_py.VA...
The function (loss_factory) defined within the public class called public.The function start at line 37 and ends at 80. It contains 17 lines of code and it has a cyclomatic complexity of 8. 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
public
public
0
0
mse_loss
def mse_loss(source: torch.Tensor, target: torch.Tensor, *args) -> torch.Tensor:"""Mean squared error loss.Parameters----------source : torch.TensorSource patches.target : torch.TensorTarget patches.*args : AnyAdditional arguments.Returns-------torch.TensorLoss value."""loss = MSELoss()return loss(source, target)
1
3
3
35
1
11
30
11
source,target,*args
['loss']
torch.Tensor
{"Assign": 1, "Expr": 1, "Return": 1}
2
20
2
["MSELoss", "loss"]
0
[]
The function (mse_loss) defined within the public class called public.The function start at line 11 and ends at 30. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [11.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions called...
CAREamics_careamics
public
public
0
0
n2v_loss
def n2v_loss(manipulated_batch: torch.Tensor,original_batch: torch.Tensor,masks: torch.Tensor,*args,) -> torch.Tensor:"""N2V Loss function described in A Krull et al 2018.Parameters----------manipulated_batch : torch.TensorBatch after manipulation function applied.original_batch : torch.TensorOriginal images.masks : to...
1
9
4
58
2
33
61
33
manipulated_batch,original_batch,masks,*args
['errors', 'loss']
torch.Tensor
{"Assign": 2, "Expr": 1, "Return": 1}
2
29
2
["torch.sum", "torch.sum"]
0
[]
The function (n2v_loss) defined within the public class called public.The function start at line 33 and ends at 61. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [33.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions called...
CAREamics_careamics
public
public
0
0
mae_loss
def mae_loss(samples: torch.Tensor, labels: torch.Tensor, *args) -> torch.Tensor:"""N2N Loss function described in to J Lehtinen et al 2018.Parameters----------samples : torch.TensorRaw patches.labels : torch.TensorDifferent subset of noisy patches.*args : AnyAdditional arguments.Returns-------torch.TensorLoss value.""...
1
3
3
35
1
64
83
64
samples,labels,*args
['loss']
torch.Tensor
{"Assign": 1, "Expr": 1, "Return": 1}
2
20
2
["L1Loss", "loss"]
0
[]
The function (mae_loss) defined within the public class called public.The function start at line 64 and ends at 83. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [64.0] and does not return any value. It declares 2.0 functions, and It has 2.0 functions called...
CAREamics_careamics
public
public
0
0
free_bits_kl
def free_bits_kl(kl: torch.Tensor, free_bits: float, batch_average: bool = False, eps: float = 1e-6) -> torch.Tensor:"""Compute free-bits version of KL divergence.This function ensures that the KL doesn't go to zero for any latent dimension.Hence, it contributes to use latent variables more efficiently, leading tobette...
3
9
4
83
0
4
44
4
kl,free_bits,batch_average,eps
[]
torch.Tensor
{"Expr": 1, "If": 2, "Return": 3}
6
41
6
["kl.dim", "kl.mean", "clamp", "kl.mean", "mean", "kl.clamp"]
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", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.lightning_module_py.La...
The function (free_bits_kl) defined within the public class called public.The function start at line 4 and ends at 44. It contains 9 lines of code and it has a cyclomatic complexity of 3. It takes 4 parameters, represented as [4.0] and does not return any value. It declares 6.0 functions, It has 6.0 functions called in...
CAREamics_careamics
public
public
0
0
get_kl_weight
def get_kl_weight(kl_annealing: bool,kl_start: int,kl_annealtime: int,kl_weight: float,current_epoch: int,) -> float:"""Compute the weight of the KL loss in case of annealing.Parameters----------kl_annealing : boolWhether to use KL annealing.kl_start : intThe epoch at which to startkl_annealtime : intThe number of epoc...
4
17
5
90
1
47
83
47
kl_annealing,kl_start,kl_annealtime,kl_weight,current_epoch
['kl_weight']
float
{"Assign": 4, "Expr": 1, "If": 3, "Return": 2}
2
37
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 public.The function start at line 47 and ends at 83. It contains 17 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [47.0] and does not return any value. It declares 2.0 functions, It has 2.0 functions calle...
CAREamics_careamics
public
public
0
0
get_reconstruction_loss
def get_reconstruction_loss(reconstruction: torch.Tensor,target: torch.Tensor,likelihood_obj: Likelihood,) -> dict[str, torch.Tensor]:"""Compute the reconstruction loss (negative log-likelihood).Parameters----------reconstruction: torch.TensorThe output of the LVAE decoder. Shape is (B, C, [Z], Y, X), where C is thenum...
1
7
3
49
0
23
49
23
reconstruction,target,likelihood_obj
[]
dict[str, torch.Tensor]
{"Assign": 1, "Expr": 1, "Return": 1}
2
27
2
["likelihood_obj", "ll.mean"]
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 public.The function start at line 23 and ends at 49. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [23.0] and does not return any value. It declares 2.0 functions, It has 2.0 functi...
CAREamics_careamics
public
public
0
0
_reconstruction_loss_musplit_denoisplit
def _reconstruction_loss_musplit_denoisplit(predictions: Union[torch.Tensor, tuple[torch.Tensor, torch.Tensor]],targets: torch.Tensor,nm_likelihood: NoiseModelLikelihood,gaussian_likelihood: GaussianLikelihood,nm_weight: float,gaussian_weight: float,) -> torch.Tensor:"""Compute the reconstruction loss for muSplit-denoi...
2
22
6
131
4
52
107
52
predictions,targets,nm_likelihood,gaussian_likelihood,nm_weight,gaussian_weight
['recons_loss_gm', 'recons_loss_nm', 'recons_loss', 'pred_mean']
torch.Tensor
{"Assign": 5, "Expr": 1, "If": 1, "Return": 1}
3
56
3
["predictions.chunk", "get_reconstruction_loss", "get_reconstruction_loss"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_py.denoisplit_musplit_loss", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.losses.test_lvae_losses_py.test_reconstruct...
The function (_reconstruction_loss_musplit_denoisplit) defined within the public class called public.The function start at line 52 and ends at 107. It contains 22 lines of code and it has a cyclomatic complexity of 2. It takes 6 parameters, represented as [52.0] and does not return any value. It declares 3.0 functions,...
CAREamics_careamics
public
public
0
0
get_kl_divergence_loss
def get_kl_divergence_loss(kl_type: Literal["kl", "kl_restricted"],topdown_data: dict[str, torch.Tensor],rescaling: Literal["latent_dim", "image_dim"],aggregation: Literal["mean", "sum"],free_bits_coeff: float,img_shape: tuple[int] | None = None,) -> torch.Tensor:"""Compute the KL divergence loss.NOTE: Description of `...
8
27
6
209
3
110
195
110
kl_type,topdown_data,rescaling,aggregation,free_bits_coeff,img_shape
['latent_dim', 'kl', 'norm_factor']
torch.Tensor
{"Assign": 9, "Expr": 1, "For": 1, "If": 5, "Return": 1}
10
86
10
["torch.cat", "kl_layer.unsqueeze", "free_bits_kl", "len", "range", "len", "np.prod", "np.prod", "kl.mean", "kl.sum"]
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 public.The function start at line 110 and ends at 195. It contains 27 lines of code and it has a cyclomatic complexity of 8. It takes 6 parameters, represented as [110.0] and does not return any value. It declares 10.0 functions, It has 10.0 f...
CAREamics_careamics
public
public
0
0
_get_kl_divergence_loss_musplit
def _get_kl_divergence_loss_musplit(topdown_data: dict[str, torch.Tensor],img_shape: tuple[int],kl_type: Literal["kl", "kl_restricted"],) -> torch.Tensor:"""Compute the KL divergence loss for muSplit.Parameters----------topdown_data : dict[str, torch.Tensor]A dictionary containing information computed for each layer du...
1
13
3
66
0
198
230
198
topdown_data,img_shape,kl_type
[]
torch.Tensor
{"Expr": 1, "Return": 1}
1
33
1
["get_kl_divergence_loss"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_py.denoisplit_musplit_loss", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.losses.lvae.losses_py.musplit_loss"...
The function (_get_kl_divergence_loss_musplit) defined within the public class called public.The function start at line 198 and ends at 230. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [198.0] and does not return any value. It declare 1.0 function, It has ...
CAREamics_careamics
public
public
0
0
_get_kl_divergence_loss_denoisplit
def _get_kl_divergence_loss_denoisplit(topdown_data: dict[str, torch.Tensor],img_shape: tuple[int],kl_type: Literal["kl", "kl_restricted"],) -> torch.Tensor:"""Compute the KL divergence loss for denoiSplit.Parameters----------topdown_data : dict[str, torch.Tensor]A dictionary containing information computed for each la...
1
13
3
66
0
233
265
233
topdown_data,img_shape,kl_type
[]
torch.Tensor
{"Expr": 1, "Return": 1}
1
33
1
["get_kl_divergence_loss"]
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.denoisplit_musplit_lo...
The function (_get_kl_divergence_loss_denoisplit) defined within the public class called public.The function start at line 233 and ends at 265. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [233.0] and does not return any value. It declare 1.0 function, It h...
CAREamics_careamics
public
public
0
0
hdn_loss
def hdn_loss(model_outputs: tuple[torch.Tensor, dict[str, Any]],targets: torch.Tensor,config: LVAELossConfig,gaussian_likelihood: GaussianLikelihood | None,noise_model_likelihood: NoiseModelLikelihood | None,) -> dict[str, torch.Tensor] | None:"""Loss function for HDN.Parameters----------model_outputs : tuple[torch.Ten...
6
49
5
244
6
275
354
275
model_outputs,targets,config,gaussian_likelihood,noise_model_likelihood
['likelihood', 'output', 'net_loss', 'kl_loss', 'recons_loss', 'kl_weight']
dict[str, torch.Tensor] | None
{"Assign": 9, "Expr": 1, "If": 4, "Return": 2}
11
80
11
["ValueError", "get_reconstruction_loss", "any", "torch.isnan", "get_kl_weight", "_get_kl_divergence_loss_denoisplit", "isinstance", "recons_loss.detach", "kl_loss.detach", "any", "torch.isnan"]
0
[]
The function (hdn_loss) defined within the public class called public.The function start at line 275 and ends at 354. It contains 49 lines of code and it has a cyclomatic complexity of 6. It takes 5 parameters, represented as [275.0] and does not return any value. It declares 11.0 functions, and It has 11.0 functions ...
CAREamics_careamics
public
public
0
0
musplit_loss
def musplit_loss(model_outputs: tuple[torch.Tensor, dict[str, Any]],targets: torch.Tensor,config: LVAELossConfig,gaussian_likelihood: GaussianLikelihood | None,noise_model_likelihood: NoiseModelLikelihood | None = None,# TODO: ugly) -> dict[str, torch.Tensor] | None:"""Loss function for muSplit.Parameters----------mode...
4
44
5
226
5
357
432
357
model_outputs,targets,config,gaussian_likelihood,noise_model_likelihood
['output', 'net_loss', 'kl_loss', 'recons_loss', 'kl_weight']
dict[str, torch.Tensor] | None
{"Assign": 7, "Expr": 1, "If": 2, "Return": 2}
10
76
10
["get_reconstruction_loss", "any", "torch.isnan", "get_kl_weight", "_get_kl_divergence_loss_musplit", "isinstance", "recons_loss.detach", "kl_loss.detach", "any", "torch.isnan"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.losses.test_lvae_losses_py.test_musplit_loss"]
The function (musplit_loss) defined within the public class called public.The function start at line 357 and ends at 432. It contains 44 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [357.0] and does not return any value. It declares 10.0 functions, It has 10.0 functions c...
CAREamics_careamics
public
public
0
0
denoisplit_loss
def denoisplit_loss(model_outputs: tuple[torch.Tensor, dict[str, Any]],targets: torch.Tensor,config: LVAELossConfig,gaussian_likelihood: GaussianLikelihood | None = None,noise_model_likelihood: NoiseModelLikelihood | None = None,) -> dict[str, torch.Tensor] | None:"""Loss function for DenoiSplit.Parameters----------mod...
4
44
5
228
5
435
509
435
model_outputs,targets,config,gaussian_likelihood,noise_model_likelihood
['output', 'net_loss', 'kl_loss', 'recons_loss', 'kl_weight']
dict[str, torch.Tensor] | None
{"Assign": 7, "Expr": 1, "If": 2, "Return": 2}
10
75
10
["get_reconstruction_loss", "any", "torch.isnan", "get_kl_weight", "_get_kl_divergence_loss_denoisplit", "isinstance", "recons_loss.detach", "kl_loss.detach", "any", "torch.isnan"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.losses.test_lvae_losses_py.test_denoisplit_loss"]
The function (denoisplit_loss) defined within the public class called public.The function start at line 435 and ends at 509. It contains 44 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [435.0] and does not return any value. It declares 10.0 functions, It has 10.0 function...
CAREamics_careamics
public
public
0
0
denoisplit_musplit_loss
def denoisplit_musplit_loss(model_outputs: tuple[torch.Tensor, dict[str, Any]],targets: torch.Tensor,config: LVAELossConfig,gaussian_likelihood: GaussianLikelihood,noise_model_likelihood: NoiseModelLikelihood,) -> dict[str, torch.Tensor] | None:"""Loss function for DenoiSplit.Parameters----------model_outputs : tuple[t...
4
45
5
239
6
512
589
512
model_outputs,targets,config,gaussian_likelihood,noise_model_likelihood
['output', 'net_loss', 'kl_loss', 'recons_loss', 'denoisplit_kl', 'musplit_kl']
dict[str, torch.Tensor] | None
{"Assign": 9, "Expr": 1, "If": 2, "Return": 2}
10
78
10
["_reconstruction_loss_musplit_denoisplit", "any", "torch.isnan", "_get_kl_divergence_loss_denoisplit", "_get_kl_divergence_loss_musplit", "isinstance", "recons_loss.detach", "kl_loss.detach", "any", "torch.isnan"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.tests.losses.test_lvae_losses_py.test_denoisplit_musplit_loss"]
The function (denoisplit_musplit_loss) defined within the public class called public.The function start at line 512 and ends at 589. It contains 45 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [512.0] and does not return any value. It declares 10.0 functions, It has 10.0 ...
CAREamics_careamics
public
public
0
0
get_last_index
def get_last_index(bin_count, quantile):cumsum = np.cumsum(bin_count)normalized_cumsum = cumsum / cumsum[-1]for i in range(1, len(normalized_cumsum)):if normalized_cumsum[-i] < quantile:return i - 1return None
3
7
2
52
2
8
14
8
bin_count,quantile
['normalized_cumsum', 'cumsum']
Returns
{"Assign": 2, "For": 1, "If": 1, "Return": 2}
3
7
3
["np.cumsum", "range", "len"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.calibration_py.Calibration.get_calibrated_factor_for_stdev", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_tra...
The function (get_last_index) defined within the public class called public.The function start at line 8 and ends at 14. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [8.0], and this function return a value. It declares 3.0 functions, It has 3.0 functions cal...
CAREamics_careamics
public
public
0
0
get_first_index
def get_first_index(bin_count, quantile):cumsum = np.cumsum(bin_count)normalized_cumsum = cumsum / cumsum[-1]for i in range(len(normalized_cumsum)):if normalized_cumsum[i] > quantile:return ireturn None
3
7
2
47
2
17
23
17
bin_count,quantile
['normalized_cumsum', 'cumsum']
Returns
{"Assign": 2, "For": 1, "If": 1, "Return": 2}
3
7
3
["np.cumsum", "range", "len"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.calibration_py.Calibration.get_calibrated_factor_for_stdev", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_tra...
The function (get_first_index) defined within the public class called public.The function start at line 17 and ends at 23. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [17.0], and this function return a value. It declares 3.0 functions, It has 3.0 functions ...
CAREamics_careamics
Calibration
public
0
0
__init__
def __init__(self, num_bins: int = 15):self._bins = num_binsself._bin_boundaries = None
1
3
2
21
0
33
35
33
self,num_bins
[]
None
{"Assign": 2}
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 Calibration.The function start at line 33 and ends at 35. It contains 3 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [33.0] and does not return any value. It has 8182.0 functions calling this function which ar...
CAREamics_careamics
Calibration
public
0
0
compute_bin_boundaries
def compute_bin_boundaries(self, predict_std: np.ndarray) -> np.ndarray:"""Compute the bin boundaries for `num_bins` bins and predicted std values."""min_std = np.min(predict_std)max_std = np.max(predict_std)return np.linspace(min_std, max_std, self._bins + 1)
1
4
2
47
0
37
41
37
self,predict_std
[]
np.ndarray
{"Assign": 2, "Expr": 1, "Return": 1}
3
5
3
["np.min", "np.max", "np.linspace"]
0
[]
The function (compute_bin_boundaries) defined within the public class called Calibration.The function start at line 37 and ends at 41. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [37.0] and does not return any value. It declares 3.0 functions, and It has 3...
CAREamics_careamics
Calibration
public
0
0
compute_stats
def compute_stats(self, pred: np.ndarray, pred_std: np.ndarray, target: np.ndarray) -> dict[int, dict[str, Union[np.ndarray, list]]]:"""It computes the bin-wise RMSE and RMV for each channel of the predicted image.Recall that:- RMSE = np.sqrt((pred - target)**2 / num_pixels)- RMV = np.sqrt(np.mean(pred_std**2))ALGORITH...
6
43
4
358
0
43
110
43
self,pred,pred_std,target
[]
dict[int, dict[str, Union[np.ndarray, list]]]
{"Assign": 20, "Expr": 5, "For": 2, "Return": 1}
18
68
18
["range", "self.compute_bin_boundaries", "np.digitize", "std_ch.reshape", "bin_matrix.reshape", "range", "np.sum", "np.sqrt", "np.sum", "np.std", "np.sqrt", "np.sqrt", "np.mean", "append", "append", "append", "np.sqrt", "append"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.70179132_vyperlang_titanoboa.boa.profiling_py.get_call_profile_table"]
The function (compute_stats) defined within the public class called Calibration.The function start at line 43 and ends at 110. It contains 43 lines of code and it has a cyclomatic complexity of 6. It takes 4 parameters, represented as [43.0] and does not return any value. It declares 18.0 functions, It has 18.0 functio...
CAREamics_careamics
Calibration
public
0
0
get_calibrated_factor_for_stdev
def get_calibrated_factor_for_stdev(self,pred: Optional[np.ndarray] = None,pred_std: Optional[np.ndarray] = None,target: Optional[np.ndarray] = None,q_s: float = 0.00001,q_e: float = 0.99999,) -> dict[str, float]:"""Calibrate the uncertainty by multiplying the predicted std with a scalar.Parameters----------stats_dict ...
5
29
6
247
0
112
157
112
self,pred,pred_std,target,q_s,q_e
[]
dict[str, float]
{"Assign": 13, "Expr": 2, "For": 1, "If": 2, "Return": 1}
10
46
10
["hasattr", "print", "any", "ValueError", "self.compute_stats", "self.stats_dict.keys", "get_first_index", "get_last_index", "stats.linregress", "self.get_factors_array"]
0
[]
The function (get_calibrated_factor_for_stdev) defined within the public class called Calibration.The function start at line 112 and ends at 157. It contains 29 lines of code and it has a cyclomatic complexity of 5. It takes 6 parameters, represented as [112.0] and does not return any value. It declares 10.0 functions,...
CAREamics_careamics
Calibration
public
0
0
get_factors_array
def get_factors_array(self, factors_dict: list[dict]):"""Get the calibration factors as a numpy array."""calib_scalar = [factors_dict[i]["scalar"] for i in range(len(factors_dict))]calib_scalar = np.array(calib_scalar).reshape(1, 1, 1, -1)calib_offset = [factors_dict[i].get("offset", 0.0) for i in range(len(factors_dic...
3
8
2
111
0
159
167
159
self,factors_dict
[]
Returns
{"Assign": 4, "Expr": 1, "Return": 1}
9
9
9
["range", "len", "reshape", "np.array", "get", "range", "len", "reshape", "np.array"]
0
[]
The function (get_factors_array) defined within the public class called Calibration.The function start at line 159 and ends at 167. It contains 8 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [159.0], and this function return a value. It declares 9.0 functions, and It has...
CAREamics_careamics
public
public
0
0
plot_calibration
def plot_calibration(ax, calibration_stats):first_idx = get_first_index(calibration_stats[0]["bin_count"], 0.0001)last_idx = get_last_index(calibration_stats[0]["bin_count"], 0.9999)ax.plot(calibration_stats[0]["rmv"][first_idx:-last_idx],calibration_stats[0]["rmse"][first_idx:-last_idx],"o",label=r"$\hat{C}_0$: Ch1",)...
1
20
2
168
2
170
191
170
ax,calibration_stats
['last_idx', 'first_idx']
None
{"Assign": 4, "Expr": 5}
9
22
9
["get_first_index", "get_last_index", "ax.plot", "get_first_index", "get_last_index", "ax.plot", "ax.set_xlabel", "ax.set_ylabel", "ax.legend"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.plot_crops"]
The function (plot_calibration) defined within the public class called public.The function start at line 170 and ends at 191. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [170.0] and does not return any value. It declares 9.0 functions, It has 9.0 functions...
CAREamics_careamics
public
public
0
0
clean_ax
def clean_ax(ax):"""Helper function to remove ticks from axes in plots."""# 2D or 1D axes are of type np.ndarrayif isinstance(ax, np.ndarray):for one_ax in ax:clean_ax(one_ax)returnax.set_yticklabels([])ax.set_xticklabels([])ax.tick_params(left=False, right=False, top=False, bottom=False)
3
8
1
60
0
37
49
37
ax
[]
None
{"Expr": 5, "For": 1, "If": 1, "Return": 1}
5
13
5
["isinstance", "clean_ax", "ax.set_yticklabels", "ax.set_xticklabels", "ax.tick_params"]
2
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.clean_ax", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.plot_crops"]
The function (clean_ax) defined within the public class called public.The function start at line 37 and ends at 49. It contains 8 lines of code and it has a cyclomatic complexity of 3. The function does not take any parameters and does not return any value. It declares 5.0 functions, It has 5.0 functions called inside ...
CAREamics_careamics
public
public
0
0
get_eval_output_dir
def get_eval_output_dir(saveplotsdir: str, patch_size: int, mmse_count: int = 50) -> str:"""Given the path to a root directory to save plots, patch size, and mmse count,it returns the specific directory to save the plots."""eval_out_dir = os.path.join(saveplotsdir, f"eval_outputs/patch_{patch_size}_mmse_{mmse_count}")o...
1
9
3
49
1
52
64
52
saveplotsdir,patch_size,mmse_count
['eval_out_dir']
str
{"Assign": 1, "Expr": 3, "Return": 1}
3
13
3
["os.path.join", "os.makedirs", "print"]
0
[]
The function (get_eval_output_dir) defined within the public class called public.The function start at line 52 and ends at 64. It contains 9 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [52.0] and does not return any value. It declares 3.0 functions, and It has 3.0 funct...
CAREamics_careamics
public
public
0
0
get_psnr_str
def get_psnr_str(tar_hsnr, pred, col_idx):"""Compute PSNR between the ground truth (`tar_hsnr`) and the predicted image (`pred`)."""return f"{scale_invariant_psnr(tar_hsnr[col_idx][None], pred[col_idx][None]).item():.1f}"
1
2
3
13
0
67
71
67
tar_hsnr,pred,col_idx
[]
Returns
{"Expr": 1, "Return": 1}
2
5
2
["item", "scale_invariant_psnr"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.plot_crops"]
The function (get_psnr_str) defined within the public class called public.The function start at line 67 and ends at 71. It contains 2 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [67.0], and this function return a value. It declares 2.0 functions, It has 2.0 functions cal...
CAREamics_careamics
public
public
0
0
add_psnr_str
def add_psnr_str(ax_, psnr):"""Add psnr string to the axes"""textstr = f"PSNR\n{psnr}"props = dict(boxstyle="round", facecolor="gray", alpha=0.5)# place a text box in upper left in axes coordsax_.text(0.05,0.95,textstr,transform=ax_.transAxes,fontsize=11,verticalalignment="top",bbox=props,color="white",)
1
13
2
67
2
74
90
74
ax_,psnr
['textstr', 'props']
None
{"Assign": 2, "Expr": 2}
2
17
2
["dict", "ax_.text"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.plot_crops"]
The function (add_psnr_str) defined within the public class called public.The function start at line 74 and ends at 90. It contains 13 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [74.0] and does not return any value. It declares 2.0 functions, It has 2.0 functions called...
CAREamics_careamics
public
public
0
0
get_last_index
def get_last_index(bin_count, quantile):cumsum = np.cumsum(bin_count)normalized_cumsum = cumsum / cumsum[-1]for i in range(1, len(normalized_cumsum)):if normalized_cumsum[-i] < quantile:return i - 1return None
3
7
2
52
2
93
99
93
bin_count,quantile
['normalized_cumsum', 'cumsum']
Returns
{"Assign": 2, "For": 1, "If": 1, "Return": 2}
3
7
3
["np.cumsum", "range", "len"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.calibration_py.Calibration.get_calibrated_factor_for_stdev", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_tra...
The function (get_last_index) defined within the public class called public.The function start at line 93 and ends at 99. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [93.0], and this function return a value. It declares 3.0 functions, It has 3.0 functions c...
CAREamics_careamics
public
public
0
0
get_first_index
def get_first_index(bin_count, quantile):cumsum = np.cumsum(bin_count)normalized_cumsum = cumsum / cumsum[-1]for i in range(len(normalized_cumsum)):if normalized_cumsum[i] > quantile:return ireturn None
3
7
2
47
2
102
108
102
bin_count,quantile
['normalized_cumsum', 'cumsum']
Returns
{"Assign": 2, "For": 1, "If": 1, "Return": 2}
3
7
3
["np.cumsum", "range", "len"]
3
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.calibration_py.Calibration.get_calibrated_factor_for_stdev", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_tra...
The function (get_first_index) defined within the public class called public.The function start at line 102 and ends at 108. It contains 7 lines of code and it has a cyclomatic complexity of 3. It takes 2 parameters, represented as [102.0], and this function return a value. It declares 3.0 functions, It has 3.0 functio...
CAREamics_careamics
public
public
0
0
get_device
def get_device():if torch.cuda.is_available():return "cuda"elif torch.backends.mps.is_available():return "mps"else:return "cpu"
3
7
0
32
0
111
117
111
[]
Returns
{"If": 2, "Return": 3}
2
7
2
["torch.cuda.is_available", "torch.backends.mps.is_available"]
6
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.get_single_file_mmse", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.get_...
The function (get_device) defined within the public class called public.The function start at line 111 and ends at 117. 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 declares 2.0 functions, It has 2.0 functions called...
CAREamics_careamics
public
public
0
0
show_for_one
def show_for_one(idx,val_dset,highsnr_val_dset,model,calibration_stats,mmse_count=5,patch_size=256,num_samples=2,baseline_preds=None,):"""Given an index, it plots the input, target, reconstructed images and the difference image.Note the the difference image is computed with respect to a ground truth image, obtained fro...
1
26
9
95
0
120
149
120
idx,val_dset,highsnr_val_dset,model,calibration_stats,mmse_count,patch_size,num_samples,baseline_preds
[]
None
{"Assign": 2, "Expr": 4}
4
30
4
["highsnr_val_dset.set_img_sz", "highsnr_val_dset.disable_noise", "get_predictions", "plot_crops"]
0
[]
The function (show_for_one) defined within the public class called public.The function start at line 120 and ends at 149. It contains 26 lines of code and it has a cyclomatic complexity of 1. It takes 9 parameters, represented as [120.0] and does not return any value. It declares 4.0 functions, and It has 4.0 function...
CAREamics_careamics
public
public
0
0
plot_crops
def plot_crops(inp,tar,tar_hsnr,recon_img_list,calibration_stats=None,num_samples=2,baseline_preds=None,):if baseline_preds is None:baseline_preds = []if len(baseline_preds) > 0:for i in range(len(baseline_preds)):if baseline_preds[i].shape != tar_hsnr.shape:print(f"Baseline prediction {i} shape {baseline_preds[i].shap...
15
130
7
904
25
152
354
152
inp,tar,tar_hsnr,recon_img_list,calibration_stats,num_samples,baseline_preds
['inset_rect', 'grid_img_sz', 'fig_w', 'grid_factor', 'legend_ch2_ax', 'color_pred', 'c0_extra', 'insetplot_xmax_value', 'params', 'sample_start_idx', 'example_spacing', 'fig', 'baseline_preds', 'smaller_offset', 'nimgs', 'fig_h', 'insetplot_xmin_value', 'psnr', 'gs', 'ncols', 'color_ch_list', 'legend_ch1_ax', 'ax_temp...
None
{"Assign": 34, "Expr": 22, "For": 7, "If": 7, "Return": 1}
56
203
56
["len", "range", "len", "print", "print", "len", "int", "plt.figure", "GridSpec", "int", "int", "plt.rcParams.update", "range", "len", "range", "fig.add_subplot", "print", "get_psnr_str", "ax_temp.imshow", "add_psnr_str", "clean_ax", "len", "range", "range", "fig.add_subplot", "get_psnr_str", "ax_temp.imshow", "add_psn...
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.show_for_one"]
The function (plot_crops) defined within the public class called public.The function start at line 152 and ends at 354. It contains 130 lines of code and it has a cyclomatic complexity of 15. It takes 7 parameters, represented as [152.0] and does not return any value. It declares 56.0 functions, It has 56.0 functions c...
CAREamics_careamics
public
public
0
0
plot_calibration
def plot_calibration(ax, calibration_stats):"""To plot calibration statistics (RMV vs RMSE)."""first_idx = get_first_index(calibration_stats[0]["bin_count"], 0.001)last_idx = get_last_index(calibration_stats[0]["bin_count"], 0.999)ax.plot(calibration_stats[0]["rmv"][first_idx:-last_idx],calibration_stats[0]["rmse"][fir...
1
20
2
169
2
357
381
357
ax,calibration_stats
['last_idx', 'first_idx']
None
{"Assign": 4, "Expr": 6}
9
25
9
["get_first_index", "get_last_index", "ax.plot", "get_first_index", "get_last_index", "ax.plot", "ax.set_xlabel", "ax.set_ylabel", "ax.legend"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.plot_crops"]
The function (plot_calibration) defined within the public class called public.The function start at line 357 and ends at 381. It contains 20 lines of code and it has a cyclomatic complexity of 1. It takes 2 parameters, represented as [357.0] and does not return any value. It declares 9.0 functions, It has 9.0 functions...
CAREamics_careamics
public
public
0
0
shiftedColorMap
def shiftedColorMap(cmap, start=0, midpoint=0.5, stop=1.0, name="shiftedcmap"):"""Adapted from https://stackoverflow.com/questions/7404116/defining-the-midpoint-of-a-colormap-in-matplotlibFunction to offset the "center" of a colormap. Useful fordata with a negative min and positive max and you want themiddle of the col...
2
20
5
241
6
384
433
384
cmap,start,midpoint,stop,name
['newcmap', 'shift_index', 'mid_idx', 'a', 'cdict', 'reg_index']
Returns
{"Assign": 7, "Expr": 6, "For": 1, "Return": 1}
14
50
14
["np.linspace", "len", "np.hstack", "np.linspace", "np.linspace", "zip", "cmap", "np.abs", "append", "append", "append", "append", "matplotlib.colors.LinearSegmentedColormap", "matplotlib.colormaps.register"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.plot_error"]
The function (shiftedColorMap) defined within the public class called public.The function start at line 384 and ends at 433. It contains 20 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [384.0], and this function return a value. It declares 14.0 functions, It has 14.0 func...
CAREamics_careamics
public
public
0
0
get_fractional_change
def get_fractional_change(target, prediction, max_val=None):"""Get relative difference between target and prediction."""if max_val is None:max_val = target.max()return (target - prediction) / max_val
2
4
3
32
1
436
442
436
target,prediction,max_val
['max_val']
Returns
{"Assign": 1, "Expr": 1, "If": 1, "Return": 1}
1
7
1
["target.max"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.plot_error"]
The function (get_fractional_change) defined within the public class called public.The function start at line 436 and ends at 442. It contains 4 lines of code and it has a cyclomatic complexity of 2. It takes 3 parameters, represented as [436.0], and this function return a value. It declare 1.0 function, It has 1.0 fun...
CAREamics_careamics
public
public
0
0
get_zero_centered_midval
def get_zero_centered_midval(error):"""When done this way, the midval ensures that the colorbar is centered at 0. (Don't know how, but it works ;))"""vmax = error.max()vmin = error.min()midval = 1 - vmax / (vmax + abs(vmin))return midval
1
5
1
36
3
445
452
445
error
['vmax', 'midval', 'vmin']
Returns
{"Assign": 3, "Expr": 1, "Return": 1}
3
8
3
["error.max", "error.min", "abs"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.plot_error"]
The function (get_zero_centered_midval) defined within the public class called public.The function start at line 445 and ends at 452. It contains 5 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 3.0 functions, It has 3.0 fu...
CAREamics_careamics
public
public
0
0
plot_error
def plot_error(target, prediction, cmap=matplotlib.cm.coolwarm, ax=None, max_val=None):"""Plot the relative difference between target and prediction.NOTE: The plot is overlapped to the prediction image (in gray scale).NOTE: The colorbar is centered at 0."""if ax is None:_, ax = plt.subplots(figsize=(6, 6))# Relative di...
2
11
5
123
4
455
472
455
target,prediction,cmap,ax,max_val
['midval', 'img_err', 'rel_diff', 'shifted_cmap']
None
{"Assign": 5, "Expr": 3, "If": 1}
7
18
7
["plt.subplots", "get_fractional_change", "get_zero_centered_midval", "shiftedColorMap", "ax.imshow", "ax.imshow", "plt.colorbar"]
0
[]
The function (plot_error) defined within the public class called public.The function start at line 455 and ends at 472. It contains 11 lines of code and it has a cyclomatic complexity of 2. It takes 5 parameters, represented as [455.0] and does not return any value. It declares 7.0 functions, and It has 7.0 functions ...
CAREamics_careamics
public
public
0
0
get_predictions
def get_predictions(model: VAEModule,dset: Dataset,batch_size: int,tile_size: Optional[tuple[int, int]] = None,grid_size: Optional[int] = None,mmse_count: int = 1,num_workers: int = 4,) -> tuple[dict, dict, dict]:"""Get patch-wise predictions from a model for the entire dataset.Parameters----------model : VAEModuleLigh...
3
44
7
204
3
478
553
478
model,dset,batch_size,tile_size,grid_size,mmse_count,num_workers
['multifile_stitched_stds', 'multifile_stitched_predictions', 'filename']
tuple[dict, dict, dict]
{"Assign": 8, "Expr": 1, "For": 1, "If": 1, "Return": 2}
3
76
3
["hasattr", "get_single_file_mmse", "get_single_file_mmse"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.show_for_one"]
The function (get_predictions) defined within the public class called public.The function start at line 478 and ends at 553. It contains 44 lines of code and it has a cyclomatic complexity of 3. It takes 7 parameters, represented as [478.0] and does not return any value. It declares 3.0 functions, It has 3.0 functions ...
CAREamics_careamics
public
public
0
0
get_single_file_predictions
def get_single_file_predictions(model: VAEModule,dset: Dataset,batch_size: int,tile_size: Optional[tuple[int, int]] = None,grid_size: Optional[int] = None,num_workers: int = 4,) -> tuple[np.ndarray, np.ndarray]:"""Get patch-wise predictions from a model for a single file dataset."""if tile_size and grid_size:dset.set_i...
5
37
6
255
9
556
601
556
model,dset,batch_size,tile_size,grid_size,num_workers
['device', 'dloader', 'logvar', 'tiles', 'tile_samples', 'tar', 'inp', 'rec_img', 'logvar_arr']
tuple[np.ndarray, np.ndarray]
{"Assign": 12, "Expr": 6, "For": 1, "If": 2, "Return": 1, "With": 1}
20
46
20
["dset.set_img_sz", "get_device", "DataLoader", "model.eval", "model.to", "torch.no_grad", "tqdm", "inp.to", "tar.to", "model", "torch.tensor", "torch.chunk", "logvar_arr.append", "numpy", "logvar.cpu", "tiles.append", "numpy", "rec_img.cpu", "np.concatenate", "stitch_predictions_new"]
0
[]
The function (get_single_file_predictions) defined within the public class called public.The function start at line 556 and ends at 601. It contains 37 lines of code and it has a cyclomatic complexity of 5. It takes 6 parameters, represented as [556.0] and does not return any value. It declares 20.0 functions, and It ...
CAREamics_careamics
public
public
0
0
get_single_file_mmse
def get_single_file_mmse(model: VAEModule,dset: Dataset,batch_size: int,tile_size: Optional[tuple[int, int]] = None,grid_size: Optional[int] = None,mmse_count: int = 1,num_workers: int = 4,) -> tuple[np.ndarray, np.ndarray]:"""Get patch-wise predictions from a model for a single file dataset."""device = get_device()dlo...
7
53
7
406
17
604
670
604
model,dset,batch_size,tile_size,grid_size,mmse_count,num_workers
['stitched_stds', 'inp', 'samples', 'tile_mmse', 'mmse_imgs', 'tiles_arr', 'stitch_func', 'stitched_predictions', 'device', 'rec_img_list', 'dloader', 'logvar', 'std_imgs', 'tar', 'tile_stds', 'rec_img', 'logvar_arr']
tuple[np.ndarray, np.ndarray]
{"Assign": 22, "Expr": 8, "For": 2, "If": 3, "Return": 1, "With": 1}
36
67
36
["get_device", "DataLoader", "dset.set_img_sz", "model.eval", "model.to", "torch.no_grad", "tqdm", "inp.to", "tar.to", "range", "model", "torch.tensor", "torch.chunk", "rec_img_list.append", "unsqueeze", "rec_img.cpu", "logvar_arr.append", "numpy", "logvar.cpu", "torch.cat", "torch.mean", "torch.std", "tile_mmse.append...
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.get_predictions"]
The function (get_single_file_mmse) defined within the public class called public.The function start at line 604 and ends at 670. It contains 53 lines of code and it has a cyclomatic complexity of 7. It takes 7 parameters, represented as [604.0] and does not return any value. It declares 36.0 functions, It has 36.0 fun...
CAREamics_careamics
PatchLocation
public
0
0
__init__
def __init__(self, h_idx_range, w_idx_range, t_idx):self.t = t_idxself.h_start, self.h_end = h_idx_rangeself.w_start, self.w_end = w_idx_range
1
4
4
34
0
680
683
680
self,h_idx_range,w_idx_range,t_idx
[]
None
{"Assign": 3}
0
4
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 PatchLocation.The function start at line 680 and ends at 683. It contains 4 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [680.0] and does not return any value. It has 8182.0 functions calling this function whi...
CAREamics_careamics
PatchLocation
public
0
0
__str__
def __str__(self):msg = f"T:{self.t} [{self.h_start}-{self.h_end}) [{self.w_start}-{self.w_end}) "return msg
1
3
1
11
0
685
687
685
self
[]
Returns
{"Assign": 1, "Return": 1}
0
3
0
[]
19
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3646959_kristianoellegaard_django_hvad.hvad.test_utils.project.app.models_py.NormalProxy.__str__", "_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.3646959_kristianoellegaard_django_hvad.hvad.test_utils.project.app.mod...
The function (__str__) defined within the public class called PatchLocation.The function start at line 685 and ends at 687. It contains 3 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 19.0 functions calling this function which ...
CAREamics_careamics
public
public
0
0
_get_location
def _get_location(extra_padding, hwt, pred_h, pred_w):h_start, w_start, t_idx = hwth_start -= extra_paddingh_end = h_start + pred_hw_start -= extra_paddingw_end = w_start + pred_wreturn PatchLocation((h_start, h_end), (w_start, w_end), t_idx)
1
7
4
51
2
690
696
690
extra_padding,hwt,pred_h,pred_w
['h_end', 'w_end']
Returns
{"Assign": 3, "AugAssign": 2, "Return": 1}
1
7
1
["PatchLocation"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.get_location_from_idx"]
The function (_get_location) defined within the public class called public.The function start at line 690 and ends at 696. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [690.0], and this function return a value. It declare 1.0 function, It has 1.0 function ca...
CAREamics_careamics
public
public
0
0
get_location_from_idx
def get_location_from_idx(dset, dset_input_idx, pred_h, pred_w):"""For a given idx of the dataset, it returns where exactly in the dataset, does this prediction lies.Note that this prediction also has padded pixels and so a subset of it will be used in the final prediction.Which time frame, which spatial location (h_st...
1
6
4
50
2
699
717
699
dset,dset_input_idx,pred_h,pred_w
['htw', 'extra_padding']
Returns
{"Assign": 2, "Expr": 1, "Return": 1}
5
19
5
["dset.per_side_overlap_pixelcount", "hwt_from_idx", "dset.get_idx_manager", "dset.get_grid_size", "_get_location"]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.stitch_predictions"]
The function (get_location_from_idx) defined within the public class called public.The function start at line 699 and ends at 717. It contains 6 lines of code and it has a cyclomatic complexity of 1. It takes 4 parameters, represented as [699.0], and this function return a value. It declares 5.0 functions, It has 5.0 f...
CAREamics_careamics
public
public
0
0
remove_pad
def remove_pad(pred, loc, extra_padding, smoothening_pixelcount, frame_shape):assert smoothening_pixelcount == 0if extra_padding - smoothening_pixelcount > 0:h_s = extra_padding - smoothening_pixelcount# rowsh_N = frame_shape[0]if loc.h_end > h_N:assert loc.h_end - extra_padding + smoothening_pixelcount <= h_Nh_e = ext...
4
15
5
105
6
720
742
720
pred,loc,extra_padding,smoothening_pixelcount,frame_shape
['w_e', 'h_s', 'h_N', 'w_s', 'h_e', 'w_N']
Returns
{"Assign": 6, "If": 3, "Return": 2}
0
23
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.stitch_predictions"]
The function (remove_pad) defined within the public class called public.The function start at line 720 and ends at 742. It contains 15 lines of code and it has a cyclomatic complexity of 4. It takes 5 parameters, represented as [720.0], and this function return a value. It has 1.0 function calling this function which i...
CAREamics_careamics
public
public
0
0
update_loc_for_final_insertion
def update_loc_for_final_insertion(loc, extra_padding, smoothening_pixelcount):extra_padding = extra_padding - smoothening_pixelcountloc.h_start += extra_paddingloc.w_start += extra_paddingloc.h_end -= extra_paddingloc.w_end -= extra_paddingreturn loc
1
7
3
36
1
745
751
745
loc,extra_padding,smoothening_pixelcount
['extra_padding']
Returns
{"Assign": 1, "AugAssign": 4, "Return": 1}
0
7
0
[]
1
["_.content.gdrive.MyDrive.Phd_Thesis.Dataset_Creation.Output.Cloned_Repo_3.95053985_CAREamics_careamics.src.careamics.lvae_training.eval_utils_py.stitch_predictions"]
The function (update_loc_for_final_insertion) defined within the public class called public.The function start at line 745 and ends at 751. It contains 7 lines of code and it has a cyclomatic complexity of 1. It takes 3 parameters, represented as [745.0], and this function return a value. It has 1.0 function calling th...