Skip to content

Commit

Permalink
formatter: apply black on utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesGaydon committed Oct 12, 2023
1 parent a32bc58 commit 1a2f1dd
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions myria3d/pctl/dataset/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ def find_file_in_dir(data_dir: str, basename: str) -> str:
return files[0]


def get_mosaic_of_centers(
tile_width: Number, subtile_width: Number, subtile_overlap: Number = 0
):
def get_mosaic_of_centers(tile_width: Number, subtile_width: Number, subtile_overlap: Number = 0):
if subtile_overlap < 0:
raise ValueError("datamodule.subtile_overlap must be positive.")

Expand Down Expand Up @@ -62,9 +60,7 @@ def pdal_read_las_array(las_path: str):
def pdal_read_las_array_as_float32(las_path: str):
"""Read LAS as a a named array, casted to floats."""
arr = pdal_read_las_array(las_path)
all_floats = np.dtype(
{"names": arr.dtype.names, "formats": ["f4"] * len(arr.dtype.names)}
)
all_floats = np.dtype({"names": arr.dtype.names, "formats": ["f4"] * len(arr.dtype.names)})
return arr.astype(all_floats)


Expand Down Expand Up @@ -125,13 +121,9 @@ def split_cloud_into_samples(
"""
points = pdal_read_las_array_as_float32(las_path)
pos = np.asarray(
[points["X"], points["Y"], points["Z"]], dtype=np.float32
).transpose()
pos = np.asarray([points["X"], points["Y"], points["Z"]], dtype=np.float32).transpose()
kd_tree = cKDTree(pos[:, :2] - pos[:, :2].min(axis=0))
XYs = get_mosaic_of_centers(
tile_width, subtile_width, subtile_overlap=subtile_overlap
)
XYs = get_mosaic_of_centers(tile_width, subtile_width, subtile_overlap=subtile_overlap)
for center in XYs:
radius = subtile_width // 2 # Square receptive field.
minkowski_p = np.inf
Expand Down Expand Up @@ -160,9 +152,7 @@ def get_las_paths_by_split_dict(
for phase in ["train", "val", "test"]:
basenames = split_df[split_df.split == phase].basename.tolist()
# Reminder: an explicit data structure with ./val, ./train, ./test subfolder is required.
las_paths_by_split_dict[phase] = [
str(Path(data_dir) / phase / b) for b in basenames
]
las_paths_by_split_dict[phase] = [str(Path(data_dir) / phase / b) for b in basenames]

if not las_paths_by_split_dict:
raise FileNotFoundError(
Expand Down

0 comments on commit 1a2f1dd

Please sign in to comment.