Skip to content

Commit

Permalink
fix pre-commit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamaedler committed Jan 8, 2025
1 parent bf0d2cd commit 6a59091
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/scportrait/pipeline/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _clean_log_file(self):

if os.path.exists(log_file_path):
os.remove(log_file_path)

# def _clear_cache(self, vars_to_delete=None):
# """Helper function to help clear memory usage. Mainly relevant for GPU based segmentations.

Expand Down
14 changes: 7 additions & 7 deletions src/scportrait/pipeline/extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ def _transfer_tempmmap_to_hdf5(self):

self.log("single-cell index created.")
del cell_ids
#self._clear_cache(vars_to_delete=[cell_ids]) # this is not working as expected so we will just delete the variable directly
# self._clear_cache(vars_to_delete=[cell_ids]) # this is not working as expected so we will just delete the variable directly

_, c, x, y = _tmp_single_cell_data.shape
single_cell_data = hf.create_dataset(
Expand All @@ -670,7 +670,7 @@ def _transfer_tempmmap_to_hdf5(self):

self.log("single-cell data created")
del single_cell_data
#self._clear_cache(vars_to_delete=[single_cell_data]) # this is not working as expected so we will just delete the variable directly
# self._clear_cache(vars_to_delete=[single_cell_data]) # this is not working as expected so we will just delete the variable directly

# also transfer labelled index to HDF5
index_labelled = _tmp_single_cell_index[keep_index]
Expand All @@ -687,7 +687,7 @@ def _transfer_tempmmap_to_hdf5(self):

self.log("single-cell index labelled created.")
del index_labelled
#self._clear_cache(vars_to_delete=[index_labelled]) # this is not working as expected so we will just delete the variable directly
# self._clear_cache(vars_to_delete=[index_labelled]) # this is not working as expected so we will just delete the variable directly

hf.create_dataset(
"channel_information",
Expand All @@ -699,7 +699,7 @@ def _transfer_tempmmap_to_hdf5(self):

# cleanup memory
del _tmp_single_cell_index
#self._clear_cache(vars_to_delete=[_tmp_single_cell_index]) # this is not working as expected so we will just delete the variable directly
# self._clear_cache(vars_to_delete=[_tmp_single_cell_index]) # this is not working as expected so we will just delete the variable directly

os.remove(self._tmp_single_cell_data_path)
os.remove(self._tmp_single_cell_index_path)
Expand Down Expand Up @@ -875,7 +875,7 @@ def process(self, partial=False, n_cells=None, seed=42):

self.log("Running in single threaded mode.")
results = []
for arg in tqdm(args, total = len(args), desc = "Processing cell batches"):
for arg in tqdm(args, total=len(args), desc="Processing cell batches"):
x = f(arg)
results.append(x)
else:
Expand All @@ -899,9 +899,9 @@ def process(self, partial=False, n_cells=None, seed=42):

self.save_index_to_remove = flatten(results)

#cleanup memory and remove any no longer required variables
# cleanup memory and remove any no longer required variables
del results, args
#self._clear_cache(vars_to_delete=["results", "args"]) # this is not working as expected at the moment so need to manually delete the variables
# self._clear_cache(vars_to_delete=["results", "args"]) # this is not working as expected at the moment so need to manually delete the variables
stop_extraction = timeit.default_timer()

# calculate duration
Expand Down

0 comments on commit 6a59091

Please sign in to comment.