Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RAPTOR requires requires Python 3 (tested with Python 3.8+). The following Pytho
```

* **NumPy**: For numerical operations and array manipulation.

* **Numba**: For JIT compilation and performance acceleration.
* **PyYAML**: For reading and parsing YAML configuration files
* **VTK**: For writing the output porosity map in `.vti` format
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ dependencies = [
"numba",
"PyYAML",
"vtk",
"scikit-image"
"scikit-image",
"pytest"
]

[project.scripts]
Expand Down
20 changes: 10 additions & 10 deletions src/raptor/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ def compute_spectral_components(melt_pool_data: np.ndarray, n_modes: int) -> np.
fft_resolution = np.fft.fft(melt_pool_data[:, 1])
F = np.zeros_like(fft_resolution)
n_fft = len(fft_resolution)

for i in range(1, n_modes):
F[i] = fft_resolution[i]
F[n_fft - i] = fft_resolution[n_fft - i]

frequencies = np.float64(1 / (dt * n_fft)) * np.arange(n_modes, dtype=np.float64)
phases = np.float64(np.angle(F[:n_modes]))
amplitudes = np.float64(np.abs(F[:n_modes]) / n_fft)

if n_modes == 1:
spectral_array = np.array([[mode0, 0, 0]])
else:
for i in range(1, n_modes):
F[i] = fft_resolution[i]
F[n_fft - i] = fft_resolution[n_fft - i]

frequencies = np.float64(1 / (dt * n_fft)) * np.arange(
n_modes, dtype=np.float64
)
phases = np.float64(np.angle(F[:n_modes]))
amplitudes = np.float64(np.abs(F[:n_modes]) / n_fft)
spectral_array = np.vstack(
[
np.array([mode0, 0, 0]),
Expand Down Expand Up @@ -250,7 +250,7 @@ def compute_morphology(
minsize = 2
filtered_defects = remove_small_objects(labeled_defects, minsize)

return measure.regionproperties_table(
return measure.regionprops_table(
filtered_defects, spacing=voxel_resolution, properties=morphology_fields
)

Expand Down
17 changes: 17 additions & 0 deletions src/raptor/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,32 @@ def __init__(
bound_box: Optional[np.ndarray] = None,
path_vectors: Optional[List[PathVector]] = None,
):
if voxel_resolution <= 0.0:
raise ValueError("Voxel resolution must be a positive non-zero value.")
self.resolution = voxel_resolution

if bound_box is not None:
# Option 1: Grid is constructed from a user-defined bounding box.
if bound_box.shape != (2, 3):
raise ValueError(
"Bounding box must be of shape (2, 3) "
"representing [[x0, y0, z0], [x1, y1, z1]]."
)
if np.any(bound_box[1] <= bound_box[0]):
raise ValueError(
"Invalid bounding box: "
"Maximum corner must be greater than minimum corner."
)
gx0, gy0, gz0 = bound_box[0]
gx1, gy1, gz1 = bound_box[1]

elif path_vectors is not None:
# Option 2: Grid is constructed from boundaries of path vectors.
for pv in path_vectors:
if not isinstance(pv, PathVector):
raise ValueError(
"All elements in 'path_vectors' must be of type PathVector."
)
all_points = np.vstack(
[p.start_point for p in path_vectors]
+ [p.end_point for p in path_vectors]
Expand Down
10 changes: 10 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# =============================================================================
# Copyright (c) 2025 Oak Ridge National Laboratory
#
# All rights reserved.
#
# This file is part of Raptor.
#
# For details, see the top-level LICENSE file at:
# https://github.com/ORNL-MDF/Raptor/LICENSE
# =============================================================================
Loading