org-arl / AcousticRayTracers.jl

Differentiable acoustic ray tracers
MIT License
7 stars 0 forks source link

RaySolver does not support propagating MonteCarloMeasurement uncertainty #11

Open harivnkochi opened 1 year ago

harivnkochi commented 1 year ago

Minimum Working example where transmit depth, sound speed profile and surface loss are StaticParticles variables. But even if just one of them is a StaticParticles variable, I still get the same error.

using AcousticRayTracers, UnderwaterAcoustics, MonteCarloMeasurements
numparticles = 5
tx_depth = 15.75
tx_depth = tx_depth .+ .1StaticParticles(Float32, numparticles)

basefolder = "D:/code_repo/arctic-melt/research/field-analysis"

SSP = [1500.0, 1490.0, 1520.0]
SSP = SSP .+ 5StaticParticles(eltype(SSP), numparticles)
depth_ssp = 0.0:20.0:40.0|>collect

env = UnderwaterEnvironment(
    seasurface = SurfaceLoss(2.6 .+ .1StaticParticles(Float32, numparticles)),
    seabed = SandyClay,
    ssp = SampledSSP(depth_ssp[:], SSP[:], :linear),
    bathymetry = ConstantDepth(200)
)
pm = RaySolver(env; nbeams = Int(5e1), minangle = -10π/180, maxangle=10π/180,ds = 0.02,atol = 1e-5, athreshold = 1e-5, solvertol=1e-10)#, solver=Rodas5()  
tx = AcousticSource(0.0, -tx_depth, 2000.)

rx_all = AcousticReceiver(100, -5) 
vals = arrivals(pm, tx, rx_all)  

The error message is too large to produce, but the main part of the error seems to be the following:

nested task error: MethodError: no method matching nextfloat(::StaticParticles{Float64, 5})
    Closest candidates are:
      nextfloat(::Union{Float16, Float32, Float64}, ::Integer) at float.jl:685
      nextfloat(::Unitful.AbstractQuantity{T}) where T<:AbstractFloat at D:\Julia 1.5.0\.julia\packages\Unitful\orvol\src\quantities.jl:473
      nextfloat(::ForwardDiff.Dual{T, V, N}) where {T, V, N} at D:\Julia 1.5.0\.julia\packages\ForwardDiff\vXysl\src\dual.jl:309
      ...