Skip to content

Commit

Permalink
Add ModelObsAcousticContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardlavender committed Oct 21, 2024
1 parent 2271e71 commit a4f7739
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions src/005-model-observation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ using Distributions
using LogExpFunctions: logistic, log1pexp

export ModelObs
export ModelObsAcousticLogisTrunc, ModelObsAcousticLogisStd
export ModelObsDepthUniform, ModelObsDepthNormalTrunc, ModelObsDepthNormal
export ModelObsAcousticLogisTrunc, ModelObsAcousticContainer
export ModelObsDepthUniform, ModelObsDepthNormalTrunc


"""
Expand Down Expand Up @@ -48,6 +48,15 @@ y^{(A)}_{t, k} | \\textit{\\textbf{s}}_t \\sim \\text{Bernoulli}(p_{k,t}(\\texti
```
via [`Patter.simulate_obs()`](@ref).
## `ModelObsAcousticContainer`
`ModelObsAcousticContainer` is a `ModelObs` structure for an acoustic container. Acoustic containers define the maximum possible distance of an individual from a receiver that recorded the next detection. This contains the following fields:
- `sensor_id`: An integer that defines the sensor (receiver) ID for the receiver that recorded the next detection;
- `receiver_x`, `receiver_y`: Floats that define the x and y coordinates of the receiver;
- `radius`: A Float that defines the radius of the acoustic container;
Acoustic containers are a computational device used to facilitate convergence in the particle filter. At each time step, particles are permitted or killed depending on whether or not the distance between a particle and the receiver(s) that recorded the next detection(s) is ≤ `radius`.
## `ModelObsDepthUniform`
`ModelObsDepthUniform` is `ModelObs` structure for a depth observation and a uniform depth model. This contains the following fields:
Expand Down Expand Up @@ -202,6 +211,34 @@ end
@doc (@doc ModelObs) logpdf_obs


#########################
#########################
#### Acoustic containers

struct ModelObsAcousticContainer <: ModelObs
sensor_id::Int64
receiver_x::Float64
receiver_y::Float64
radius::Float64
end
@doc (@doc ModelObs) ModelObsAcousticContainer

# A simulate_obs() method is not currently provided for ModelObsAcousticContainer
# * Acoustic containers are calculated post-hoc from acoustic observations
# function simulate_obs(state::State, model_obs::ModelObsAcousticContainer, t::Int64)
#
# end

function logpdf_obs(state::State, model::ModelObsAcousticContainer, t::Int64, obs::Int64)
# Calculate distance between particle (state) and receiver
dist = distance(state.x, state.y, model.receiver_x, model.receiver_y)
# Only particles within max_dist are permitted
# * radius is a pre-calculated field in model
# * (radius = receiver_gamma + (receiver_timestep - t) * mobility)
return ifelse(dist <= model.radius, 0.0, -Inf)
end


#########################
#########################
#### Uniform depth model
Expand Down

0 comments on commit a4f7739

Please sign in to comment.