Skip to content

Commit

Permalink
more changes according to review
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspreetishar committed Jan 27, 2025
1 parent 7803a8f commit 8208e7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ dependencies = [
"polars~=1.10.0",
"libpysal~=4.8.1",
"spatialdata~=0.2.6",
"spatialdata_io~=0.1.6",
"alphashape~=1.3.1"
"spatialdata_io~=0.1.6"
]
readme = "README.md"

Expand Down
6 changes: 3 additions & 3 deletions src/celldega/pre/boundary_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def filter_and_save_fine_boundary(coarse_tile, fine_i, fine_j, fine_tile_x_min,
filename = f"{path_output}/cell_tile_{fine_i}_{fine_j}.parquet"
fine_tile_cells.to_parquet(filename)

def process_fine_boundaries(coarse_tile, i, j, coarse_tile_x_min, coarse_tile_x_max, coarse_tile_y_min, coarse_tile_y_max, tile_size, path_output, x_min, y_min, n_fine_tiles_x, n_fine_tiles_y, max_workers):
def process_fine_boundaries(coarse_tile, i, j, coarse_tile_x_min, coarse_tile_x_max, coarse_tile_y_min, coarse_tile_y_max, tile_size, path_output, x_min, y_min, n_fine_tiles_x, n_fine_tiles_y, max_workers=1):
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
futures = []
for fine_i in range(n_fine_tiles_x):
Expand Down Expand Up @@ -134,7 +134,7 @@ def make_cell_boundary_tiles(
tile_size=250,
tile_bounds=None,
image_scale=1,
max_workers=8
max_workers=1
):


Expand Down Expand Up @@ -163,7 +163,7 @@ def make_cell_boundary_tiles(
Dictionary containing the minimum and maximum bounds for x and y coordinates.
image_scale : float, optional, default=1
Scale factor to apply to the geometry data.
max_workers : int, optional, default=8
max_workers : int, optional, default=1
Maximum number of parallel workers for processing tiles.
Returns
Expand Down
8 changes: 4 additions & 4 deletions src/celldega/pre/trx_tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import concurrent.futures
import pandas as pd

def process_coarse_tile(trx, i, j, coarse_tile_x_min, coarse_tile_x_max, coarse_tile_y_min, coarse_tile_y_max, tile_size, path_trx_tiles, x_min, y_min, n_fine_tiles_x, n_fine_tiles_y, max_workers):
def process_coarse_tile(trx, i, j, coarse_tile_x_min, coarse_tile_x_max, coarse_tile_y_min, coarse_tile_y_max, tile_size, path_trx_tiles, x_min, y_min, n_fine_tiles_x, n_fine_tiles_y, max_workers=1):
# Filter the entire dataset for the current coarse tile
coarse_tile = trx.filter(
(pl.col("transformed_x") >= coarse_tile_x_min) & (pl.col("transformed_x") < coarse_tile_x_max) &
Expand All @@ -16,7 +16,7 @@ def process_coarse_tile(trx, i, j, coarse_tile_x_min, coarse_tile_x_max, coarse_
# Now process fine tiles using global fine tile indices
process_fine_tiles(coarse_tile, i, j, coarse_tile_x_min, coarse_tile_x_max, coarse_tile_y_min, coarse_tile_y_max, tile_size, path_trx_tiles, x_min, y_min, n_fine_tiles_x, n_fine_tiles_y, max_workers)

def process_fine_tiles(coarse_tile, coarse_i, coarse_j, coarse_tile_x_min, coarse_tile_x_max, coarse_tile_y_min, coarse_tile_y_max, tile_size, path_trx_tiles, x_min, y_min, n_fine_tiles_x, n_fine_tiles_y, max_workers=8):
def process_fine_tiles(coarse_tile, coarse_i, coarse_j, coarse_tile_x_min, coarse_tile_x_max, coarse_tile_y_min, coarse_tile_y_max, tile_size, path_trx_tiles, x_min, y_min, n_fine_tiles_x, n_fine_tiles_y, max_workers=1):

# Use ThreadPoolExecutor for parallel processing of fine-grain tiles within the coarse tile
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
Expand Down Expand Up @@ -125,7 +125,7 @@ def make_trx_tiles(
chunk_size=1000000,
verbose=False,
image_scale=1,
max_workers=8
max_workers=1
):
"""
Processes transcript data by dividing it into coarse-grain and fine-grain tiles,
Expand All @@ -152,7 +152,7 @@ def make_trx_tiles(
image_scale : float, optional
Scale factor to apply to the transcript coordinates (default is 0.5).
max_workers : int, optional
Maximum number of parallel workers for processing tiles (default is 8).
Maximum number of parallel workers for processing tiles (default is 1).
Returns
-------
Expand Down

0 comments on commit 8208e7f

Please sign in to comment.