-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/warisa-r/ShockwaveDetection.jl
- Loading branch information
Showing
7 changed files
with
76 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ jobs: | |
- '1.10' | ||
- '1.9' | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
arch: | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,62 @@ | ||
#TODO: pipeline 1D shock detection too | ||
abstract type AbstractShockDetectionResult end | ||
|
||
struct ShockDetectionResult2D | ||
struct ShockDetectionResult2D <: AbstractShockDetectionResult | ||
shock_positions_over_time::Vector{Any} | ||
shock_clusters_over_time::Vector{Any} | ||
shock_fits_over_time::Vector{Any} | ||
end | ||
|
||
# Pipeline is only for 2D shock detection now | ||
struct ShockDetectionResult1D <: AbstractShockDetectionResult | ||
shock_positions_over_time::Vector{Any} | ||
end | ||
|
||
""" | ||
detect(flow_data::FlowData, shock_point_algo::Abstract2DShockDetectionAlgo, cluster_algo::DBSCANAlgo) | ||
Detects shocks in 2D flow data, clusters the shockpoints and applies fitting to the cluster. | ||
# Arguments | ||
- `flow_data::FlowData`: A `FlowData` object containing the 2D flow field data. | ||
- `shock_point_algo::Abstract2DShockDetectionAlgo`: An algorithm for detecting shock points in 2D flow data. | ||
- `cluster_algo::DBSCANAlgo`: A clustering algorithm (e.g., DBSCAN) to group detected shock points into clusters. | ||
# Returns | ||
- `ShockDetectionResult2D`: An object containing: | ||
- `shock_positions_over_time`: Detected shock points over time. | ||
- `shock_clusters_over_time`: Clusters of shock points over time. | ||
- `shock_fits_over_time`: Fitted shock curves over time. | ||
# Description | ||
This function detects shock points in 2D flow data using a specified shock detection algorithm. Detected shock points are clustered using the provided `DBSCANAlgo`, and then the clusters are fitted to create a smooth representation of the shock over time. | ||
""" | ||
function detect(flow_data::FlowData, shock_point_algo::Abstract2DShockDetectionAlgo, cluster_algo::DBSCANAlgo) | ||
has_obstacle = false | ||
if isnothing(flow_data.u) | ||
has_obstacle = true | ||
end | ||
has_obstacle = isnothing(flow_data.u) # Check if the flow data has an obstacle | ||
shock_positions_over_time = detect_shock_points(flow_data, shock_point_algo, has_obstacle) | ||
shock_clusters_over_time = cluster_shock_points(cluster_algo, shock_positions_over_time, flow_data) | ||
shock_fits_over_time = fit_shock_clusters_over_time(shock_clusters_over_time) | ||
|
||
return ShockDetectionResult2D(shock_positions_over_time, shock_clusters_over_time, shock_fits_over_time) | ||
end | ||
end | ||
|
||
""" | ||
detect(flow_data::FlowData, shock_point_algo::Abstract1DShockDetectionAlgo) | ||
Detects shocks in 1D flow data. | ||
# Arguments | ||
- `flow_data::FlowData`: A `FlowData` object containing the 1D flow field data. | ||
- `shock_point_algo::Abstract1DShockDetectionAlgo`: An algorithm for detecting shock points in 1D flow data. | ||
# Returns | ||
- `ShockDetectionResult1D`: An object containing: | ||
- `shock_positions_over_time`: Detected shock points over time. | ||
# Description | ||
This function detects shock points in 1D flow data using a specified shock detection algorithm. | ||
""" | ||
function detect(flow_data::FlowData, shock_point_algo::Abstract1DShockDetectionAlgo) | ||
has_obstacle = isnothing(flow_data.u) # Check if the flow data has an obstacle | ||
shock_positions_over_time = detect_shock_points(flow_data, shock_point_algo, has_obstacle) | ||
|
||
return ShockDetectionResult1D(shock_positions_over_time) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters