├── doc ├── DWBA_functions.R ├── CompareToAnalyticalSolution.R ├── gh2.R ├── DWBA_functions.Rmd └── gh2.Rmd ├── R ├── ._app.R ├── .DS_Store ├── ._bscat.R ├── ._DWBAbscat.R ├── ._buildpos.R ├── ._inhom_gh.R ├── ._read_para.R ├── ._smoother.R ├── ZooScatR-package.r ├── ._length_ave.R ├── ._orient_ave.R ├── ._create_profile.R ├── ._video2profile.R ├── ._water_density.R ├── rho_c.R ├── smoother.R ├── orient_ave.R ├── create_profile.R ├── length_ave.R ├── water_density.R ├── DWBAbscat.R ├── read_para.R ├── save_config.R ├── soundvelocity.R ├── simple_inversion.R ├── TScal.R ├── video2profile.R ├── buildpos.R ├── inhom_gh.R ├── get_shape.R ├── bscat.R └── TSsphere.R ├── tests └── testthat.R ├── .Rbuildignore ├── man ├── .DS_Store ├── figures │ ├── Figure-1.png │ ├── Figure-2.png │ ├── Figure-3.png │ ├── Figure-4.png │ └── Figure-5.png ├── ZooScatR.Rd ├── rho_c.Rd ├── dens.Rd ├── rotate.Rd ├── rho_smow.Rd ├── K_p0.Rd ├── densify.Rd ├── K.Rd ├── rho_p0.Rd ├── get_int.Rd ├── lambda.Rd ├── Sbessj.Rd ├── SHankel.Rd ├── Sneum.Rd ├── besselH.Rd ├── set_la.Rd ├── SHankel_p.Rd ├── Sneum_p.Rd ├── Sbessj_p.Rd ├── set_res.Rd ├── plot_3D.Rd ├── rho.Rd ├── smoother.Rd ├── inhom_gh.Rd ├── createParaDat.Rd ├── LegPoly.Rd ├── generate_pos.Rd ├── read_para.Rd ├── orient_ave.Rd ├── length_ave.Rd ├── get_mid.Rd ├── buildpos.Rd ├── c_Mackenzie1981.Rd ├── c_Coppens1981.Rd ├── DWBAscat2.Rd ├── TS.sphere.Rd ├── create_profile.Rd ├── TS.sphere2.Rd ├── TS.inverse.simple.Rd ├── c_Leroy08.Rd ├── ts.cal.Rd ├── bscat.Rd └── DWBAapp.Rd ├── inst ├── .DS_Store ├── extdata │ ├── .DS_Store │ ├── profiles │ │ ├── .DS_Store │ │ └── skaret.dat │ ├── inhomogenous_bodies │ │ ├── gh_profile_seg10.mat │ │ └── gh_profile_seg7.mat │ ├── configs │ │ ├── config_0.dat │ │ ├── config_1.dat │ │ ├── config_tester.dat │ │ ├── config_krill.dat │ │ └── test.dat │ └── doc │ │ └── about.html └── CITATION ├── data-raw └── TS_sim.R ├── vignettes ├── zoom.png ├── calc_c.png ├── appStart.png ├── calc_rho.png ├── para_ex.png ├── res_pane.png ├── res_tab.png ├── initial_run.png ├── load_config.png ├── shape_pane.png ├── result_mover.png ├── shape_prof_info.png ├── Simulations.R ├── Simulations.Rmd ├── CompareToAnalyticalSolution.R ├── gh2.R ├── DWBA_functions.Rmd └── gh2.Rmd ├── ZooScatR.Rproj ├── .gitignore ├── DESCRIPTION ├── NAMESPACE └── README.md /doc/DWBA_functions.R: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /R/._app.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._app.R -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(ZooScat) 3 | 4 | test_check("ZooScat") 5 | -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^Meta$ 2 | ^.*\.Rproj$ 3 | ^\.Rproj\.user$ 4 | ^docs$ 5 | ^doc$ 6 | ^data-raw$ 7 | -------------------------------------------------------------------------------- /R/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/.DS_Store -------------------------------------------------------------------------------- /R/._bscat.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._bscat.R -------------------------------------------------------------------------------- /man/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/man/.DS_Store -------------------------------------------------------------------------------- /R/._DWBAbscat.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._DWBAbscat.R -------------------------------------------------------------------------------- /R/._buildpos.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._buildpos.R -------------------------------------------------------------------------------- /R/._inhom_gh.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._inhom_gh.R -------------------------------------------------------------------------------- /R/._read_para.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._read_para.R -------------------------------------------------------------------------------- /R/._smoother.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._smoother.R -------------------------------------------------------------------------------- /R/ZooScatR-package.r: -------------------------------------------------------------------------------- 1 | #' ZooScatR. 2 | #' 3 | #' @name ZooScatR 4 | #' @docType package 5 | NULL 6 | -------------------------------------------------------------------------------- /inst/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/inst/.DS_Store -------------------------------------------------------------------------------- /R/._length_ave.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._length_ave.R -------------------------------------------------------------------------------- /R/._orient_ave.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._orient_ave.R -------------------------------------------------------------------------------- /data-raw/TS_sim.R: -------------------------------------------------------------------------------- 1 | TS_sim <- 2 | readRDS('TS_sim.RDS') 3 | devtools::use_data(TS_sim, overwrite = TRUE) 4 | -------------------------------------------------------------------------------- /vignettes/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/zoom.png -------------------------------------------------------------------------------- /R/._create_profile.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._create_profile.R -------------------------------------------------------------------------------- /R/._video2profile.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._video2profile.R -------------------------------------------------------------------------------- /R/._water_density.R: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/R/._water_density.R -------------------------------------------------------------------------------- /vignettes/calc_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/calc_c.png -------------------------------------------------------------------------------- /inst/extdata/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/inst/extdata/.DS_Store -------------------------------------------------------------------------------- /vignettes/appStart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/appStart.png -------------------------------------------------------------------------------- /vignettes/calc_rho.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/calc_rho.png -------------------------------------------------------------------------------- /vignettes/para_ex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/para_ex.png -------------------------------------------------------------------------------- /vignettes/res_pane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/res_pane.png -------------------------------------------------------------------------------- /vignettes/res_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/res_tab.png -------------------------------------------------------------------------------- /man/figures/Figure-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/man/figures/Figure-1.png -------------------------------------------------------------------------------- /man/figures/Figure-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/man/figures/Figure-2.png -------------------------------------------------------------------------------- /man/figures/Figure-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/man/figures/Figure-3.png -------------------------------------------------------------------------------- /man/figures/Figure-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/man/figures/Figure-4.png -------------------------------------------------------------------------------- /man/figures/Figure-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/man/figures/Figure-5.png -------------------------------------------------------------------------------- /vignettes/initial_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/initial_run.png -------------------------------------------------------------------------------- /vignettes/load_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/load_config.png -------------------------------------------------------------------------------- /vignettes/shape_pane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/shape_pane.png -------------------------------------------------------------------------------- /vignettes/result_mover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/result_mover.png -------------------------------------------------------------------------------- /vignettes/shape_prof_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/vignettes/shape_prof_info.png -------------------------------------------------------------------------------- /inst/extdata/profiles/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/inst/extdata/profiles/.DS_Store -------------------------------------------------------------------------------- /inst/extdata/inhomogenous_bodies/gh_profile_seg10.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/inst/extdata/inhomogenous_bodies/gh_profile_seg10.mat -------------------------------------------------------------------------------- /inst/extdata/inhomogenous_bodies/gh_profile_seg7.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AustralianAntarcticDivision/ZooScatR/HEAD/inst/extdata/inhomogenous_bodies/gh_profile_seg7.mat -------------------------------------------------------------------------------- /man/ZooScatR.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ZooScatR-package.r 3 | \docType{package} 4 | \name{ZooScatR} 5 | \alias{ZooScatR} 6 | \title{ZooScatR.} 7 | -------------------------------------------------------------------------------- /man/rho_c.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rho_c.R 3 | \name{rho_c} 4 | \alias{rho_c} 5 | \title{rho_c} 6 | \usage{ 7 | rho_c(x, y) 8 | } 9 | \arguments{ 10 | \item{x}{x coordinates} 11 | 12 | \item{y}{y coordinates} 13 | } 14 | \description{ 15 | Radius of curvature 16 | } 17 | -------------------------------------------------------------------------------- /man/dens.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_shape.R 3 | \name{dens} 4 | \alias{dens} 5 | \title{Densify a vector} 6 | \usage{ 7 | dens(x, n = 15) 8 | } 9 | \arguments{ 10 | \item{x}{vector to be densified} 11 | 12 | \item{n}{densification factor} 13 | } 14 | \description{ 15 | Densify a vector 16 | } 17 | -------------------------------------------------------------------------------- /man/rotate.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_shape.R 3 | \name{rotate} 4 | \alias{rotate} 5 | \title{Rotate axis} 6 | \usage{ 7 | rotate(xy, angle) 8 | } 9 | \arguments{ 10 | \item{xy}{dataframe with xy coordinates} 11 | 12 | \item{angle}{rotation angle} 13 | } 14 | \description{ 15 | Rotate axis 16 | } 17 | -------------------------------------------------------------------------------- /man/rho_smow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/water_density.R 3 | \name{rho_smow} 4 | \alias{rho_smow} 5 | \title{Standard Mean Ocean Water (SMOW)} 6 | \usage{ 7 | rho_smow(T) 8 | } 9 | \arguments{ 10 | \item{T}{Temperature in degrees Celsius} 11 | } 12 | \description{ 13 | Standard Mean Ocean Water (SMOW) 14 | } 15 | -------------------------------------------------------------------------------- /man/K_p0.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/water_density.R 3 | \name{K_p0} 4 | \alias{K_p0} 5 | \title{compressibility at p = 0} 6 | \usage{ 7 | K_p0(S, T) 8 | } 9 | \arguments{ 10 | \item{S}{Salinity in psu (~ppm)} 11 | 12 | \item{T}{Temperature in degrees Celsius} 13 | } 14 | \description{ 15 | compressibility at p = 0 16 | } 17 | -------------------------------------------------------------------------------- /man/densify.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_shape.R 3 | \name{densify} 4 | \alias{densify} 5 | \title{Densify points along axis} 6 | \usage{ 7 | densify(xy, n = 20) 8 | } 9 | \arguments{ 10 | \item{xy}{dataframe with xy coordinates} 11 | 12 | \item{b}{densify factor} 13 | } 14 | \description{ 15 | Densify points along axis 16 | } 17 | -------------------------------------------------------------------------------- /inst/extdata/profiles/skaret.dat: -------------------------------------------------------------------------------- 1 | 0 38.35 0 2 | 0.9149 36.8563 0.2147 3 | 1.7924 34.0464 0.6525 4 | 2.4552 29.416 1.1296 5 | 2.4365 26.6247 1.3537 6 | 2.4552 23.5253 1.447 7 | 2.3059 20.6967 1.5964 8 | 2.2498 17.7 1.5497 9 | 2.0538 15.1888 1.6524 10 | 1.8484 12.8456 1.9044 11 | 1.6897 10.5304 1.7551 12 | 1.6897 8.4672 1.6524 13 | 2.0631 6.6468 1.3816 14 | 2.4739 2.9687 1.1016 15 | 3.5568 0 0.5508 16 | -------------------------------------------------------------------------------- /man/K.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/water_density.R 3 | \name{K} 4 | \alias{K} 5 | \title{compressibility K} 6 | \usage{ 7 | K(S, T, p) 8 | } 9 | \arguments{ 10 | \item{S}{Salinity in psu (~ppm)} 11 | 12 | \item{T}{Temperature in degrees Celsius} 13 | 14 | \item{p}{pressure in bar} 15 | } 16 | \description{ 17 | compressibility K 18 | } 19 | -------------------------------------------------------------------------------- /man/rho_p0.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/water_density.R 3 | \name{rho_p0} 4 | \alias{rho_p0} 5 | \title{Density (rho) at normal atmospheric pressure (p = 0)} 6 | \usage{ 7 | rho_p0(S, T) 8 | } 9 | \arguments{ 10 | \item{S}{Salinity in psu (~ppm)} 11 | 12 | \item{T}{Temperature in degrees Celsius} 13 | } 14 | \description{ 15 | Density (rho) at normal atmospheric pressure (p = 0) 16 | } 17 | -------------------------------------------------------------------------------- /man/get_int.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_shape.R 3 | \name{get_int} 4 | \alias{get_int} 5 | \title{Get polygon points from contour coordinates} 6 | \usage{ 7 | get_int(xyP, lout = 1000) 8 | } 9 | \arguments{ 10 | \item{xyP}{contour points with columns x, y} 11 | 12 | \item{lout}{length of the output data frame} 13 | } 14 | \description{ 15 | Get polygon points from contour coordinates 16 | } 17 | -------------------------------------------------------------------------------- /man/lambda.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{lambda} 4 | \alias{lambda} 5 | \title{Calculate the acoustic wave length lambda} 6 | \usage{ 7 | lambda(c, f) 8 | } 9 | \arguments{ 10 | \item{c}{Soundspeed in m/s} 11 | 12 | \item{f}{frequency in Hz (s^-1)} 13 | } 14 | \description{ 15 | Calculate the acoustic wave length lambda 16 | } 17 | \examples{ 18 | lambda(c=1500,f=200000) 19 | } 20 | -------------------------------------------------------------------------------- /man/Sbessj.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{Sbessj} 4 | \alias{Sbessj} 5 | \title{Spherical bessel function first kind} 6 | \usage{ 7 | Sbessj(x, order) 8 | } 9 | \arguments{ 10 | \item{x}{numeric data vector} 11 | 12 | \item{order}{order of the bessel funciton} 13 | } 14 | \description{ 15 | Spherical bessel function first kind 16 | } 17 | \examples{ 18 | Sbessj(x=1:10,order=1) 19 | } 20 | -------------------------------------------------------------------------------- /man/SHankel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{SHankel} 4 | \alias{SHankel} 5 | \title{Spherical Hankel function} 6 | \usage{ 7 | SHankel(z, order) 8 | } 9 | \arguments{ 10 | \item{z}{numeric data vector} 11 | 12 | \item{order}{order of the bessel funciton} 13 | } 14 | \description{ 15 | Spherical Hankel function 16 | } 17 | \examples{ 18 | SHankel(x=1:10,order=1) 19 | SHankel(x=1:10,order=0) 20 | } 21 | -------------------------------------------------------------------------------- /man/Sneum.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{Sneum} 4 | \alias{Sneum} 5 | \title{Spherical bessel function second kind (Neumann)} 6 | \usage{ 7 | Sneum(x, order) 8 | } 9 | \arguments{ 10 | \item{x}{numeric data vector} 11 | 12 | \item{order}{order of the bessel funciton} 13 | } 14 | \description{ 15 | Spherical bessel function second kind (Neumann) 16 | } 17 | \examples{ 18 | Sneum(x=1:10,order=1) 19 | } 20 | -------------------------------------------------------------------------------- /man/besselH.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{besselH} 4 | \alias{besselH} 5 | \title{Hankel function} 6 | \usage{ 7 | besselH(k, n, z) 8 | } 9 | \arguments{ 10 | \item{k}{kind of Hankel function must be 1 or 2} 11 | 12 | \item{n}{order of the Hankel funciton} 13 | 14 | \item{z}{numeric data vector} 15 | } 16 | \description{ 17 | Hankel function 18 | } 19 | \examples{ 20 | besselH(k=1,n=1,z=1:10) 21 | } 22 | -------------------------------------------------------------------------------- /man/set_la.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/app.R 3 | \name{set_la} 4 | \alias{set_la} 5 | \title{Compute L/a for given a and L} 6 | \usage{ 7 | set_la(para, a = 2) 8 | } 9 | \arguments{ 10 | \item{para}{a list of parameters as used in ZooScatR} 11 | 12 | \item{a}{maximum radius of the input shape} 13 | } 14 | \value{ 15 | a plotly plot object 16 | } 17 | \description{ 18 | Generates L/a based on a radius and L input 19 | } 20 | -------------------------------------------------------------------------------- /ZooScatR.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace,vignette 22 | -------------------------------------------------------------------------------- /man/SHankel_p.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{SHankel_p} 4 | \alias{SHankel_p} 5 | \title{Derivative of the Spherical Hankel function} 6 | \usage{ 7 | SHankel_p(x, order) 8 | } 9 | \arguments{ 10 | \item{x}{numeric data vector} 11 | 12 | \item{order}{order of the bessel funciton} 13 | } 14 | \description{ 15 | Derivative of the Spherical Hankel function 16 | } 17 | \examples{ 18 | SHankel_p(x=1:10,order=1) 19 | SHankel_p(x=1:10,order=0) 20 | } 21 | -------------------------------------------------------------------------------- /man/Sneum_p.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{Sneum_p} 4 | \alias{Sneum_p} 5 | \title{Derivative of the Spherical bessel function second kind} 6 | \usage{ 7 | Sneum_p(x, order) 8 | } 9 | \arguments{ 10 | \item{x}{numeric data vector} 11 | 12 | \item{order}{order of the bessel funciton} 13 | } 14 | \description{ 15 | Derivative of the Spherical bessel function second kind 16 | } 17 | \examples{ 18 | Sneum_p(x=1:10,order=1) 19 | Sneum_p(x=1:10,order=0) 20 | } 21 | -------------------------------------------------------------------------------- /R/rho_c.R: -------------------------------------------------------------------------------- 1 | #' @title rho_c 2 | #' @description Radius of curvature 3 | #' @param x x coordinates 4 | #' @param y y coordinates 5 | #' @export 6 | 7 | rho_c = function(x,y){ 8 | #get center of mass 9 | mx <- mean(x); my<- mean(y) 10 | X <- x-mx; Y=y-my 11 | dx2 <- mean(X^2); dy2 <- mean(Y^2) 12 | 13 | RHS <- (x^2 - dx2 + Y^2 - dy2)/2 14 | 15 | M <- c(X,Y) 16 | 17 | t = M/RHS 18 | 19 | a0 <- t[1]; b0 <- t[2] 20 | 21 | r <- sqrt(dx2 + dy2 + a0^2 + b0^2) 22 | 23 | a <- a0+mx 24 | 25 | b = b0+my 26 | 27 | } 28 | -------------------------------------------------------------------------------- /man/Sbessj_p.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{Sbessj_p} 4 | \alias{Sbessj_p} 5 | \title{Derivative of the Spherical bessel function first kind} 6 | \usage{ 7 | Sbessj_p(x, order) 8 | } 9 | \arguments{ 10 | \item{x}{numeric data vector} 11 | 12 | \item{order}{order of the bessel funciton} 13 | } 14 | \description{ 15 | Derivative of the Spherical bessel function first kind 16 | } 17 | \examples{ 18 | Sbessj_p(x=1:10,order=1) 19 | Sbessj_p(x=1:10,order=0) 20 | } 21 | -------------------------------------------------------------------------------- /man/set_res.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/app.R 3 | \name{set_res} 4 | \alias{set_res} 5 | \title{Set number of variable to be computed by resolution} 6 | \usage{ 7 | set_res(para, res = 1) 8 | } 9 | \arguments{ 10 | \item{para}{a list of parameters as used in ZooScatR} 11 | 12 | \item{res}{the resolution of the output variable} 13 | } 14 | \value{ 15 | a plotly plot object 16 | } 17 | \description{ 18 | Creates a 3D plotly plot of the prolate spheroid shape input 19 | for ZooScatR, based on the parameters file. 20 | } 21 | -------------------------------------------------------------------------------- /man/plot_3D.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/app.R 3 | \name{plot_3D} 4 | \alias{plot_3D} 5 | \title{plot_3D function to create a 3D plot of a prolate spheroid} 6 | \usage{ 7 | plot_3D(para, nx = 100) 8 | } 9 | \arguments{ 10 | \item{para}{a list of parameters as used in ZooScatR} 11 | 12 | \item{nx}{number of point constituing circular elements} 13 | } 14 | \value{ 15 | a plotly plot object 16 | } 17 | \description{ 18 | Creates a 3D plotly plot of the prolate spheroid shape input 19 | for ZooScatR, based on the parameters file. 20 | } 21 | -------------------------------------------------------------------------------- /man/rho.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/water_density.R 3 | \name{rho} 4 | \alias{rho} 5 | \title{Seawater Density according to UNESCO formula} 6 | \usage{ 7 | rho(S, T, p = 0) 8 | } 9 | \arguments{ 10 | \item{S}{Salinity in psu (which is +/- equal to ppm)} 11 | 12 | \item{T}{Temperature in degrees} 13 | 14 | \item{p}{pressure in Bar} 15 | } 16 | \description{ 17 | UNESCO (1981) Tenth report of the joint panel on 18 | oceanographic tables and standards. UNESCO Technical 19 | Papers in Marine Science, Paris, 25p 20 | } 21 | \examples{ 22 | rho(S=35,T=0.5,p=10) 23 | rho(8,10) #Should be 1005.94659 24 | } 25 | -------------------------------------------------------------------------------- /man/smoother.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/smoother.R 3 | \name{smoother} 4 | \alias{smoother} 5 | \title{Smoothing function} 6 | \usage{ 7 | smoother(yi, n) 8 | } 9 | \arguments{ 10 | \item{yi}{Vector of values to be smoothed} 11 | 12 | \item{n}{Number of points contained in the output y} 13 | } 14 | \value{ 15 | y vector of smoothed y points 16 | } 17 | \description{ 18 | Smoother function used to build the shape of the targets when axis or taper smoothing is requested. 19 | } 20 | \examples{ 21 | yi <- sample(1:1000,100) 22 | n <- 4 23 | y <- smoother(yi,n) 24 | } 25 | \author{ 26 | Sven Gastauer 27 | } 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Meta 2 | doc 3 | # History files 4 | .Rhistory 5 | .Rapp.history 6 | 7 | # Session Data files 8 | .RData 9 | # Example code in package build process 10 | *-Ex.R 11 | # Output files from R CMD build 12 | /*.tar.gz 13 | # Output files from R CMD check 14 | /*.Rcheck/ 15 | # RStudio files 16 | .Rproj.user/ 17 | # produced vignettes 18 | vignettes/*.html 19 | vignettes/*.pdf 20 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 21 | .httr-oauth 22 | # knitr and R markdown default cache directories 23 | /*_cache/ 24 | /cache/ 25 | # Temporary files created by R markdown 26 | *.utf8.md 27 | *.knit.md 28 | .Rproj.user 29 | inst/doc 30 | /doc 31 | /docs 32 | -------------------------------------------------------------------------------- /man/inhom_gh.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/inhom_gh.R 3 | \name{inhom_gh} 4 | \alias{inhom_gh} 5 | \title{inhom_gh} 6 | \usage{ 7 | inhom_gh(para) 8 | } 9 | \arguments{ 10 | \item{para}{set of parameters} 11 | } 12 | \value{ 13 | Returns a list containing the constructed g, h, Cb, FlucVal (fluctuation value), ghplot (a plot of the newly generated g and h), flucplot (a plot of the fluctuation function), gh.sum (a summary of the new gh values) 14 | } 15 | \description{ 16 | construct inhomogeneous g and h based on given parameter 17 | } 18 | \examples{ 19 | new_gh <- inhom_gh(para) 20 | new_gh$flucplot 21 | new_gh$ghplot 22 | } 23 | -------------------------------------------------------------------------------- /man/createParaDat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/save_config.R 3 | \name{createParaDat} 4 | \alias{createParaDat} 5 | \title{Save the parameter file} 6 | \usage{ 7 | createParaDat(para, fn) 8 | } 9 | \arguments{ 10 | \item{para}{Parameters} 11 | 12 | \item{fn}{Filename with path, to where the dat file should be written} 13 | } 14 | \value{ 15 | Returns a a .dat file with all model parameters 16 | } 17 | \description{ 18 | Save the model parameter. Keep standard dat format, as used in th eoriginal Matlab code, to keep maximum compatibility with previously generated files 19 | } 20 | \examples{ 21 | fn <- 'config_0.dat' 22 | para <- read_para(fn) 23 | createParaDat(para,fn) 24 | } 25 | -------------------------------------------------------------------------------- /man/LegPoly.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{LegPoly} 4 | \alias{LegPoly} 5 | \title{Calculate Legendre Polynomial} 6 | \usage{ 7 | LegPoly(degree, coeffs) 8 | } 9 | \arguments{ 10 | \item{degree}{The degree of the desired polynomial} 11 | 12 | \item{coeffs}{the values at which the p[olynomial will be evaluated} 13 | } 14 | \value{ 15 | Legendre polynomials 16 | } 17 | \description{ 18 | Function to calculate the Legendre Polynomial, 19 | based on the recurrence relation in Numerical Recipes in C (Eq. 4.6.10) with j = j-1 20 | Therefore: 21 | P_j = (2j-1) * P_(j-1) - (j-1) * P_(j-2) 22 | P_0 = 1; P_1 = x 23 | } 24 | \examples{ 25 | coeffs=2;degree=3 26 | LegPoly(degree,coeffs) 27 | } 28 | -------------------------------------------------------------------------------- /man/generate_pos.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/video2profile.R 3 | \name{generate_pos} 4 | \alias{generate_pos} 5 | \title{Read the configuration file 6 | Keep standard dat format, as used in Matlab, to keep maximum compatibility with previous files} 7 | \usage{ 8 | generate_pos(x = sub$x, y = sub$y, z = sub$z) 9 | } 10 | \arguments{ 11 | \item{x}{x coordinates} 12 | 13 | \item{y}{y corrdinates} 14 | 15 | \item{z}{z coordinates} 16 | } 17 | \value{ 18 | shape 19 | } 20 | \description{ 21 | Read the configuration file 22 | Keep standard dat format, as used in Matlab, to keep maximum compatibility with previous files 23 | } 24 | \examples{ 25 | sub <- shapes[which(shapes$ID==unique(shapes$ID)[x]),] 26 | generate_pos(sub$x,sub$y,sub$z) 27 | } 28 | -------------------------------------------------------------------------------- /man/read_para.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/read_para.R 3 | \name{read_para} 4 | \alias{read_para} 5 | \title{Read the configuration file} 6 | \usage{ 7 | read_para(fn) 8 | } 9 | \arguments{ 10 | \item{fn}{Filename} 11 | } 12 | \value{ 13 | list with all parameters for DWBA 14 | } 15 | \description{ 16 | Read a DWBA configuration file. Keep standard .dat format, as used in Matlab, to keep maximum compatibility with previous model definitions. 17 | 18 | .dat files are standard text files. 19 | 20 | Some example config files can be found in the extdata/configs folder: (\code{system.file(package="ZooScatR")}), contained within the package directory. 21 | } 22 | \examples{ 23 | fn <- paste0(system.file(package="ZooScatR"),"/extdata/configs/config_0.dat") 24 | para <- read_para(fn) 25 | } 26 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: ZooScatR 2 | Type: Package 3 | Title: ZooScatR - Acoustic Scattering of zooplankton using DWBA 4 | Version: 0.61 5 | Date: 2022-08-09 6 | Author: Sven Gastauer, Dezhang Chu, Martin J. Cox 7 | Maintainer: Sven Gastauer ; Martin J. Cox 8 | Description: Modelling the acoustic scattering properties of weak scatterers inside a fluid using the Distorted Wave Born Approximation (DWBA). 9 | License: GPL-3 10 | Encoding: UTF-8 11 | LazyData: true 12 | Depends: 13 | R (>= 3.0) 14 | Imports: 15 | Rdpack, 16 | knitr, 17 | pracma, 18 | ggplot2, 19 | shiny, 20 | shinyjs, 21 | reshape2, 22 | dplyr, 23 | doSNOW, 24 | tcltk2, 25 | viridis, 26 | sf, 27 | dplyr, 28 | plotly 29 | RdMacros: Rdpack 30 | RoxygenNote: 7.2.0 31 | Suggests: testthat, 32 | knitr, 33 | rmarkdown 34 | VignetteBuilder: knitr 35 | -------------------------------------------------------------------------------- /man/orient_ave.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/orient_ave.R 3 | \name{orient_ave} 4 | \alias{orient_ave} 5 | \title{averaging over orientation} 6 | \usage{ 7 | orient_ave(ang, f, pdf_type, paral) 8 | } 9 | \arguments{ 10 | \item{ang}{incident angle} 11 | 12 | \item{f}{complex form function as a function of frequency, ka or orient. angle} 13 | 14 | \item{pdf_type}{distribution type 1: uniform 2: Gaussian} 15 | 16 | \item{paral}{PDF parameters: paral[1] = angle; paral[2] = range for uniform, = std for Gaussian} 17 | } 18 | \value{ 19 | averaged y points 20 | } 21 | \description{ 22 | averaging over orientation 23 | } 24 | \examples{ 25 | #averaging over orientation 26 | paral = orient_ave_para 27 | f=f 28 | pdf_type = para$orient$PDF 29 | paral = orient_ave_para 30 | paral=orient_ave_para 31 | orinet_ave(ang, f, pdf_type, paral) 32 | } 33 | \author{ 34 | Sven Gastauer 35 | } 36 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite ZooScatR in publications use:") 2 | 3 | citEntry(entry = "Article", 4 | title = "ZooScatR—An R package for modelling the scattering properties of weak scattering targets using the distorted wave Born approximation", 5 | author = personList(as.person("Sven Gastauer"), as.person("Dezhang Chu"), as.person("Martin J. Cox")), 6 | journal = "Unpublished", 7 | year = "2019", 8 | volume = "145", 9 | number = "1", 10 | doi = "10.1121/1.5085655", 11 | 12 | textVersion = 13 | paste("Gastauer S, Chu D, Cox MJ (2019).", 14 | "ZooScatR—An R package for modelling the scattering properties of weak scattering targets using the distorted wave Born approximation", 15 | "The Journal of the Acoustical Society of America 2019 145:1, EL102-EL108", 16 | "doi: 10.1121/1.5085655") 17 | ) -------------------------------------------------------------------------------- /man/length_ave.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/length_ave.R 3 | \name{length_ave} 4 | \alias{length_ave} 5 | \title{Model output averaged over length} 6 | \usage{ 7 | length_ave(ka0, ka1, f, pdf_type, paral, app = FALSE) 8 | } 9 | \arguments{ 10 | \item{ka0}{original ka ka=[ -3*std_a +3*std_a]} 11 | 12 | \item{ka1}{output ka} 13 | 14 | \item{f}{complex form function - freq.(or ka) x - orient. angle} 15 | 16 | \item{pdf_type}{probablity density function type 1: uniform 2: Gaussian} 17 | 18 | \item{paral}{PDF parameters: paral[1] = no. of bins for L PDF; paral[2] = 1/3 max. deviation for uniform, = std(length) for Gaussian} 19 | 20 | \item{app}{= FALSE [boolean] function call from shiny interface or command line} 21 | } 22 | \value{ 23 | averaged sigma_bs points 24 | } 25 | \description{ 26 | Model output averaged over length 27 | } 28 | \examples{ 29 | ka0=ka 30 | ka1=kaL 31 | f=f1 32 | pdf_type=2 33 | paral=len_ave_para 34 | length_ave(ka0,ka1,pdf_type,paral) 35 | } 36 | -------------------------------------------------------------------------------- /man/get_mid.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/get_shape.R 3 | \name{get_mid} 4 | \alias{get_mid} 5 | \title{Generate a ZooScatR shape file from x,y contour points} 6 | \usage{ 7 | get_mid(fn, outdir = "", ndens = 500, prec = 2, rot = FALSE, res = 0.02) 8 | } 9 | \arguments{ 10 | \item{fn}{character, input filename containing 2 columns with the x, y coordinates} 11 | 12 | \item{outdir}{character, folder to which the the output shape should be saved, defaults to '', which selectds the current working directory} 13 | 14 | \item{ndens}{integer, number of points that will be used as a densification factor, defaults 500} 15 | 16 | \item{prec}{decimal points precision at which duplicated point will be averaged, defaults to 2} 17 | 18 | \item{rot}{boolean, TRUE/FALSE, used if x and y columns in the input file are flipped} 19 | 20 | \item{res}{numeric, defines the output resolution of the shape, defaults 0.02} 21 | } 22 | \description{ 23 | Generates a shape file tha tcan be used directly in a ZooScatR model, based on contour coordinates 24 | } 25 | -------------------------------------------------------------------------------- /R/smoother.R: -------------------------------------------------------------------------------- 1 | #' @title Smoothing function 2 | #' @description Smoother function used to build the shape of the targets when axis or taper smoothing is requested. 3 | #' @author Sven Gastauer 4 | #' @param yi Vector of values to be smoothed 5 | #' @param n Number of points contained in the output y 6 | #' @return y vector of smoothed y points 7 | #' @export 8 | #' @examples 9 | #' yi <- sample(1:1000,100) 10 | #' n <- 4 11 | #' y <- smoother(yi,n) 12 | #' @export 13 | 14 | smoother <- function(yi,n){ 15 | if(n <= 1){ 16 | y=yi 17 | return(y) 18 | } 19 | 20 | y=yi 21 | nl=length(yi) 22 | 23 | if(n > nl){ 24 | n=nl 25 | } 26 | 27 | m=floor(n/2) 28 | 29 | for(i in 1:m){ 30 | #y[i] = mean(yi[max(1,(i-m)):i+m], na.rm=T) } 31 | y[i] = mean(yi[max(1, (i-m)) : (i+m)])} 32 | 33 | for(i in seq((m+1),(nl-m))){ 34 | #y[i] = (mean( yi[(i-m) : (i+m)], na.rm=T) ) 35 | y[i] = mean( yi[ (i-m) : (i+m) ])} 36 | 37 | for(i in (nl-m+1):nl){ 38 | #y[i] = mean(yi[(i-m) : (min(i+m,nl))], na.rm=T) 39 | y[i] = mean(yi[(i-m) : min( (i+m), nl )], na.rm=T) 40 | } 41 | 42 | return(y) 43 | } 44 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(DWBAapp) 4 | export(DWBAscat2) 5 | export(K) 6 | export(K_p0) 7 | export(LegPoly) 8 | export(SHankel) 9 | export(SHankel_p) 10 | export(Sbessj) 11 | export(Sbessj_p) 12 | export(Sneum) 13 | export(Sneum_p) 14 | export(TS.inverse.simple) 15 | export(TS.sphere) 16 | export(TS.sphere2) 17 | export(besselH) 18 | export(bscat) 19 | export(buildpos) 20 | export(c_Coppens1981) 21 | export(c_Leroy08) 22 | export(c_Mackenzie1981) 23 | export(createParaDat) 24 | export(create_profile) 25 | export(dens) 26 | export(densify) 27 | export(generate_pos) 28 | export(get_int) 29 | export(get_mid) 30 | export(inhom_gh) 31 | export(k) 32 | export(lambda) 33 | export(length_ave) 34 | export(orient_ave) 35 | export(plot_3D) 36 | export(read_para) 37 | export(rho) 38 | export(rho_c) 39 | export(rho_p0) 40 | export(rho_smow) 41 | export(rotate) 42 | export(set_la) 43 | export(set_res) 44 | export(smoother) 45 | export(ts.cal) 46 | import(dplyr) 47 | import(ggplot2) 48 | import(plotly) 49 | import(pracma) 50 | import(reshape2) 51 | import(sf) 52 | import(shiny) 53 | import(shinyjs) 54 | -------------------------------------------------------------------------------- /man/buildpos.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/buildpos.R 3 | \name{buildpos} 4 | \alias{buildpos} 5 | \title{Build shape vector of the hypothetical target} 6 | \usage{ 7 | buildpos(para, disp_prof = 1) 8 | } 9 | \arguments{ 10 | \item{para}{a list containining the shape parameters (used arguments: para$shape$ni - Number of integration points; para$shape$order - Tapering order; para$shape$rho_L - rho = radius of curvature; para$shape$prof_name - 0Custom shape, -1 for regular shape, filename for custom shape} 11 | 12 | \item{disp_prof}{= 1 if 1 a ggplot object of the shape is added to the output list, otherwise, no plot is produced} 13 | } 14 | \description{ 15 | Builds all the coordinate vectors related to the shape positions of the target 16 | body axis is along the z-axis 17 | construct shape coordinates 18 | a list containing the shape coordinates: r_pos (position vector), the_tilt , dr, gamma_t, taper, x, z, and plot if disp_prof=1 19 | } 20 | \examples{ 21 | para$shape$L <-30 22 | para$shape$L_a <- 16 23 | para$shape$rho_L <- 3 24 | para$shape$order <- 7 25 | } 26 | \author{ 27 | Sven Gastauer 28 | } 29 | -------------------------------------------------------------------------------- /man/c_Mackenzie1981.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/soundvelocity.R 3 | \name{c_Mackenzie1981} 4 | \alias{c_Mackenzie1981} 5 | \title{Sound speed according to Mackenzie et al. (1981)} 6 | \source{ 7 | Mackenzie, K. V. (1981). 8 | Nine term equation for sound speed in the oceans. The Journal of the Acoustical Society of America, 70(3), 807-812. 9 | \url{http://asa.scitation.org/doi/abs/10.1121/1.386920} 10 | } 11 | \usage{ 12 | c_Mackenzie1981(D, S, T) 13 | } 14 | \arguments{ 15 | \item{D}{Depth in meters} 16 | 17 | \item{S}{Salinity in parts per thousands} 18 | 19 | \item{T}{Temperature in degrees Celsius} 20 | } 21 | \description{ 22 | Calculate speed of sound in seawater based on MacKenzie (1981) 23 | The empirical equation generally holds validity for a temperature range between 2 and 30 degrees Celsius, Salinities between 25 and 40 parts per thousand and a depth range between 0 and 8000 m 24 | } 25 | \examples{ 26 | c_Mackenzie1981(100,35,10) 27 | } 28 | \references{ 29 | Mackenzie, K. V. (1981). 30 | Nine term equation for sound speed in the oceans. The Journal of the Acoustical Society of America, 70(3), 807-812. 31 | } 32 | -------------------------------------------------------------------------------- /man/c_Coppens1981.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/soundvelocity.R 3 | \name{c_Coppens1981} 4 | \alias{c_Coppens1981} 5 | \title{Sound speed according to Coppens et al. (1981)} 6 | \source{ 7 | Coppens, A. B. (1981). 8 | Simple equations for the speed of sound in Neptunian waters. The Journal of the Acoustical Society of America, 69(3), 862-863. 9 | \url{http://asa.scitation.org/doi/abs/10.1121/1.385486} 10 | } 11 | \usage{ 12 | c_Coppens1981(D, S, T) 13 | } 14 | \arguments{ 15 | \item{D}{Depth in meters} 16 | 17 | \item{S}{Salinity in parts per thousands} 18 | 19 | \item{T}{Temperature in degrees Celsius} 20 | } 21 | \description{ 22 | Calculates speed of sound in seawater based on Coppens (1981) 23 | The empirical equation generally holds validity for a temperature range between 0 and 35 degrees Celsius, Salinities between 0 and 45 parts per thousand and a depth range between 0 and 4000 m 24 | } 25 | \examples{ 26 | c_Coppens1981(D=100, S=35, T=10) 27 | } 28 | \references{ 29 | Coppens, A. B. (1981). 30 | Simple equations for the speed of sound in Neptunian waters. The Journal of the Acoustical Society of America, 69(3), 862-863. 31 | } 32 | -------------------------------------------------------------------------------- /man/DWBAscat2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/DWBAbscat.R 3 | \name{DWBAscat2} 4 | \alias{DWBAscat2} 5 | \title{Computes ka} 6 | \usage{ 7 | DWBAscat2(para, misc, app = FALSE, shplot = TRUE) 8 | } 9 | \arguments{ 10 | \item{para}{[list] A list containing all the model parameters (\url{../doc/parameters.html})} 11 | 12 | \item{misc}{[list] A list with misc parameters, containing at least the soundspeed of the surrounding fluid cw} 13 | 14 | \item{app}{TRUE or FALSE [boolean], defines if the function is used within a shiny app or not. If \code{app==TRUE} the progressbar inside the app will be updated.} 15 | 16 | \item{shplot}{TRUE [boolean] produce shape plot} 17 | } 18 | \value{ 19 | list of \code{ka}, the wavelength \code{k * } the width \code{a}; f the square-root of the orientation aveaged scattering cross-section 20 | } 21 | \description{ 22 | Computes ka 23 | } 24 | \examples{ 25 | #Get filename of the parameters file 26 | fname <- paste0(system.file(package = "ZooScatR"),"/extdata/configs/config_0.dat") 27 | #Read in teh parameter 28 | para = read_para(fname) 29 | #Create list with soundspeed info 30 | misc <- list() 31 | misc$cw <- 1500 32 | DWBAscat2(para,misc) 33 | } 34 | -------------------------------------------------------------------------------- /man/TS.sphere.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{TS.sphere} 4 | \alias{TS.sphere} 5 | \title{Calculate the analytical solution for a weakly scattering sphere} 6 | \usage{ 7 | TS.sphere(f, r, a, c, h, g, rho, theta = pi) 8 | } 9 | \arguments{ 10 | \item{f}{Frequency in Hz (s^-1)} 11 | 12 | \item{r}{Range in m from center of sphere} 13 | 14 | \item{a}{Radius of sphere} 15 | 16 | \item{c}{Soundspeed in surrounding fluid m/s} 17 | 18 | \item{h}{Soundspeed contrast inside/surrounding fluid} 19 | 20 | \item{g}{Density contrast inside/surrounding fluid} 21 | 22 | \item{rho}{Density of surrounding fluid} 23 | 24 | \item{theta}{Scattering angle} 25 | } 26 | \description{ 27 | Scattered pressure from an incident plane wave upon a fluid sphere. Based on: 28 | Anderson, V. C. (1950). "Sound scattering from a fluid sphere." 29 | The Journal of the Acoustical Society of America, 22(4), 426-431. 30 | } 31 | \examples{ 32 | f <- 200000 33 | r <- 10 34 | a <- 0.01 35 | c <- 1477.4 36 | rho <- 1026.8 37 | g <- 1028.9/rho 38 | h <- 1480.3/c 39 | theta = pi #For backscatter 40 | ts<- TS.sphere(f=200000,r,a,c,h,g, rho) 41 | #For a range of frequencies 42 | ts<- TS.sphere(f=seq(10,400)*1000,r,a,c,h,g, rho, theta=pi) 43 | plot(ts~seq(10,400),xlab="Frequency [kHz]", ylab="TS [dB re m2]", type="l",ylim=c(-160,-80)) 44 | } 45 | -------------------------------------------------------------------------------- /R/orient_ave.R: -------------------------------------------------------------------------------- 1 | #' averaging over orientation 2 | #' @param ang incident angle 3 | #' @param f complex form function as a function of frequency, ka or orient. angle 4 | #' @param pdf_type distribution type 1: uniform 2: Gaussian 5 | #' @param paral PDF parameters: paral[1] = angle; paral[2] = range for uniform, = std for Gaussian 6 | #' @export 7 | #' @author Sven Gastauer 8 | #' @return averaged y points 9 | #' @examples 10 | #' #averaging over orientation 11 | #' paral = orient_ave_para 12 | #' f=f 13 | #' pdf_type = para$orient$PDF 14 | #' paral = orient_ave_para 15 | #' paral=orient_ave_para 16 | #' orinet_ave(ang, f, pdf_type, paral) 17 | 18 | orient_ave <- function(ang,f,pdf_type,paral){ 19 | # ang = incident angle 20 | # f = complex form function # freq. x # orient. angle 21 | # pdf_type = distribution type 1: uniform 2: Gaussian 22 | # paral = PDF parameters: 23 | # paral(1) = 24 | # paral(2) = range for uniform 25 | # = std(angle) for Gaussian 26 | # 27 | 28 | n = dim(f)[1] # n = points in freq., 29 | m = dim(f)[2] # m = points in orientation 30 | 31 | #disp([n m]) 32 | if(m == 1){ 33 | outy=f 34 | return(outy) 35 | } 36 | if(pdf_type == 1){ 37 | PDF=matrix(1,m,1)/m 38 | }else{ 39 | dang=ang[2]-ang[1] 40 | angm=paral[1] 41 | angstd=paral[2] 42 | PDF=dang*exp(-0.5*(ang-angm)^2/angstd^2)/(sqrt(2*pi)*angstd) 43 | } 44 | 45 | outy=sqrt((f*Conj(f))%*%PDF) 46 | 47 | return(outy) 48 | } 49 | 50 | -------------------------------------------------------------------------------- /man/create_profile.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/create_profile.R 3 | \name{create_profile} 4 | \alias{create_profile} 5 | \title{create_profile} 6 | \usage{ 7 | create_profile(g, h, seg_no, corrL, filename) 8 | } 9 | \arguments{ 10 | \item{g}{Density contrast g} 11 | 12 | \item{h}{Soundspeed contrast h} 13 | 14 | \item{seg_no}{Number of segments} 15 | 16 | \item{corrL}{Length Correlation factor} 17 | 18 | \item{filename}{path and name .RData file to be saved} 19 | } 20 | \value{ 21 | Returns a list with all g, h, segment number and length correlation information, which can be used as an input to the material properties of the DWBA model 22 | } 23 | \description{ 24 | Create a target material properties profile file \cr 25 | 26 | Generate a profile based on a list of g and h values, number of segments and a length correlation 27 | } 28 | \examples{ 29 | create_profile(h = c(rep(1.0281,28), 30 | rep(1.0296,29), 31 | rep(1.0288,29), 32 | rep(1.0292,29), 33 | rep(1.0256,29), 34 | rep(1.0264,29), 35 | rep(1.0275,27)), 36 | g = c(rep(1.0359,,28), 37 | rep(1.0375,29), 38 | rep(1.0367,29), 39 | rep(1.0371,29), 40 | rep(1.0332,29), 41 | rep(1.0341,29), 42 | rep(1.0353,27)), 43 | seg_no =7, 44 | corrL = 20, 45 | filename="profile1") 46 | } 47 | -------------------------------------------------------------------------------- /man/TS.sphere2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TSsphere.R 3 | \name{TS.sphere2} 4 | \alias{TS.sphere2} 5 | \title{Calculate the analytical solution for a weakly scattering sphere} 6 | \usage{ 7 | TS.sphere2(f, r, a, c, h, g, rho) 8 | } 9 | \arguments{ 10 | \item{f}{Frequency in Hz (s^-1)} 11 | 12 | \item{r}{Range in m from center of sphere} 13 | 14 | \item{a}{Radius of sphere} 15 | 16 | \item{c}{Soundspeed in surrounding fluid m/s} 17 | 18 | \item{h}{Soundspeed contrast inside/surrounding fluid} 19 | 20 | \item{g}{Density contrast inside/surrounding fluid} 21 | 22 | \item{rho}{Density of surrounding fluid} 23 | } 24 | \description{ 25 | Scattered pressure from an incident plane wave upon a fluid sphere. Based on: 26 | Jech, J. M., Horne, J. K., Chu, D., Demer, D. A., Francis, D. T., Gorska, N., ... & Reeder, D. B. (2015). 27 | "Comparisons among ten models of acoustic backscattering used in aquatic ecosystem research." 28 | The Journal of the Acoustical Society of America, 138(6), 3742-3764. 29 | modified from: 30 | Anderson, V. C. (1950). "Sound scattering from a fluid sphere." 31 | The Journal of the Acoustical Society of America, 22(4), 426-431. 32 | } 33 | \examples{ 34 | fs <- as.list(seq(10,400, by=1)*1000) #Frequencies 35 | r <- 10 #range 36 | a <- 0.01 # radius 37 | c <- 1477.4 #soundspeed surrounding fluid 38 | rho <- 1026.8 #density surrounding fluid 39 | g <- 1028.9/rho #density contrast 40 | h <- 1480.3/c #soundspeed contrast 41 | TS <- sapply(fs,TS.sphere2,r=r,a=a,c=c,h=h,g=g,rho=rho) 42 | plot(fs,TS, type="l", xlab="Frequency [Hz]",ylab="TS [dB re m2]") 43 | } 44 | -------------------------------------------------------------------------------- /man/TS.inverse.simple.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/simple_inversion.R 3 | \name{TS.inverse.simple} 4 | \alias{TS.inverse.simple} 5 | \title{Simple TS inversion through minimisation of sum of squares} 6 | \usage{ 7 | TS.inverse.simple(TS.test, TS.sim, n.nf = 3) 8 | } 9 | \arguments{ 10 | \item{TS.test}{Dataframe with TS values, where column names are the frequencies} 11 | 12 | \item{TS.sim}{Dataframe with modelled TS values, where each row is a sample and column names are the frequencies, the last columns contain the parameters} 13 | 14 | \item{n.nf}{number of factors contained within the data frame} 15 | } 16 | \description{ 17 | Takes data TS and a data frame containing simulated TS at known Length and Orientation to find the closest matching parameters 18 | } 19 | \examples{ 20 | #load data 21 | data(TS_sim) 22 | #select random row 23 | rr<-sample(1:nrow(TS.sim),1) 24 | TS.inv <- TS.inverse.simple(TS.test=TS.sim[rr,1:(length(TS.sim)-3)], 25 | TS.sim=TS.sim,n.nf=3) 26 | ########################################################## 27 | ## CREATE PLOTS 28 | ########################################################## 29 | ggplot(data=TS.inv,aes(x=L,y=theta,fill=log10(ss)))+ 30 | geom_raster(interpolate=TRUE)+ 31 | scale_fill_viridis(name="Log10(Sum of Squares)")+ 32 | scale_x_continuous(expand=c(0,0))+ 33 | xlab("Length [mm]")+ 34 | ylab(expression(paste("Incident Angle", theta, " [",degree,"]")))+ 35 | scale_y_continuous(expand=c(0,0))+ 36 | theme_minimal()+ 37 | theme(axis.text = element_text(size=16), 38 | axis.title = element_text(size=18), 39 | legend.position = "top") 40 | } 41 | \author{ 42 | Sven Gastauer 43 | } 44 | -------------------------------------------------------------------------------- /man/c_Leroy08.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/soundvelocity.R 3 | \name{c_Leroy08} 4 | \alias{c_Leroy08} 5 | \title{Compute speed of sound according to Leroy et al. (2008)} 6 | \source{ 7 | Leroy, C. C., Robinson, S. P., & Goldsmith, M. J. (2008). 8 | A new equation for the accurate calculation of sound speed in all oceans. The Journal of the Acoustical Society of America, 124(5), 2774-2782. 9 | \url{http://asa.scitation.org/doi/abs/10.1121/1.2988296} 10 | } 11 | \usage{ 12 | c_Leroy08(Z, T, S, lat) 13 | } 14 | \arguments{ 15 | \item{Z}{Depth in m} 16 | 17 | \item{T}{Temperature in degrees Celsius} 18 | 19 | \item{S}{Salinity in parts per thousand} 20 | 21 | \item{lat}{Latitude in degrees} 22 | } 23 | \description{ 24 | Returns the sound speed according to Leroy et al (2008). This "newer" equation should solve the sound speed within 0.2 m/s for all seas, including the Baltic and Black sea, based on Temperature, Salinity and Latitude. Exceptions are some seas with anomalities close to the bottom. The equation was specifically designed to be used in marine acoustics. 25 | } 26 | \examples{ 27 | # TABLE III in Leroy et al. (2008) 28 | # Common oceans, lat = 30°, P= 80 MPa Z= 7808.13 m, S= 34.7\% 29 | lat=30; Z=7808.13; S=34.7; T=c(1,1.5,2,2.5,3) 30 | c_Leroy08(Z,T,S,lat) 31 | # Common oceans, lat = 30°, P= 80 MPa Z= 7808.13 m, T=2 °C 32 | c_Leroy08(Z,T=2,S=seq(33.5,35.5,.5),lat) 33 | # Common oceans, = 30°, P= 5 MPa Z= 497.12 m, S= 35\% 34 | c_Leroy08(Z=497.12,T=seq(-2,20,2),S=35,lat) 35 | # Common oceans, = 30°, P= 5 MPa Z= 497.12 m, T=8 °C 36 | c_Leroy08(Z=497.12,T=8,S=seq(33,37,1),lat) 37 | } 38 | \references{ 39 | Leroy, C. C., Robinson, S. P., & Goldsmith, M. J. (2008). 40 | A new equation for the accurate calculation of sound speed in all oceans. The Journal of the Acoustical Society of America, 124(5), 2774-2782. 41 | } 42 | -------------------------------------------------------------------------------- /inst/extdata/configs/config_0.dat: -------------------------------------------------------------------------------- 1 | %% home directory 2 | 3 | %% shape parameters 4 | 30 % length in mm 5 | 3 % rho/L 6 | 16 % L/a 7 | 10 % tapering order 8 | 0 % length average flag: 0-no average, 1-average 9 | 1.000000e-01 % relative length standard deviation (meaningless for no average) 10 | 1.000000e-02 % relative length increment(meaningless for no average) 11 | -1 % shape profile name ( "-1" if profile is not specified) 12 | 10 % number of points for axis smoothing (meaningless if profile is not specified) 13 | 40 % number of points for tapering function smoothing (meaningless if profile is not specified) 14 | %% orientation parameters 15 | -60 % mean incident angle (deg) 16 | -60 % angle variation range - starting value (deg) 17 | -60 % angle variation range - ending value (deg) 18 | 0 % average option flag: 0-no average, 1-average 19 | 2 % PDF flag: 1-Uniform 2-Gaussian 20 | 20 % PDF parameter: half range for Uniform PDF, 21 | % % standard deviation for Gaussian (deg) 22 | % % (meaningless for no average) 23 | 1 % angle increment (meaningless for no average) 24 | %% physical property parameters 25 | 1.035700e+00 % mean density contrast (g0) 26 | 1.027900e+00 % mean sound speed contrast (h0) 27 | 1 % number of body segments (1-homogeneous body) 28 | 1.600000e-03 % standard deviation of g0 (meaningless for homogeneous body) 29 | 1.500000e-03 % standard deviation of h0 (meaningless for homogeneous body) 30 | 20 % correlation length as a percentage of body length L 31 | %% simulation parameters 32 | 2000 % integration points along body axis 33 | 1000 % number of output points 34 | 3 % output variable index: 1-scatting amplitude, 2-cross section, 3-TS, 4-RTS 35 | 1 % variable: 1-frequency (kHz), 2-ang(deg), 3-ka 36 | 10 % start value for the variable 37 | 600 % end value for the variable 38 | 120 % frequency (kHz), enabled for avriable being angle only 39 | -------------------------------------------------------------------------------- /inst/extdata/configs/config_1.dat: -------------------------------------------------------------------------------- 1 | %% home directory 2 | C:\Projects\ZBS\GUI_DWBA_scat_model\mfiles 3 | %% shape parameters 4 | 30 % length in mm 5 | 3 % rho/L 6 | 16 % L/a 7 | 10 % tapering order 8 | 0 % length average flag: 0-no average, 1-average 9 | 1.000000e-01 % relative length standard deviation (meaningless for no average) 10 | 1.000000e-02 % relative length increment(meaningless for no average) 11 | -1 % shape profile name ( "-1" if profile is not specified) 12 | 10 % number of points for axis smoothing (meaningless if profile is not specified) 13 | 40 % number of points for tapering function smoothing (meaningless if profile is not specified) 14 | %% orientation parameters 15 | 0 % mean incident angle (deg) 16 | -90 % angle variation range - starting value (deg) 17 | 270 % angle variation range - ending value (deg) 18 | 0 % average option flag: 0-no average, 1-average 19 | 2 % PDF flag: 1-Uniform 2-Gaussian 20 | 20 % PDF parameter: half range for Uniform PDF, 21 | % % standard deviation for Gaussian (deg) 22 | % % (meaningless for no average) 23 | 1 % angle increment (meaningless for no average) 24 | %% physical property parameters 25 | 1.035700e+00 % mean density contrast (g0) 26 | 1.027900e+00 % mean sound speed contrast (h0) 27 | 7 % number of body segments (1-homogeneous body) 28 | 1.500000e-03 % standard deviation of g0 (meaningless for homogeneous body) 29 | 1.400000e-03 % standard deviation of h0 (meaningless for homogeneous body) 30 | 20 % correlation length as a percentage of body length L 31 | %% simulation parameters 32 | 20 % integration points along body axis 33 | 81 % number of output points 34 | 3 % output variable index: 1-scatting amplitude, 2-cross section, 3-TS, 4-RTS 35 | 1 % variable: 1-frequency (kHz), 2-ang(deg), 3-ka 36 | 90 % start value for the variable 37 | 170 % end value for the variable 38 | 120 % frequency (kHz), enabled for avriable being angle only 39 | -------------------------------------------------------------------------------- /inst/extdata/configs/config_tester.dat: -------------------------------------------------------------------------------- 1 | %% home directory 2 | C:\Projects\ZBS\GUI_DWBA_scat_model\mfiles 3 | %% shape parameters 4 | 45 % length in mm 5 | 8 % rho/L 6 | 10 % L/a 7 | 10 % tapering order 8 | 1 % length average flag: 0-no average, 1-average 9 | 0.2 % relative length standard deviation (meaningless for no average) 10 | 0.5 % relative length increment(meaningless for no average) 11 | /Users/sveng/ZooScat/inst/extdata/profiles/euphaus1.dat % shape profile name ( "-1" if profile is not specified) 12 | 100 % number of points for axis smoothing (meaningless if profile is not specified) 13 | 400 % number of points for tapering function smoothing (meaningless if profile is not specified) 14 | %% orientation parameters 15 | 10 % mean incident angle (deg) 16 | 0 % angle variation range - starting value (deg) 17 | 180 % angle variation range - ending value (deg) 18 | 0 % average option flag: 0-no average, 1-average 19 | 1 % PDF flag: 1-Uniform 2-Gaussian 20 | 10 % PDF parameter: half range for Uniform PDF, 21 | 10 % standard deviation for Gaussian (deg) 22 | % % (meaningless for no average) 23 | 2 % angle increment (meaningless for no average) 24 | %% physical property parameters 25 | 1.02 % mean density contrast (g0) 26 | 1.04 % mean sound speed contrast (h0) 27 | 10 % number of body segments (1-homogeneous body) 28 | 0.1 % standard deviation of g0 (meaningless for homogeneous body) 29 | 0.3 % standard deviation of h0 (meaningless for homogeneous body) 30 | 50 % correlation length as a percentage of body length L 31 | %% simulation parameters 32 | 500 % integration points along body axis 33 | 400 % number of output points 34 | 2 % output variable index: 1-scatting amplitude, 2-cross section, 3-TS, 4-RTS 35 | 3 % variable: 1-frequency (kHz), 2-ang(deg), 3-ka 36 | 1 % start value for the variable 37 | 600 % end value for the variable 38 | 150 % frequency (kHz), enabled for avriable being angle only 39 | -------------------------------------------------------------------------------- /inst/extdata/configs/config_krill.dat: -------------------------------------------------------------------------------- 1 | %% home directory 2 | C:\Projects\ZBS\GUI_DWBA_scat_model\mfiles 3 | %% shape parameters 4 | 30 % length in mm 5 | 3 % rho/L 6 | 10 % L/a 7 | 10 % tapering order 8 | 0 % length average flag: 0-no average, 1-average 9 | 0.1 % relative length standard deviation (meaningless for no average) 10 | 0.01 % relative length increment(meaningless for no average) 11 | C:/Users/sven_gas/Documents/GitHub/ZooScat/inst/extdata/profiles/euphaus0.dat % shape profile name ( "-1" if profile is not specified) 12 | 1 % number of points for axis smoothing (meaningless if profile is not specified) 13 | 1 % number of points for tapering function smoothing (meaningless if profile is not specified) 14 | %% orientation parameters 15 | 0 % mean incident angle (deg) 16 | 0 % angle variation range - starting value (deg) 17 | 100 % angle variation range - ending value (deg) 18 | 0 % average option flag: 0-no average, 1-average 19 | 2 % PDF flag: 1-Uniform 2-Gaussian 20 | 20 % PDF parameter: half range for Uniform PDF, 21 | % % standard deviation for Gaussian (deg) 22 | % % (meaningless for no average) 23 | 1 % angle increment (meaningless for no average) 24 | %% physical property parameters 25 | 1.0357 % mean density contrast (g0) 26 | 1.0279 % mean sound speed contrast (h0) 27 | 1 % number of body segments (1-homogeneous body) 28 | 0.0016 % standard deviation of g0 (meaningless for homogeneous body) 29 | 0.0015 % standard deviation of h0 (meaningless for homogeneous body) 30 | 20 % correlation length as a percentage of body length L 31 | %% simulation parameters 32 | 200 % integration points along body axis 33 | 387 % number of output points 34 | 3 % output variable index: 1-scatting amplitude, 2-cross section, 3-TS, 4-RTS 35 | 1 % variable: 1-frequency (kHz), 2-ang(deg), 3-ka 36 | 14 % start value for the variable 37 | 400 % end value for the variable 38 | 120 % frequency (kHz), enabled for variable being angle only 39 | -------------------------------------------------------------------------------- /inst/extdata/configs/test.dat: -------------------------------------------------------------------------------- 1 | %% home directory 2 | /var/folders/gg/3s8cvtn52wnf14bz_516g3cjxwg51l/T//RtmpgTdf6w 3 | %% shape parameters 4 | 30 % length in mm 5 | 3 % rho/L 6 | 16 % L/a 7 | 10 % tapering order 8 | 0 % length average flag: 0-no average, 1-average 9 | 0.1 % relative length standard deviation (meaningless for no average) 10 | 0.01 % relative length increment(meaningless for no average) 11 | /var/folders/gg/3s8cvtn52wnf14bz_516g3cjxwg51l/T//RtmpgTdf6w/2047b828f87040a1be8fdd71/0.dat % shape profile name ( -1 if profile is not specified) 12 | 0 % number of points for axis smoothing (meaningless if profile is not specified) 13 | 0 % number of points for tapering function smoothing (meaningless if profile is not specified) 14 | %% orientation parameters 15 | 0 % mean incident angle (deg) 16 | 0 % angle variation range - starting value (deg) 17 | 100 % angle variation range - ending value (deg) 18 | 1 % average option flag: 0-no average, 1-average 19 | 2 % PDF flag: 1-Uniform 2-Gaussian 20 | 20 % PDF parameter: half range for Uniform PDF, 21 | % % standard deviation for Gaussian (deg) 22 | % % (meaningless for no average) 23 | 1 % angle increment (meaningless for no average) 24 | %% physical property parameters 25 | 1.0357 % mean density contrast (g0) 26 | 1.0279 % mean sound speed contrast (h0) 27 | 7 % number of body segments (1-homogeneous body) 28 | 0.0016 % standard deviation of g0 (meaningless for homogeneous body) 29 | 0.0015 % standard deviation of h0 (meaningless for homogeneous body) 30 | 20 % correlation length as a percentage of body length L 31 | %% simulation parameters 32 | 20 % integration points along body axis 33 | 30 % number of output points 34 | 3 % output variable index: 1-scatting amplitude, 2-cross section, 3-TS, 4-RTS 35 | 1 % variable: 1-frequency (kHz), 2-ang(deg), 3-ka 36 | 300 % start value for the variable 37 | 600 % end value for the variable 38 | 120 % frequency (kHz), enabled for variable being angle only 39 | -------------------------------------------------------------------------------- /man/ts.cal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/TScal.R 3 | \name{ts.cal} 4 | \alias{ts.cal} 5 | \title{Theoretical TS of calibration sphere 6 | R script of function for band averaged TS of tungsten 7 | carbide spheres translated from Matlab code (Version date 31/5/05) 8 | written by D. MacLennan (Marine Lab, Aberdeen) 9 | updated from R version written by Sascha F?ssler 03/2010 10 | updated Sven Gastauer 04/01/2017} 11 | \usage{ 12 | ts.cal( 13 | freq = seq(38, 200), 14 | c = 1500, 15 | d = 38.1, 16 | mat = "TC", 17 | water = "sw", 18 | rhow = NULL, 19 | plot = TRUE 20 | ) 21 | } 22 | \arguments{ 23 | \item{freq}{numeric frequencies [kHz]; default seq(38,200)} 24 | 25 | \item{c}{numeric ambient soundspeeds [m/s]; default 1500} 26 | 27 | \item{d}{numeric sphere diameter [cm]; default = 38.1} 28 | 29 | \item{mat}{string material properties of the aphere Cu = Copper, TC = Tungsten-Carbide; default 'TC'} 30 | 31 | \item{water}{string either sw= seawater or fw = fresh water; will be ignored if rhow (density of seawater is defined); default 'sw} 32 | 33 | \item{rhow}{numeric density of ambient seawater, if NULL parameter water will be used; default NULL} 34 | 35 | \item{plot}{boolean TRUE/FALSE if plot should be part of the output; default TRUE} 36 | } 37 | \value{ 38 | dataframe with columns "F","TS","ModF2","c", where F = Frequency [kHz]; TS = TS [dB]; ModF2 = ModF^2 and c soundspeed [m/s], an optional ggplot can be part of the output 39 | } 40 | \description{ 41 | Theoretical TS of calibration sphere 42 | R script of function for band averaged TS of tungsten 43 | carbide spheres translated from Matlab code (Version date 31/5/05) 44 | written by D. MacLennan (Marine Lab, Aberdeen) 45 | updated from R version written by Sascha F?ssler 03/2010 46 | updated Sven Gastauer 04/01/2017 47 | } 48 | \examples{ 49 | ts.cal(freq=seq(90,170,by=0.1),c=1500.5,rhow=1.02509,plot=TRUE) 50 | } 51 | -------------------------------------------------------------------------------- /R/create_profile.R: -------------------------------------------------------------------------------- 1 | #' @title create_profile 2 | #' @description Create a target material properties profile file \cr 3 | #' 4 | #' Generate a profile based on a list of g and h values, number of segments and a length correlation 5 | #' @param g Density contrast g 6 | #' @param h Soundspeed contrast h 7 | #' @param seg_no Number of segments 8 | #' @param corrL Length Correlation factor 9 | #' @param filename path and name .RData file to be saved 10 | #' @return Returns a list with all g, h, segment number and length correlation information, which can be used as an input to the material properties of the DWBA model 11 | #' @examples 12 | #' create_profile(h = c(rep(1.0281,28), 13 | #' rep(1.0296,29), 14 | #' rep(1.0288,29), 15 | #' rep(1.0292,29), 16 | #' rep(1.0256,29), 17 | #' rep(1.0264,29), 18 | #' rep(1.0275,27)), 19 | #' g = c(rep(1.0359,,28), 20 | #' rep(1.0375,29), 21 | #' rep(1.0367,29), 22 | #' rep(1.0371,29), 23 | #' rep(1.0332,29), 24 | #' rep(1.0341,29), 25 | #' rep(1.0353,27)), 26 | #' seg_no =7, 27 | #' corrL = 20, 28 | #' filename="profile1") 29 | #' @export 30 | 31 | create_profile <- function(g,h,seg_no, corrL, filename){ 32 | #check if filename ends with .RData and add it not 33 | if(substr(filename,nchar(filename)-1, nchar(filename))!= ".RData"){filename = paste0(filename, ".RData")} 34 | #create and save the profile list 35 | profile <- list(h=h, 36 | g=g, 37 | seg_no=seg_no, 38 | corrL=corrL) 39 | save(profile, 40 | file=filename) 41 | #Check if the profile was created succesfully 42 | if(!file.exists(filename)){ 43 | message("ERROR: Profile could not be generated") 44 | }else{ 45 | message(paste0("Profile saved as ", filename)) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /man/bscat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/bscat.R 3 | \name{bscat} 4 | \alias{bscat} 5 | \title{Backscattering model} 6 | \usage{ 7 | bscat( 8 | para, 9 | misc, 10 | app = FALSE, 11 | nang = NULL, 12 | nl = NULL, 13 | simOut = TRUE, 14 | plotOut = TRUE 15 | ) 16 | } 17 | \arguments{ 18 | \item{para}{[list] A list containing all the model parameters (\url{../doc/parameters.html})} 19 | 20 | \item{misc}{[list] A list containing the soundspeed (cw) of the surrounding fluid (to compute cw visit \code{\link{c_Coppens1981}} or \code{\link{c_Leroy08}} or \code{\link{c_Mackenzie1981}})} 21 | 22 | \item{app}{= FALSE [boolean] function call from shiny interface or command line} 23 | 24 | \item{nang}{[integer] Number of angular ismulations, this will overwrite increment} 25 | 26 | \item{nl}{[integer] Number of Length simulations, will overwrite increment informaiton} 27 | 28 | \item{simOut}{= TRUE [boolean] If TRUE ysim (results for the simulated orientations) and ysimL (results for the simulated lengths based on the results of the mean simulated angle) as well as ang (simulated orientation angles) and L (simulated lengths) are added to the function output (average is kept as well), which contains all simulated data, if FALSE, only the averaged value is kept} 29 | 30 | \item{plotOut}{= TRUE [boolean] If results plot should be produced or not} 31 | } 32 | \value{ 33 | list with all parameters for DWBA 34 | } 35 | \description{ 36 | Run the DWBA model for a given set of parameters. Visit the vignette for more details (\url{../doc/DwbaCommand.html}) 37 | } 38 | \examples{ 39 | #Get filename of the parameters file 40 | fname <- paste0(system.file(package = "ZooScatR"),"/extdata/configs/config_0.dat") 41 | #Read in teh parameter 42 | para = read_para(fname) 43 | #Create list with soundspeed info 44 | misc <- list() 45 | misc$cw <- 1500 46 | #Change some of the settings 47 | #Set starting frequency over which to run the model 48 | para$simu$var0 <- 38 49 | #Set end frequency over which to run te model 50 | para$simu$var1 <- 300 51 | # run DWBA based on the settings defined in the parameters file 52 | res <- bscat(para=para, misc=misc, app=FALSE) 53 | #plot the results of the model 54 | res$rplot 55 | 56 | } 57 | \author{ 58 | Sven Gastauer 59 | } 60 | -------------------------------------------------------------------------------- /R/length_ave.R: -------------------------------------------------------------------------------- 1 | #' Model output averaged over length 2 | #' 3 | #' @param ka0 original ka ka=[ -3*std_a +3*std_a] 4 | #' @param ka1 output ka 5 | #' @param f complex form function - freq.(or ka) x - orient. angle 6 | #' @param pdf_type probablity density function type 1: uniform 2: Gaussian 7 | #' @param paral PDF parameters: paral[1] = no. of bins for L PDF; paral[2] = 1/3 max. deviation for uniform, = std(length) for Gaussian 8 | #' @param app = FALSE [boolean] function call from shiny interface or command line 9 | #' @import pracma 10 | #' @return averaged sigma_bs points 11 | #' @examples 12 | #' ka0=ka 13 | #' ka1=kaL 14 | #' f=f1 15 | #' pdf_type=2 16 | #' paral=len_ave_para 17 | #' length_ave(ka0,ka1,pdf_type,paral) 18 | #' @export 19 | 20 | length_ave <- function(ka0,ka1,f,pdf_type,paral, app=FALSE){ 21 | n=length(ka1) # n = points in freq. (ka) 22 | m=round(paral[1]) 23 | if(m == 1){ 24 | outy=f 25 | sim_out = outy 26 | L=1 27 | return(list(outy=outy, outys=sim_out,L=L)) 28 | 29 | } 30 | 31 | r_min = 1 - 3 * paral[2] # ratio = Lmin/ 32 | r_max = 1 + 3 * paral[2] # ratio = Lmax/ 33 | L = seq(r_min,r_max,length=m) 34 | dL = L[2] - L[1] 35 | if(pdf_type == 1){ 36 | PDF = matrix(1,m,1)/m 37 | }else{ 38 | Lm=1 # 39 | Lstd = paral[2] # std(L)/ 40 | PDF = dL * exp(-0.5 * (L - Lm)^2 / Lstd^2) / (sqrt(2 * pi) * Lstd) 41 | } 42 | 43 | sigma_bs0 = f * f # f sqrt of orientatipon averaged scat. cross-section 44 | # which is a real function 45 | sigma_bs = matrix(0, m, n) 46 | simsig = matrix(0, m, n) 47 | for(j in 1:m){ 48 | ka2=L[j]*ka1 49 | 50 | if(max(ka2) > max(ka0) | min(ka2) < min(ka0)){ 51 | if(app==FALSE){ 52 | print('ka is beyond ka0') 53 | print(paste(c(min(ka0), min(ka2), max(ka2), max(ka0)))) 54 | }else{ 55 | shiny::showNotification(paste("ERROR: ka is beyond ka0",(c(min(ka0), min(ka2), max(ka2), max(ka0)))), type="error") 56 | } 57 | }else{ 58 | sigma_bs[j, 1:n] = L[j] * L[j] * PDF[j] * pracma::interp1(as.numeric(ka0), 59 | as.numeric(sigma_bs0), 60 | as.numeric(ka2)) 61 | simsig[j, 1:n] = L[j] * L[j] * pracma::interp1(as.numeric(ka0), 62 | as.numeric(sigma_bs0), 63 | as.numeric(ka2)) 64 | } 65 | } 66 | 67 | outy = sqrt(colSums(sigma_bs)) 68 | sim_out = t(sqrt(simsig)) 69 | return(list(outy=outy, outys=sim_out,L=L)) 70 | } 71 | -------------------------------------------------------------------------------- /vignettes/Simulations.R: -------------------------------------------------------------------------------- 1 | ## ----setup, include=FALSE----------------------------------------------------- 2 | knitr::opts_chunk$set(echo = TRUE) 3 | library(ZooScatR) 4 | library(reshape2) 5 | library(ggplot2) 6 | 7 | ## ----settings----------------------------------------------------------------- 8 | fname <- paste0(system.file(package="ZooScatR"),"/extdata/configs/config_0.dat") #Loacation of the parameters file 9 | para = read_para(fname) #Read parameters file 10 | para$simu$var0 = 18 #simulate from 10 11 | para$simu$var1 = 300 #...to 300 kHz 12 | para$simu$ni = 200 #resudce the number of elements and frequencies to improve speed 13 | para$simu$n = 283 14 | 15 | #Create list with soundspeed info 16 | misc <- list(cw=1500) 17 | 18 | #change to the more realistic krill shape 19 | profname <- paste0(system.file(package="ZooScatR"),"/extdata/profiles/euphaus1.dat") #krill example 20 | para$shape$prof_name <- profname 21 | 22 | #make a length simulation 23 | para$shape$ave_flag = 1 24 | 25 | #make an orientation simulation 26 | para$orient$ave_flag = 1 27 | 28 | ## ----simulation--------------------------------------------------------------- 29 | #Run DWBA based on config file 30 | res <- bscat(para=para, misc=misc, simOut = TRUE, nang=100, nl=100) #Target strength vs Frequency 31 | 32 | ## ----plots_osim--------------------------------------------------------------- 33 | o_sim = melt(res$ysim) 34 | o_sim$theta = res$ang[o_sim$Var2] 35 | o_sim$Frequency = res$var[o_sim$Var1] 36 | o_sim=o_sim[,3:ncol(o_sim)] 37 | names(o_sim)[1] <- 'TS' 38 | 39 | mTS = data.frame(Frequency=res$var,TS=res$y) 40 | 41 | ggplot()+geom_line(data=o_sim, aes(x = Frequency, y=TS, group=theta),lty=2, lwd=0.5, alpha=0.4)+ 42 | geom_line(data=mTS, aes(x=Frequency, y=TS), lty=1, lwd=2)+theme_classic()+theme(text=element_text(size=14)) 43 | 44 | ggplot(data=o_sim, aes(x=Frequency, y=theta, fill=TS))+ 45 | geom_raster()+ 46 | scale_fill_viridis_c()+ 47 | scale_y_continuous(expand=c(0,0))+ 48 | scale_x_continuous(expand=c(0,0))+ 49 | theme_classic()+theme(text=element_text(size=14)) 50 | 51 | ## ----plots_L------------------------------------------------------------------ 52 | l_sim = melt(res$ysimL) 53 | l_sim$Length = res$L[l_sim$Var2] 54 | l_sim$Frequency = res$var[l_sim$Var1] 55 | l_sim=l_sim[,3:ncol(l_sim)] 56 | names(l_sim)[1] <- 'TS' 57 | 58 | ggplot()+geom_line(data=l_sim, aes(x = Frequency, y=TS, group=Length),lty=2, lwd=0.5, alpha=0.4)+ 59 | geom_line(data=mTS, aes(x=Frequency, y=TS), lty=1, lwd=2)+theme_classic()+theme(text=element_text(size=14)) 60 | 61 | 62 | 63 | ggplot(data=l_sim, aes(x=Frequency, y=Length, fill=TS))+ 64 | geom_raster()+ 65 | scale_fill_viridis_c()+ 66 | scale_y_continuous(expand=c(0,0))+ 67 | scale_x_continuous(expand=c(0,0))+ 68 | theme_classic()+theme(text=element_text(size=14)) 69 | 70 | 71 | -------------------------------------------------------------------------------- /R/water_density.R: -------------------------------------------------------------------------------- 1 | #' Seawater Density according to UNESCO formula 2 | #' @description UNESCO (1981) Tenth report of the joint panel on 3 | #' oceanographic tables and standards. UNESCO Technical 4 | #' Papers in Marine Science, Paris, 25p 5 | #' 6 | #' @param S Salinity in psu (which is +/- equal to ppm) 7 | #' @param T Temperature in degrees 8 | #' @param p pressure in Bar 9 | #' @examples 10 | #' rho(S=35,T=0.5,p=10) 11 | #' rho(8,10) #Should be 1005.94659 12 | #' @export 13 | rho = function(S,T,p=0) ifelse(p==0, rho_p0(S,T), rho_p0(S,T) / (1 - p/K(S,T,p))) 14 | 15 | #' Standard Mean Ocean Water (SMOW) 16 | #' @param T Temperature in degrees Celsius 17 | #' @export 18 | rho_smow = function(T){ 19 | a0 = 999.842594 20 | a1 = 6.793953 * 10^-2 21 | a2 = -9.095290 * 10^-3 22 | a3 = 1.001685 * 10^-4 23 | a4 = -1.120083 * 10^-6 24 | a5 = 6.536332 * 10^-9 25 | 26 | a0 + a1*T + a2*T^2 + a3*T^3 + a4*T^4 + a5*T^5 27 | } 28 | 29 | #' Density (rho) at normal atmospheric pressure (p = 0) 30 | #' @param S Salinity in psu (~ppm) 31 | #' @param T Temperature in degrees Celsius 32 | #' @export 33 | rho_p0 = function(S,T){ 34 | b0 = 8.2449 * 10^-1 35 | b1 = -4.0899 * 10^-3 36 | b2 = 7.6438 * 10^-5 37 | b3 = -8.2467 * 10^-7 38 | b4 = 5.3875 * 10^-9 39 | 40 | c0 = -5.7246 * 10^-3 41 | c1 = 1.0227 * 10^-4 42 | c2 = -1.6546 * 10^-6 43 | d0 = 4.8314 * 10^-4 44 | 45 | B1 = b0 + b1*T + b2*T^2 + b3*T^3 + b4*T^4 46 | 47 | C1 = c0 + c1*T + c2*T^2 48 | 49 | rho_smow(T) + B1*S + C1*S^1.5 + d0*S^2 50 | } 51 | 52 | #' compressibility at p = 0 53 | #' @param S Salinity in psu (~ppm) 54 | #' @param T Temperature in degrees Celsius 55 | #' @export 56 | K_p0 = function(S, T){ 57 | e0 = 19652.210 58 | e1 = 148.4206 59 | e2 = -2.327105 60 | e3 = 1.360477 * 10^-2 61 | e4 = -5.155288 * 10^-5 62 | 63 | K_w = e0 + e1*T + e2*T^2 + e3*T^3 + e4*T^4 64 | 65 | f0 = 54.6746 66 | f1 = -0.603459 67 | f2 = 1.099870 * 10^-2 68 | f3 = -6.167 * 10^-5 69 | 70 | F1 = f0 + f1*T + f2*T^2 + f3*T^3 71 | 72 | g0 = 7.944 * 10^-2 73 | g1 = 1.6483 * 10^-2 74 | g2 = -5.3009 * 10^-4 75 | 76 | G1 = g0 + g1*T + g2*T^2 77 | 78 | K_w + F1*S + G1*S^1.5 79 | } 80 | 81 | #' compressibility K 82 | #' @param S Salinity in psu (~ppm) 83 | #' @param T Temperature in degrees Celsius 84 | #' @param p pressure in bar 85 | #' @export 86 | K = function(S,T,p){ 87 | 88 | h0 = 3.2399 89 | h1 = 1.43713 * 10^-3 90 | h2 = 1.16092 * 10^-4 91 | h3 = -5.77905 * 10^-7 92 | 93 | i0 = 2.838 * 10^-3 94 | i1 = -1.0981 * 10^-5 95 | i2 = -1.6078 * 10^-6 96 | j0 = 1.91075 * 10^-4 97 | 98 | k0 = 8.50935 * 10^-5 99 | k1 = -6.12293 * 10^-6 100 | k2 = 5.2787 * 10^-8 101 | 102 | m0 = -9.9348 * 10^-7 103 | m1 = 2.0816 * 10^-8 104 | m2 = 9.1697 * 10^-10 105 | 106 | Bw = k0 + k1*T + k2*T^2 107 | B2 = Bw + (m0 + m1*T + m2*T^2)*S 108 | 109 | Aw = h0 + h1*T + h2*T^2 + h3*T^3 110 | A1 = Aw + (i0 + i1*T + i2*T^2) * S + j0*S^1.5 111 | K_p0(S,T) + A1*p + B2*p^2 112 | } 113 | -------------------------------------------------------------------------------- /man/DWBAapp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/app.R 3 | \name{DWBAapp} 4 | \alias{DWBAapp} 5 | \title{DWBA shiny app} 6 | \usage{ 7 | DWBAapp() 8 | } 9 | \value{ 10 | Runs a DWBA web application 11 | } 12 | \description{ 13 | This is a Shiny web application for the DWBA model. 14 | } 15 | \section{General outputs}{ 16 | 17 | 18 | All Shape, Orientation, Material Property and Simulation settings that are used as model input can be changed manually or be defined through configuration and profile files. 19 | 20 | Whenever the model is run, two plots will be generated and a data table will be generated. 21 | } 22 | 23 | \section{Output plots}{ 24 | 25 | Two plots will be displayed after each model run. 26 | One plot is displaying the shape of the input object and a second one showing the model output versus a selected variable. Model outputs and display variable can be selected under the Simulation Tab. 27 | 28 | \emph{Exporting plots} 29 | 30 | Plots can be exported by right-clicking the plot and selecting save as. The size of the plots will automatically adopt to the size of the browser window. 31 | The values of the plot can be eplored by hovering over the plot with the mouse. The value closest to the cursor location and the distance to the closest value point are being displayed below the plot. 32 | \emph{Zooming in the model output plot} 33 | 34 | Zooming can be achieved by drawing a box (holding left mouse key down) on the output plot. Once the box is visible, the plot will zoom into the selected area through double-clicking. Returning to the original zoom can be achieved through double clicking on the plot outside of the box area. 35 | } 36 | 37 | \section{Datatable output}{ 38 | 39 | The datatable can be exported as csv file by clicking the Export button above the shape plot. The number of shown datapoints per table page can be varied by chaning the Show entries option box. 40 | } 41 | 42 | \section{Model parameters}{ 43 | 44 | Four different types of model input parameters an be defined: 45 | \enumerate{ 46 | \item Shape 47 | \item Orientation 48 | \item Material Properties 49 | \item Simulation 50 | } 51 | 52 | These different input types are organised in tabs. 53 | Predefined configuration files which can define all settings can be loaded by clicking the Browse button under the Load Config menu at the top of the right frame. 54 | 55 | Details about the model, the app and the different parameters are lined out in the vignettes: 56 | \enumerate{ 57 | \item A brief description of the DWBA model and an introduction on how to run it from the command line (\url{../doc/DwbaCommand.html} 58 | \item A validation of the used DWBA model, comparing results to the analytical solution of a weakly scattering sphere (\url{../doc/CompareToAnalyticalSolution.html} 59 | \item An introduction to the app (\url{../doc/DWBAapp_vignette.html} 60 | \item A table containing the parameters and a brief explanation (\url{../doc/parameters.html} 61 | \item Some examples of model model parameters from literature#' (\url{../doc/gh2.html} 62 | \item An introduction on how to run parallel instances of the DWBA model (\url{../doc/DWBAParallel.html} 63 | } 64 | } 65 | 66 | \examples{ 67 | DWBAapp() #run the web applications 68 | } 69 | -------------------------------------------------------------------------------- /R/DWBAbscat.R: -------------------------------------------------------------------------------- 1 | #' Computes ka 2 | #' 3 | #' @param para [list] A list containing all the model parameters (\url{../doc/parameters.html}) 4 | #' @param misc [list] A list with misc parameters, containing at least the soundspeed of the surrounding fluid cw 5 | #' @param app TRUE or FALSE [boolean], defines if the function is used within a shiny app or not. If \code{app==TRUE} the progressbar inside the app will be updated. 6 | #' @param shplot TRUE [boolean] produce shape plot 7 | #' @return list of \code{ka}, the wavelength \code{k * } the width \code{a}; f the square-root of the orientation aveaged scattering cross-section 8 | #' @examples 9 | #' #Get filename of the parameters file 10 | #' fname <- paste0(system.file(package = "ZooScatR"),"/extdata/configs/config_0.dat") 11 | #' #Read in teh parameter 12 | #' para = read_para(fname) 13 | #' #Create list with soundspeed info 14 | #' misc <- list() 15 | #' misc$cw <- 1500 16 | #' DWBAscat2(para,misc) 17 | #' @export 18 | 19 | DWBAscat2 <- function(para, misc, app=FALSE, shplot=TRUE){ 20 | if(exists("status")==FALSE){status=list()} 21 | status$stop = 0 22 | #print(para$shape$prof_name) 23 | eps<-2.2204e-16 24 | # shape parameters 25 | L_a = para$shape$L_a 26 | 27 | # simulation parameter 28 | n = length(misc$ka) # N of ka point 29 | n_int = para$simu$ni # N of integration points 30 | 31 | ang = misc$ang # different incident angle 32 | m = length(ang) 33 | th = ang*(pi/180) #degrees to radians 34 | 35 | ka0 = misc$ka 36 | 37 | # construct inhomogeneous g ang h profile (physical parameters) 38 | 39 | if(para$phy$body_ih == FALSE){ 40 | g = para$phy$g0 * matrix(1, n_int, 1) 41 | h = para$phy$h0 * matrix(1, n_int, 1) 42 | para$phy$g = g 43 | para$phy$h = h 44 | }else{ 45 | if(app==FALSE){ 46 | igh <- inhom_gh(para) 47 | para$phy$g <- igh$g 48 | para$phy$h <- igh$h 49 | } 50 | g=as.matrix(para$phy$g) 51 | h=as.matrix(para$phy$h) 52 | } 53 | 54 | Cb = (1- g * h * h) / (g * h * h) - (g-1) / g 55 | 56 | # construct postion vectors 57 | sp = ifelse(shplot==1, 1,0) 58 | bp <- buildpos(para, disp_prof=sp) 59 | r_pos = as.matrix(bp$r_pos) 60 | th_tilt = bp$th_tilt 61 | dr = bp$dr 62 | gamma_t = bp$gamma_t 63 | taper = bp$taper 64 | xp = bp$x 65 | zp = bp$z 66 | 67 | # construct other Matrices 68 | X1 = as.matrix(ka0) %*% t(taper) 69 | Tmp = t(h[,matrix(1, 1, n)]) 70 | X2 = X1 / Tmp 71 | th <- (as.matrix(th)) 72 | th_tilt <- as.matrix(th_tilt) 73 | Dtheta = t(th_tilt[,matrix(1,1,m)]) - th[,matrix(1, 1, n_int)] 74 | 75 | Cos_dtheta = abs(cos(Dtheta)) # choose different local coordinates to 76 | # avoid negative argument of Bessel function 77 | Gamma_t = t(as.matrix(gamma_t)[,matrix(1, 1, m)]) 78 | Theta = th[,matrix(1, 1,n_int)] 79 | Dgamma = Gamma_t-Theta 80 | Cos_dgamma = cos(Dgamma) 81 | ka0 = as.matrix(ka0) 82 | term0 = (L_a * ka0) %*% t(r_pos/h) 83 | term1 = h * h * Cb * as.matrix(dr) /4 84 | Jarr = 1:m # angle index for checking purpose 85 | f=matrix(0,length(ka0), length(Jarr)) 86 | 87 | for( J in 1:length(Jarr)){ 88 | if(app==TRUE){ 89 | incProgress(0.85/length(Jarr), detail = paste("Running model -", J/length(Jarr)*100,"%")) 90 | #print(J) 91 | } 92 | # angle loop 93 | # disp(sprintf(' j = #g, stop =#g',J,status.stop)) 94 | if(status$stop == 0){ 95 | j = Jarr[J] 96 | cos_dtheta = as.matrix(Cos_dtheta[j,]) 97 | Cos_th = t(cos_dtheta[,t(matrix(1, 1, n))]) 98 | cos_dgamma = as.matrix(Cos_dgamma[j,]) 99 | Cos_gamma = t(cos_dgamma[,matrix(1, n,1)]) 100 | Arg = (2 * X2 * (Cos_th) + eps) 101 | J1x = as.matrix(besselJ(Arg,1)) / Arg 102 | EXP = exp(1i * term0 * Cos_gamma) 103 | term2 = (X2*X2) * J1x * EXP 104 | f[,j] = term2 %*% term1 + eps 105 | }else{ 106 | f=0 107 | return() 108 | } 109 | } 110 | return(list(ka=ka0,ang=ang,f=f, shplot = bp$plot)) 111 | } 112 | 113 | -------------------------------------------------------------------------------- /R/read_para.R: -------------------------------------------------------------------------------- 1 | #' Read the configuration file 2 | #' @description Read a DWBA configuration file. Keep standard .dat format, as used in Matlab, to keep maximum compatibility with previous model definitions. 3 | #' 4 | #' .dat files are standard text files. 5 | #' 6 | #' Some example config files can be found in the extdata/configs folder: (\code{system.file(package="ZooScatR")}), contained within the package directory. 7 | #' 8 | #' @param fn Filename 9 | #' @return list with all parameters for DWBA 10 | #' @examples 11 | #' fn <- paste0(system.file(package="ZooScatR"),"/extdata/configs/config_0.dat") 12 | #' para <- read_para(fn) 13 | #' @export 14 | 15 | read_para <- function(fn){ 16 | #read all lines 17 | lns = readLines(fn) 18 | #extract heder indices 19 | idx = grepl("%%", lns) 20 | #read filename 21 | filename = lns[!idx][1] 22 | 23 | #data 24 | data <- na.omit(lns[!idx][2:length(idx)]) 25 | data <- gsub(",\t", ",", data) 26 | data <- gsub("%\t\t%", "NA %", data) 27 | data <- gsub("\t\t", " ", data) 28 | data <- gsub("\t", " ", data) 29 | elems = unlist( strsplit( data , "%" ) ) 30 | #create dataframe 31 | parameters <- as.data.frame(matrix( elems , ncol = 2 , byrow = TRUE )) 32 | 33 | pn <- as.character(parameters[8,1]) 34 | pn <- gsub(" ","", pn) 35 | 36 | #values as numeric 37 | suppressWarnings(parameters[,1] <- as.numeric(as.character(parameters[,1]))) 38 | 39 | 40 | #create list 41 | para <- list() 42 | 43 | #filename 44 | para$fname <- filename 45 | 46 | #shape 47 | para$shape <- list() 48 | para$shape$L <- parameters$V1[1] #length in mm 49 | para$shape$rho_L <- parameters$V1[2] #rho/L 50 | para$shape$L_a <- parameters$V1[3] #L/a 51 | para$shape$order <- parameters$V1[4] #tapering order 52 | para$shape$ave_flag <- parameters$V1[5] #length average flag: 0-no average,1-average 53 | para$shape$Lstd <- parameters$V1[6] #relative length standard deviation (meaningless for no average) 54 | para$shape$dL <- parameters$V1[7] #relative length increment(meaningless for no average) 55 | para$shape$prof_name <- parameters$V1[8] #shape profile name ( "-1" if profile is not specified) 56 | if(is.na(para$shape$prof_name)==TRUE){para$shape$prof_name=pn} 57 | para$shape$axis_sm <- parameters$V1[9] #number of points for axis smoothing (meaningless if profile is not specified) 58 | para$shape$taper_sm <- parameters$V1[10] #number of points for tapering function smoothing (meaningless if profile is not specified) 59 | 60 | #orientation 61 | para$orient <- list() 62 | para$orient$angm <- parameters$V1[11] #mean incident angle (deg) 63 | para$orient$ang0 <- parameters$V1[12] #angle variation range - starting value (deg) 64 | para$orient$ang1 <- parameters$V1[13] #angle variation range - ending value (deg) 65 | para$orient$ave_flag <- parameters$V1[14] #average option flag: 0-no average,1-average 66 | para$orient$PDF <- parameters$V1[15] #PDF flag: 1-Uniform 2-Gaussian 67 | para$orient$PDF_para <- parameters$V1[16] #PDF parameter: half range for Uniform PDF, 68 | #standard deviation for Gaussian (deg), 69 | #(meaningless for no average) 70 | para$orient$dang <- parameters$V1[19] #angle increment (meaningless for no average) 71 | 72 | #physical 73 | para$phy$g0 <- parameters$V1[20] #mean density contrast (g0) 74 | para$phy$h0 <- parameters$V1[21] #mean sound speed contrast (h0) 75 | para$phy$seg_no <- parameters$V1[22] #number of body segments (1-homogeneous body) 76 | para$phy$g_std <- parameters$V1[23] #standard deviation of g0 (meaningless for homogeneous body) 77 | para$phy$h_std <- parameters$V1[24] #standard deviation of g0 (meaningless for homogeneous body) 78 | para$phy$corrL <- parameters$V1[25] #correlation length as a percentage of body length L 79 | 80 | #simulation 81 | para$simu$ni <- parameters$V1[26] #integration points along body axis 82 | para$simu$n <- parameters$V1[27] #number of output points 83 | para$simu$out_indx <- parameters$V1[28] #output variable index: 1-scatting amplitude, 2-cross section, 3-TS, 4-RTS 84 | para$simu$var_indx <- parameters$V1[29] #variable: 1-frequency (kHz), 2-ang(deg), 3-ka 85 | para$simu$var0 <- parameters$V1[30] #start value for the variable 86 | para$simu$var1 <- parameters$V1[31] #end value for the variable 87 | para$simu$freq <- parameters$V1[32] #frequency (kHz), enabled for avaiable being angle only 88 | 89 | return(para) 90 | } 91 | -------------------------------------------------------------------------------- /R/save_config.R: -------------------------------------------------------------------------------- 1 | #' Save the parameter file 2 | #' @description Save the model parameter. Keep standard dat format, as used in th eoriginal Matlab code, to keep maximum compatibility with previously generated files 3 | #' @param para Parameters 4 | #' @param fn Filename with path, to where the dat file should be written 5 | #' @return Returns a a .dat file with all model parameters 6 | #' @examples 7 | #' fn <- 'config_0.dat' 8 | #' para <- read_para(fn) 9 | #' createParaDat(para,fn) 10 | #' @export 11 | 12 | 13 | createParaDat <- function(para, fn){ 14 | 15 | fileConn<-file(fn,'a') 16 | writeLines(c("%% home directory"), fileConn) 17 | writeLines(dirname(fn), fileConn) 18 | writeLines(c("%% shape parameters"), fileConn) 19 | writeLines(c(paste(sep=" ",para$shape$L,"% length in mm")), fileConn) 20 | writeLines(c(paste(sep=" ",para$shape$rho_L,"% rho/L")), fileConn) 21 | writeLines(c(paste(sep=" ",para$shape$L_a,"% L/a")), fileConn) 22 | writeLines(c(paste(sep=" ",para$shape$order,"% tapering order")), fileConn) 23 | writeLines(c(paste(sep=" ",para$shape$ave_flag,"% length average flag: 0-no average, 1-average")), fileConn) 24 | writeLines(c(paste(sep=" ",para$shape$Lstd,"% relative length standard deviation (meaningless for no average)")), fileConn) 25 | writeLines(c(paste(sep=" ",para$shape$dL,"% relative length increment(meaningless for no average)")), fileConn) 26 | writeLines(c(paste(sep=" ",para$shape$prof_name,"% shape profile name ( -1 if profile is not specified)")), fileConn) 27 | writeLines(c(paste(sep=" ",para$shape$axis_sm,"% number of points for axis smoothing (meaningless if profile is not specified)")), fileConn) 28 | writeLines(c(paste(sep=" ",para$shape$taper_sm,"% number of points for tapering function smoothing (meaningless if profile is not specified)")), fileConn) 29 | writeLines(c(paste(sep=" ","%% orientation parameters")), fileConn) 30 | writeLines(c(paste(sep=" ",para$orient$angm,"% mean incident angle (deg)")), fileConn) 31 | writeLines(c(paste(sep=" ",para$orient$ang0,"% angle variation range - starting value (deg)")), fileConn) 32 | writeLines(c(paste(sep=" ",para$orient$ang1,"% angle variation range - ending value (deg)")), fileConn) 33 | writeLines(c(paste(sep=" ",para$orient$ave_flag,"% average option flag: 0-no average, 1-average")), fileConn) 34 | writeLines(c(paste(sep=" ",para$orient$PDF,"% PDF flag: 1-Uniform 2-Gaussian")), fileConn) 35 | writeLines(c(paste(sep=" ",para$orient$PDF_para,"% PDF parameter: half range for Uniform PDF,")), fileConn) 36 | writeLines(c(paste(sep=" ","%","% standard deviation for Gaussian (deg)")), fileConn) 37 | writeLines(c(paste(sep=" ","%","% (meaningless for no average)")), fileConn) 38 | writeLines(c(paste(sep=" ",para$orient$dang,"% angle increment (meaningless for no average)")), fileConn) 39 | writeLines(c(paste(sep=" ","%% physical property parameters")), fileConn) 40 | writeLines(c(paste(sep=" ",para$phy$g0,"% mean density contrast (g0)")), fileConn) 41 | writeLines(c(paste(sep=" ",para$phy$h0,"% mean sound speed contrast (h0)")), fileConn) 42 | writeLines(c(paste(sep=" ",para$phy$seg_no,"% number of body segments (1-homogeneous body)")), fileConn) 43 | writeLines(c(paste(sep=" ",para$phy$g_std,"% standard deviation of g0 (meaningless for homogeneous body)")), fileConn) 44 | writeLines(c(paste(sep=" ",para$phy$h_std,"% standard deviation of h0 (meaningless for homogeneous body)")), fileConn) 45 | writeLines(c(paste(sep=" ",para$phy$corrL,"% correlation length as a percentage of body length L")), fileConn) 46 | writeLines(c(paste(sep=" ","%% simulation parameters")), fileConn) 47 | writeLines(c(paste(sep=" ",para$simu$ni,"% integration points along body axis")), fileConn) 48 | writeLines(c(paste(sep=" ",para$simu$n,"% number of output points")), fileConn) 49 | writeLines(c(paste(sep=" ",para$simu$out_indx,"% output variable index: 1-scatting amplitude, 2-cross section, 3-TS, 4-RTS")), fileConn) 50 | writeLines(c(paste(sep=" ",para$simu$var_indx,"% variable: 1-frequency (kHz), 2-ang(deg), 3-ka")), fileConn) 51 | writeLines(c(paste(sep=" ",para$simu$var0,"% start value for the variable")), fileConn) 52 | writeLines(c(paste(sep=" ",para$simu$var1,"% end value for the variable")), fileConn) 53 | writeLines(c(paste(sep=" ",para$simu$freq,"% frequency (kHz), enabled for variable being angle only")), fileConn) 54 | close(fileConn) 55 | } 56 | -------------------------------------------------------------------------------- /R/soundvelocity.R: -------------------------------------------------------------------------------- 1 | #' @title Sound speed according to Mackenzie et al. (1981) 2 | #' @description Calculate speed of sound in seawater based on MacKenzie (1981) 3 | #' The empirical equation generally holds validity for a temperature range between 2 and 30 degrees Celsius, Salinities between 25 and 40 parts per thousand and a depth range between 0 and 8000 m 4 | #' @source Mackenzie, K. V. (1981). 5 | #' Nine term equation for sound speed in the oceans. The Journal of the Acoustical Society of America, 70(3), 807-812. 6 | #' \url{http://asa.scitation.org/doi/abs/10.1121/1.386920} 7 | #' @references Mackenzie, K. V. (1981). 8 | #' Nine term equation for sound speed in the oceans. The Journal of the Acoustical Society of America, 70(3), 807-812. 9 | #' @param D Depth in meters 10 | #' @param S Salinity in parts per thousands 11 | #' @param T Temperature in degrees Celsius 12 | #' @examples 13 | #' c_Mackenzie1981(100,35,10) 14 | #' @export 15 | 16 | c_Mackenzie1981 <- function(D,S,T){ 17 | c<-1448.96 + 4.591*T - 5.304 * 18 | 10^-2*(T^2) + 19 | 2.374 * (10^-4)*(T^3) + 20 | 1.340 * (S-35) + 21 | 1.630 * (10^-2)*D + 22 | 1.675 * (10^-7)*(D^2) - 1.025 * (10^-2)*T*(S - 35) - 7.139 * (10^-13)*T*(D^3) 23 | return(c) 24 | } 25 | 26 | #' @title Sound speed according to Coppens et al. (1981) 27 | #' @description Calculates speed of sound in seawater based on Coppens (1981) 28 | #' The empirical equation generally holds validity for a temperature range between 0 and 35 degrees Celsius, Salinities between 0 and 45 parts per thousand and a depth range between 0 and 4000 m 29 | #' @source Coppens, A. B. (1981). 30 | #' Simple equations for the speed of sound in Neptunian waters. The Journal of the Acoustical Society of America, 69(3), 862-863. 31 | #' \url{http://asa.scitation.org/doi/abs/10.1121/1.385486} 32 | #' @references Coppens, A. B. (1981). 33 | #' Simple equations for the speed of sound in Neptunian waters. The Journal of the Acoustical Society of America, 69(3), 862-863. 34 | #' @param D Depth in meters 35 | #' @param S Salinity in parts per thousands 36 | #' @param T Temperature in degrees Celsius 37 | #' @examples 38 | #' c_Coppens1981(D=100, S=35, T=10) 39 | #' @export 40 | 41 | c_Coppens1981 <- function(D,S,T){ 42 | t <- T/10 43 | D = D/1000 44 | c0 <- 1449.05 + 45.7*t - 5.21*(t^2) + 0.23*(t^3) + (1.333 - 0.126*t + 0.009*(t^2)) * (S - 35) 45 | c <- c0 + (16.23 + 0.253*t)*D + (0.213-0.1*t)*(D^2) + (0.016 + 0.0002*(S-35))*(S- 35)*t*D 46 | return(c) 47 | } 48 | 49 | #' @title Compute speed of sound according to Leroy et al. (2008) 50 | #' @description Returns the sound speed according to Leroy et al (2008). This "newer" equation should solve the sound speed within 0.2 m/s for all seas, including the Baltic and Black sea, based on Temperature, Salinity and Latitude. Exceptions are some seas with anomalities close to the bottom. The equation was specifically designed to be used in marine acoustics. 51 | #' @param Z Depth in m 52 | #' @param S Salinity in parts per thousand 53 | #' @param T Temperature in degrees Celsius 54 | #' @param lat Latitude in degrees 55 | #' @source Leroy, C. C., Robinson, S. P., & Goldsmith, M. J. (2008). 56 | #' A new equation for the accurate calculation of sound speed in all oceans. The Journal of the Acoustical Society of America, 124(5), 2774-2782. 57 | #' \url{http://asa.scitation.org/doi/abs/10.1121/1.2988296} 58 | #' @references Leroy, C. C., Robinson, S. P., & Goldsmith, M. J. (2008). 59 | #' A new equation for the accurate calculation of sound speed in all oceans. The Journal of the Acoustical Society of America, 124(5), 2774-2782. 60 | #' @examples 61 | #' # TABLE III in Leroy et al. (2008) 62 | #' # Common oceans, lat = 30°, P= 80 MPa Z= 7808.13 m, S= 34.7% 63 | #' lat=30; Z=7808.13; S=34.7; T=c(1,1.5,2,2.5,3) 64 | #' c_Leroy08(Z,T,S,lat) 65 | #' # Common oceans, lat = 30°, P= 80 MPa Z= 7808.13 m, T=2 °C 66 | #' c_Leroy08(Z,T=2,S=seq(33.5,35.5,.5),lat) 67 | #' # Common oceans, = 30°, P= 5 MPa Z= 497.12 m, S= 35% 68 | #' c_Leroy08(Z=497.12,T=seq(-2,20,2),S=35,lat) 69 | #' # Common oceans, = 30°, P= 5 MPa Z= 497.12 m, T=8 °C 70 | #' c_Leroy08(Z=497.12,T=8,S=seq(33,37,1),lat) 71 | #' @export 72 | c_Leroy08 <- function(Z,T,S,lat){ 73 | c <- 1402.5 + 5*T - 5.44 * 10^-2*T^2 + 2.1 * 10^-4*T^3 + 74 | 1.33*S - 1.23 * (10^-2)*S*T+8.7*(10^-5)*S*T^2 + 75 | 1.56*(10^-2)*Z+2.55*(10^-7)*Z^2-7.3*(10^-12)*Z^3+ 76 | 1.2*(10^-6)*Z*(lat-45)-9.5*(10^-13)*T*Z^3+ 77 | 3*(10^-7)*T^2*Z+1.43*(10^-5)*S*Z 78 | return(c) 79 | } 80 | 81 | -------------------------------------------------------------------------------- /R/simple_inversion.R: -------------------------------------------------------------------------------- 1 | #' @title Simple TS inversion through minimisation of sum of squares 2 | #' @description Takes data TS and a data frame containing simulated TS at known Length and Orientation to find the closest matching parameters 3 | #' @author Sven Gastauer 4 | #' @export 5 | #' @param TS.test Dataframe with TS values, where column names are the frequencies 6 | #' @param TS.sim Dataframe with modelled TS values, where each row is a sample and column names are the frequencies, the last columns contain the parameters 7 | #' @param n.nf number of factors contained within the data frame 8 | #' @examples 9 | #' #load data 10 | #' data(TS_sim) 11 | #' #select random row 12 | #' rr<-sample(1:nrow(TS.sim),1) 13 | #' TS.inv <- TS.inverse.simple(TS.test=TS.sim[rr,1:(length(TS.sim)-3)], 14 | #' TS.sim=TS.sim,n.nf=3) 15 | #' ########################################################## 16 | #' ## CREATE PLOTS 17 | #' ########################################################## 18 | #' ggplot(data=TS.inv,aes(x=L,y=theta,fill=log10(ss)))+ 19 | #' geom_raster(interpolate=TRUE)+ 20 | #' scale_fill_viridis(name="Log10(Sum of Squares)")+ 21 | #' scale_x_continuous(expand=c(0,0))+ 22 | #' xlab("Length [mm]")+ 23 | #' ylab(expression(paste("Incident Angle", theta, " [",degree,"]")))+ 24 | #' scale_y_continuous(expand=c(0,0))+ 25 | #' theme_minimal()+ 26 | #' theme(axis.text = element_text(size=16), 27 | #' axis.title = element_text(size=18), 28 | #' legend.position = "top") 29 | 30 | TS.inverse.simple <- function(TS.test,TS.sim,n.nf=3){ 31 | 32 | ######################################################### 33 | # PREPARE THE MODELLED DATA 34 | ######################################################### 35 | 36 | #split model into data and target 37 | TS.dat <- TS.sim[,1:(length(TS.sim)-n.nf)] 38 | TS.target <- TS.sim[,(length(TS.sim)-(n.nf-1)):length(TS.sim)] 39 | 40 | ########################################################## 41 | ## CHECK IF THE SAME FREQUENCIES ARE AVAILABBLE 42 | ########################################################## 43 | 44 | #Match frequencies 45 | test.freq <- as.numeric(as.character(names(TS.test))) 46 | mod.freq <- as.numeric(as.character(names(TS.dat))) 47 | 48 | #Check if length of frequencies and frequencies do match 49 | if(length(test.freq)!=length(mod.freq) || 50 | length((which(test.freq != mod.freq)))>0 || 51 | length(which(is.na(TS.test)))>0){ 52 | 53 | message(paste0(Sys.time(),": Frequencies of input and modelled data do not 54 | match or NAs detected....\n 55 | Interpolating data...")) 56 | #approximate data to fit the modelled data frequencies 57 | TS.test =as.data.frame(approx(test.freq, 58 | TS.test, 59 | xout = mod.freq, 60 | rule=2)) 61 | 62 | }else{ 63 | message(paste0(Sys.time(),": Frequencies of input and modelled data are 64 | matching...")) 65 | } 66 | ########################################################## 67 | ## CONVERT TS DATA FROM LOG TO LINEAR DOMAIN 68 | ########################################################## 69 | 70 | #convert TS data to linear 71 | TS.lin <- 10^(TS.dat/10) 72 | dat.lin <- 10^(TS.test/10) 73 | 74 | ########################################################## 75 | ## COMPUTE SUM OF SQUARES 76 | ########################################################## 77 | message(paste0(Sys.time(),": Computing sum of squares...")) 78 | start_time <- Sys.time() 79 | ss = apply(TS.lin,1,function(x)sum((dat.lin-t(x))^2)) 80 | end_time <- Sys.time() 81 | message(paste0(Sys.time(),": COmpleted after ",round(as.numeric(difftime(end_time,start_time,uni="mins")),2)," min")) 82 | ########################################################## 83 | ## fiND MINIMUM SUM OF SQUARES AND CREATE DATAFRAME 84 | ########################################################## 85 | 86 | minml <- which(ss==min(ss)) 87 | 88 | message(paste("\n",Sys.time(),": Estimated: ", 89 | paste(names(TS.target),TS.target[minml,],sep=" "))) 90 | 91 | ss<- as.data.frame(ss) 92 | 93 | for(k in 1:n.nf){ 94 | ss <- cbind(ss,TS.target[,k]) 95 | } 96 | names(ss)<- c("ss",names(TS.target)) 97 | 98 | ss<- ss[order(ss$ss),] 99 | ss$rank <- 1:nrow(ss) 100 | 101 | return(ss) 102 | } 103 | -------------------------------------------------------------------------------- /vignettes/Simulations.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "TS simulation" 3 | author: "Sven Gastauer" 4 | date: "16 October 2019" 5 | output: 6 | rmarkdown::html_vignette: 7 | toc: true 8 | toc_depth: 4 9 | fig_width: 7 10 | fig_height: 4 11 | vignette: > 12 | %\VignetteIndexEntry{Simulations with ZooScatR} 13 | %\VignetteEngine{knitr::rmarkdown} 14 | %\usepackage[utf8]{inputenc} 15 | --- 16 | 17 | ```{r setup, include=FALSE} 18 | knitr::opts_chunk$set(echo = TRUE) 19 | library(ZooScatR) 20 | library(reshape2) 21 | library(ggplot2) 22 | ``` 23 | 24 | # Create a TS simulation and plot the results 25 | 26 | ## Data preparation 27 | 28 | First let's load standard parameter file, included in ZooScatR. We will then make minor adjustments to include a more realistic krill shape, simulate data from 18 to 300 kHz, reduce the number of integration elements and frequency steps,as a compromise between speed and data resolution. We also have to set the soundspeed in the surrounding medium. Finally we will run a simulation with the standard distributions for Lengths and Oirentations. 29 | 30 | 31 | ```{r settings} 32 | fname <- paste0(system.file(package="ZooScatR"),"/extdata/configs/config_0.dat") #Loacation of the parameters file 33 | para = read_para(fname) #Read parameters file 34 | para$simu$var0 = 18 #simulate from 10 35 | para$simu$var1 = 300 #...to 300 kHz 36 | para$simu$ni = 200 #resudce the number of elements and frequencies to improve speed 37 | para$simu$n = 283 38 | 39 | #Create list with soundspeed info 40 | misc <- list(cw=1500) 41 | 42 | #change to the more realistic krill shape 43 | profname <- paste0(system.file(package="ZooScatR"),"/extdata/profiles/euphaus1.dat") #krill example 44 | para$shape$prof_name <- profname 45 | 46 | #make a length simulation 47 | para$shape$ave_flag = 1 48 | 49 | #make an orientation simulation 50 | para$orient$ave_flag = 1 51 | ``` 52 | 53 | ## Simulation 54 | 55 | Now we are ready to run the simulation. We fix the number of simulations with *nang* for orientation angles and *nl* for lengths. 56 | Note that we set simOut to TRUE (which strictly speaking is not necessary as this is the default setting now): 57 | 58 | ```{r simulation} 59 | #Run DWBA based on config file 60 | res <- bscat(para=para, misc=misc, simOut = TRUE, nang=100, nl=100) #Target strength vs Frequency 61 | ``` 62 | 63 | The way the simulations work is that first simulations for the orientation distribution are generated. These are then stored as an output and the mean is computed for furhter simulation with the length distribution. Alternatively, individual simulations could be run for a set of lengths and orientations. 64 | 65 | Once the simulations are completed we can have a look at the output. 66 | 67 | - *res$y* is the standard averaged output result 68 | - *res$var* contains the Frequencies for which the simulations were run 69 | 70 | - *res$ysim* contains the simulations for the diffrenet orientations 71 | - *res$ang* contains the orientation angles for which the simulations were run 72 | 73 | - *res$ysimL* contains the simulations for the different Lengths, based on the average orientation result. 74 | - *res$Length* contains the lengths for which the simulations were run 75 | 76 | ## Plots 77 | 78 | This allows us to generate easily compute some overview plots, that might be informative. 79 | 80 | ### Orientation simulations 81 | 82 | ```{r plots_osim} 83 | o_sim = melt(res$ysim) 84 | o_sim$theta = res$ang[o_sim$Var2] 85 | o_sim$Frequency = res$var[o_sim$Var1] 86 | o_sim=o_sim[,3:ncol(o_sim)] 87 | names(o_sim)[1] <- 'TS' 88 | 89 | mTS = data.frame(Frequency=res$var,TS=res$y) 90 | 91 | ggplot()+geom_line(data=o_sim, aes(x = Frequency, y=TS, group=theta),lty=2, lwd=0.5, alpha=0.4)+ 92 | geom_line(data=mTS, aes(x=Frequency, y=TS), lty=1, lwd=2)+theme_classic()+theme(text=element_text(size=14)) 93 | 94 | ggplot(data=o_sim, aes(x=Frequency, y=theta, fill=TS))+ 95 | geom_raster()+ 96 | scale_fill_viridis_c()+ 97 | scale_y_continuous(expand=c(0,0))+ 98 | scale_x_continuous(expand=c(0,0))+ 99 | theme_classic()+theme(text=element_text(size=14)) 100 | ``` 101 | 102 | ### Length simulations 103 | 104 | ```{r plots_L} 105 | l_sim = melt(res$ysimL) 106 | l_sim$Length = res$L[l_sim$Var2] 107 | l_sim$Frequency = res$var[l_sim$Var1] 108 | l_sim=l_sim[,3:ncol(l_sim)] 109 | names(l_sim)[1] <- 'TS' 110 | 111 | ggplot()+geom_line(data=l_sim, aes(x = Frequency, y=TS, group=Length),lty=2, lwd=0.5, alpha=0.4)+ 112 | geom_line(data=mTS, aes(x=Frequency, y=TS), lty=1, lwd=2)+theme_classic()+theme(text=element_text(size=14)) 113 | 114 | 115 | 116 | ggplot(data=l_sim, aes(x=Frequency, y=Length, fill=TS))+ 117 | geom_raster()+ 118 | scale_fill_viridis_c()+ 119 | scale_y_continuous(expand=c(0,0))+ 120 | scale_x_continuous(expand=c(0,0))+ 121 | theme_classic()+theme(text=element_text(size=14)) 122 | 123 | ``` 124 | -------------------------------------------------------------------------------- /R/TScal.R: -------------------------------------------------------------------------------- 1 | #' Theoretical TS of calibration sphere 2 | #' R script of function for band averaged TS of tungsten 3 | #' carbide spheres translated from Matlab code (Version date 31/5/05) 4 | #' written by D. MacLennan (Marine Lab, Aberdeen) 5 | #' updated from R version written by Sascha F?ssler 03/2010 6 | #' updated Sven Gastauer 04/01/2017 7 | #' @import ggplot2 8 | #' @export 9 | #' @param freq numeric frequencies [kHz]; default seq(38,200) 10 | #' @param c numeric ambient soundspeeds [m/s]; default 1500 11 | #' @param d numeric sphere diameter [cm]; default = 38.1 12 | #' @param mat string material properties of the aphere Cu = Copper, TC = Tungsten-Carbide; default 'TC' 13 | #' @param water string either sw= seawater or fw = fresh water; will be ignored if rhow (density of seawater is defined); default 'sw 14 | #' @param rhow numeric density of ambient seawater, if NULL parameter water will be used; default NULL 15 | #' @param plot boolean TRUE/FALSE if plot should be part of the output; default TRUE 16 | #' @return dataframe with columns "F","TS","ModF2","c", where F = Frequency [kHz]; TS = TS [dB]; ModF2 = ModF^2 and c soundspeed [m/s], an optional ggplot can be part of the output 17 | #' @examples ts.cal(freq=seq(90,170,by=0.1),c=1500.5,rhow=1.02509,plot=TRUE) 18 | ts.cal <- function(freq=seq(38,200),c=1500,d=38.1,mat="TC",water="sw",rhow=NULL,plot=TRUE){ 19 | require(ggplot2) 20 | a <- d/2 21 | results <-NA 22 | #select materia l 23 | cc <- switch(mat, 24 | TC = c(6853,4171), 25 | Cu = c(4760,2288)) 26 | if(is.null(rhow)){ 27 | ww <- switch(water, 28 | sw = 1.027, 29 | fw = 1)} 30 | else{ 31 | ww = rhow 32 | } 33 | rho <- switch(mat, 34 | TC = c(14.9/ww), 35 | Cu = c(8.945/ww)) 36 | 37 | for(i in 1:length(c)){ 38 | q<- 2*pi*freq*a/c[i] # ka range 39 | ka=q 40 | 41 | nr <- length(ka) 42 | F <- matrix(0,nr,4) 43 | Lmax <- floor(max(ka))+20 44 | alpha <- 2*rho*(cc[2]/c[i])^2 45 | beta <- rho*(cc[1]/c[i])^2-alpha 46 | nn <- 1:(Lmax+1) 47 | n0 <- 2:(Lmax+1) 48 | lh <- nn-0.5 49 | LL <- 0:Lmax 50 | S <- (floor(LL/2)==LL/2)*1-(floor((LL+1)/2)==(LL+1)/2)*1 51 | L <- 1:Lmax 52 | L <- matrix(c(L,L,L),length(L),3) 53 | jh <- matrix(0,Lmax+1,3) 54 | djh <- jh 55 | ddjh <- jh 56 | yh <- matrix(0,Lmax+1,1) 57 | 58 | for (jj in 1:nr){ 59 | q <- ka[jj] 60 | q1 <- q*c[i]/cc[1] 61 | q2 <- q*c[i]/cc[2] 62 | qq <- matrix(c(q1,q2,q),length(q),3) 63 | bfac <- sqrt((qq*2/pi)); 64 | Qm <- t(matrix(qq,length(qq),Lmax)) 65 | Bf <- t(matrix(bfac,length(bfac),Lmax+1)) 66 | 67 | # jh/yh are spherical Bessel functions of the first/second kinds 68 | # starting at order L=0 (i.e. order is row number - 1). 69 | jh <- (matrix(c(besselJ(q1,lh),besselJ(q2,lh),besselJ(q,lh)),length(nn),3))/Bf 70 | yh <- besselY(q,lh)/Bf[,3] 71 | djh[1,] <- -jh[1,]+cos(qq) # Zero order derivatives 72 | dyh <- -yh[1]+sin(q) # djh= x*jL'(x); dyh= x*yL'(x) 73 | ddjh[1,] <- -2*djh[1,]-qq*sin(qq) # ddjh = x^2*jL''(x) 74 | djh[n0,] <- -(L+1)*jh[n0,]+Qm*jh[n0-1,] # Derivatives for orders 2 upwards 75 | dyh[n0] <- -(L[,1]+1)*yh[n0]+Qm[,3]*yh[n0-1] 76 | ddjh[n0,] <- ((L+1)*(L+2)-Qm*Qm)*jh[n0,]-2*Qm*jh[n0-1,] 77 | 78 | a2 <- (LL*LL+LL-2)*jh[,2]+ddjh[,2] 79 | a1 <- 2*LL*(LL+1)*(djh[,1]-jh[,1]) 80 | b2 <- a2*(beta*q1^2*jh[,1]-alpha*ddjh[,1])-alpha*a1*(jh[,2]-djh[,2]) 81 | b1 <- q*(a2*djh[,1]-a1*jh[,2]) 82 | x <- -b2*djh[,3]/q + b1*jh[,3] 83 | y <- b2*dyh/q - b1*yh 84 | z <- S*(2*LL+1)*x/(x*x+y*y) 85 | y <- z*y 86 | x <- z*x 87 | 88 | F[jj,3:4] <- -(2/q)*c(sum(y),sum(x)) # The form function 89 | F[jj,1] <- F[jj,3]^2+F[jj,4]^2 # and its modulus squared 90 | F[jj,2]<-10*log10((a/2000)^2*F[jj,1]) 91 | } 92 | tmp <- as.data.frame(cbind(rbind(cbind(freq, F[,2], F[,1])),c[i])) 93 | names(tmp)<-c("F","TS","ModF2","c") 94 | if(i>1 | jj>1){ 95 | results <- rbind(results,tmp) 96 | }else{ 97 | results<-tmp 98 | } 99 | } 100 | if(plot == TRUE){ 101 | #plot(results$TS,col=results$c) 102 | pp<-ggplot(data=results, aes(x=F,y=TS,group=c))+ 103 | geom_line(aes(lty=as.factor(c)))+ 104 | labs(lty = "c [m/s]")+ 105 | theme_classic()+ 106 | theme(legend.position = "top")+ 107 | xlab("Frequency [kHz]")+ylab("TS [dB]") 108 | print(pp) 109 | } 110 | results <- na.omit(results) 111 | return(results) 112 | } 113 | -------------------------------------------------------------------------------- /R/video2profile.R: -------------------------------------------------------------------------------- 1 | #' Read the configuration file 2 | #' Keep standard dat format, as used in Matlab, to keep maximum compatibility with previous files 3 | #' @import ggplot2 4 | #' @import pracma 5 | #' @param x x coordinates 6 | #' @param y y corrdinates 7 | #' @param z z coordinates 8 | #' @return shape 9 | #' @examples 10 | #' sub <- shapes[which(shapes$ID==unique(shapes$ID)[x]),] 11 | #' generate_pos(sub$x,sub$y,sub$z) 12 | #' @export 13 | 14 | generate_pos <- function(x=sub$x,y=sub$y,z=sub$z){ 15 | x=x-min(x) 16 | y=y-min(y) 17 | z=z-min(z) 18 | y2=0 19 | dist3 <- function(x1,y1,z1,x2,y2,z2){sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2)} 20 | dist2 <- function(x1,y1,x2,y2){sqrt((x1-x2)^2+(y1-y2)^2)} 21 | for(i in 1:(length(x))){ 22 | for(j in c(2:length(x),1)){ 23 | d3=dist3(x[i],y[i],z[i],x[j],y[j],z[j]) 24 | d2=dist2(x[i],y[i],x[j],y[j]) 25 | #y2[i]=y[i]+d3-d2 26 | y2[i]=d3 27 | } 28 | } 29 | 30 | ddd<-as.data.frame(cbind(x=x,y=y,y2=y2)) 31 | print(ggplot2::ggplot(data=ddd)+ 32 | ggplot2::geom_polygon(ggplot2::aes(x=x,y=y), alpha=0.9, fill="gray", col="black", lty=2)+ 33 | ggplot2::geom_polygon(ggplot2::aes(x=x,y=z), alpha=0.7, fill="lightgray", col="black", lty=3)+ 34 | ggplot2::geom_polygon(ggplot2::aes(x=x,y=y2), fill="lightblue", alpha=0.8, col="black")+ 35 | ggplot2::coord_fixed()) 36 | print(ggplot(data=ddd)+ 37 | geom_polygon(aes(x=x,y=y), alpha=0.9, fill="gray", col="black", lty=2)+ 38 | geom_polygon(aes(x=x,y=z), alpha=0.7, fill="lightgray", col="black", lty=3)+ 39 | geom_polygon(aes(x=x,y=y2), fill="lightblue", alpha=0.8, col="black")+ 40 | coord_fixed()) 41 | 42 | n=200 43 | x_b=x[1:max(which(x==max(x)))] 44 | y_b=y2[1:max(which(x==max(x)))] 45 | x_t=x[max(which(x==max(x))):length(x)] 46 | y_t=y2[max(which(x==max(x))):length(y)] 47 | 48 | top <- pracma::interp1(x_t,y_t,seq(min(x), max(x), length=n), method="linear") 49 | bottom <- (pracma::interp1(x_b,y_b,seq(min(x), max(x),length=n), method="linear")) 50 | top <- interp1(x_t,y_t,seq(min(x), max(x), length=n), method="linear") 51 | bottom <- (interp1(x_b,y_b,seq(min(x), max(x),length=n), method="linear")) 52 | mid <- as.data.frame(cbind(x=seq(min(x), max(x), length=n), 53 | y=rowMeans(cbind(top,bottom)))) 54 | mid$taper=sqrt((top-bottom)^2) 55 | 56 | print(ggplot2::ggplot()+ 57 | ggplot2::geom_polygon(data=as.data.frame(cbind(x=x,y=y2)), ggplot2::aes(x=x,y=y2), alpha=0.5)+ 58 | ggplot2::geom_line(data=mid, ggplot2::aes(x=x,y=y))) 59 | print(ggplot()+ 60 | geom_polygon(data=as.data.frame(cbind(x=x,y=y2)), aes(x=x,y=y2), alpha=0.5)+ 61 | geom_line(data=mid, aes(x=x,y=y))) 62 | mid$p=0 63 | return(mid[,c(x=2,z=1,taper=3, p=4,p2=4)]) 64 | } 65 | 66 | # 67 | # 68 | # # setwd("/Users/sveng/ZooScatR/ZooScatR/") 69 | # # source("DWBAbscat.R") 70 | # # source("smoother.R") 71 | # # source("read_para.R") 72 | # # source("orient_ave.R") 73 | # # source("length_ave.R") 74 | # # source("buildpos.R") 75 | # # source("bscat.R") 76 | # # source("createfile.R") 77 | # # source("create_profile.R") 78 | # # source("get_parameters.R") 79 | # # source("inhom_gh.R") 80 | # # source("save_config.R") 81 | # # source("smoother.R") 82 | # # 83 | # # #Video output 84 | # path <- "/Users/sveng/Documents/echoview/" 85 | # shapes <- read.csv(paste0(path,list.files(path=path,pattern="krill*"))) 86 | # 87 | # shapes$ID <- paste0("F",shapes$Frame,"C",shapes$Cont) 88 | # 89 | # x=1200 90 | # px2mm <- 19/23 91 | # sub <- shapes[which(shapes$ID==unique(shapes$ID)[x]),] 92 | # sub$x<-sub$x*px2mm;sub$z<-sub$z*px2mm;sub$y<-sub$y*px2mm; 93 | # pos120<-generate_pos(sub$x,sub$y,sub$z) 94 | # 95 | # L=dist2(pos120$x[1],pos120$y[1],pos120$x[length(pos120$x)],pos120$y[length(pos120$y)]) 96 | # 97 | # profnam=paste0("pos",x,".dat") 98 | # 99 | # write.table(pos120,file=profnam,sep="\t", col.names = FALSE, row.names = FALSE) 100 | # #read.table(profnam) 101 | # #Set filename ro config file 102 | # fname = "/Users/sveng/Documents/Tank/GUI_DWBA_scat_model/mfiles/configuation/config_0.dat" 103 | # #read config file 104 | # para = read_para(fname) 105 | # #Create list with soundspeed info 106 | # misc <- list() 107 | # misc$cw <- 1460 108 | # #Create status list 109 | # status<- list() 110 | # status$stop = 0 111 | # 112 | # para$shape$prof_name = paste0(getwd(),'/',profnam) 113 | # 114 | # #set sampling 115 | # para$simu$n <- length(seq(90,170)) 116 | # para$simu$var0 <- 90 117 | # para$simu$var1 <- 170 118 | # 119 | # para$shape$L <- L 120 | # para$shape$ave_flag <- -1 121 | # 122 | # para$shape$axis_sm<-0 123 | # para$shape$taper_sm<-0 124 | # 125 | # para$orient$ave_flag <- -1 126 | # para$orient$angm <- -90 127 | # 128 | # 129 | # #Run DWBA based on config file 130 | # res <- bscat(para=para, misc=misc, status=status) 131 | # res$rplot 132 | # 133 | # 134 | # for(x in sample(1:length(unique(shapes$ID)),20)){ 135 | # sub <- shapes[which(shapes$ID==unique(shapes$ID)[x]),] 136 | # generate_pos(sub$x,sub$y,sub$z) 137 | # } 138 | -------------------------------------------------------------------------------- /R/buildpos.R: -------------------------------------------------------------------------------- 1 | #' @title Build shape vector of the hypothetical target 2 | #' @description Builds all the coordinate vectors related to the shape positions of the target 3 | #' body axis is along the z-axis 4 | #' construct shape coordinates 5 | #' a list containing the shape coordinates: r_pos (position vector), the_tilt , dr, gamma_t, taper, x, z, and plot if disp_prof=1 6 | #' @import pracma 7 | #' @import ggplot2 8 | #' @author Sven Gastauer 9 | #' @export 10 | #' @param para a list containining the shape parameters (used arguments: para$shape$ni - Number of integration points; para$shape$order - Tapering order; para$shape$rho_L - rho = radius of curvature; para$shape$prof_name - 0Custom shape, -1 for regular shape, filename for custom shape 11 | #' @param disp_prof = 1 if 1 a ggplot object of the shape is added to the output list, otherwise, no plot is produced 12 | #' @examples 13 | #' para$shape$L <-30 14 | #' para$shape$L_a <- 16 15 | #' para$shape$rho_L <- 3 16 | #' para$shape$order <- 7 17 | 18 | buildpos <- function(para, disp_prof=1){ 19 | eps<-2^(-52) 20 | 21 | #print(paste("Buildpos:",para$shape$prof_name)) 22 | #r_pos,th_tilt,dr,gamma_t,taper,x,z){ 23 | n_int = para$simu$ni 24 | order = para$shape$order 25 | rho_L = para$shape$rho_L 26 | L_a = para$shape$L_a 27 | 28 | 29 | if(is.null(para$shape$prof_name)){para$shape$prof_name=-1} 30 | if (para$shape$prof_name==-1){ # regular shape 31 | # uniformly bent cylinder and regularly tapered 32 | gamma = 0.5/rho_L 33 | ratio = 2*rho_L 34 | z = seq(-1,1,length = n_int) 35 | taper = sqrt(1-z^order) 36 | # normalized by rho - radius of curvature 37 | z = sin(gamma)*z 38 | x = (1-sqrt(1-z*z)) 39 | # normalized by L/2 40 | x = ratio*x 41 | z = ratio*z 42 | }else{ # arbitrary position profile and arbitrary tapering 43 | pos = read.table(para$shape$prof_name, header = FALSE) 44 | xp = pos[,1] 45 | zp = pos[,2] 46 | taper1 = pos[,3] / max(pos[,3]) #! added / max(pos[,3]) 47 | z = seq(min(zp) + eps, max(zp)-eps, length=n_int) 48 | x = pracma::interp1(zp, xp, z, method="linear") 49 | taper = pracma::interp1(zp, taper1, z, method="linear") 50 | x = x - mean(x) 51 | z = z - mean(z) 52 | dr = sqrt(diff(x)^2 + diff(z)^2) 53 | L = sum(dr) 54 | x = 2*x/L 55 | z = 2*z/L 56 | taper=taper# normalized position vector 57 | para$shape$x = x 58 | para$shape$z = z 59 | para$shape$xp = xp 60 | para$shape$zp = zp 61 | para$shape$taper = taper#!changed from taper1 62 | } 63 | 64 | taper = matrix(taper,1,nrow=n_int) 65 | 66 | if (para$shape$prof_name!=-1){ 67 | x = smoother(x,para$shape$axis_sm) 68 | } 69 | 70 | if (disp_prof == 1){ 71 | taper0 = taper 72 | } 73 | 74 | 75 | if (para$shape$prof_name != -1){ 76 | taper = smoother(as.numeric(taper),para$shape$taper_sm) 77 | } 78 | 79 | th_tilt = matrix(0, n_int, 1) 80 | r_pos = sqrt(x * x + z * z) 81 | gamma_t = atan2(z, x) 82 | dx = diff(x) + eps 83 | dz = diff(z) 84 | alpha_t = c(atan(dz / dx), atan(dz[n_int-1]/dx[n_int-1])) 85 | indx1 = which(alpha_t < 0) 86 | if(length(indx1) > 0){ 87 | th_tilt[indx1] = alpha_t[indx1] + pi / 2 88 | } 89 | 90 | indx2 = which(alpha_t >= 0) 91 | if(length(indx2) > 0){ 92 | th_tilt[indx2] = alpha_t[indx2]-pi/2 93 | } 94 | 95 | dr1 = sqrt(dx * dx + dz * dz) 96 | dr = c(dr1[1], dr1) 97 | 98 | if(disp_prof == 1){ 99 | x1 = x+taper/L_a 100 | x2 = x-taper/L_a 101 | x10 = x+taper0/L_a 102 | x20 = x-taper0/L_a 103 | ppp <- ggplot2::ggplot()+ 104 | ylab('x')+ 105 | ggplot2::geom_path( 106 | ggplot2::aes(y=2*x,x=z))+ 107 | ggplot2::geom_path( 108 | ggplot2::aes(y=as.numeric(2*x1),x=z))+ 109 | ggplot2::geom_path( 110 | ggplot2::aes(y=as.numeric(2*x2),x=z))+ 111 | ggplot2::geom_path( 112 | ggplot2::aes(y=as.numeric(2*x10),x=z), lty=2, lwd=1.2)+ 113 | ggplot2::geom_path( 114 | ggplot2::aes(y=as.numeric(2*x20),x=z),lty=2, lwd=1.2)+ 115 | ggplot2::coord_equal()+ 116 | ggplot2::theme_bw() + 117 | ggplot2::theme(panel.border = 118 | ggplot2::element_blank(), 119 | panel.grid.major = 120 | ggplot2::element_blank(), 121 | panel.grid.minor = 122 | ggplot2::element_blank(), 123 | axis.line = 124 | ggplot2::element_line(colour = "black"), 125 | axis.text = 126 | ggplot2::element_text(size=18), 127 | axis.title = 128 | ggplot2::element_text(size=18)) 129 | # axis('equal')grid 130 | # disp('press any key to cont. ..')pause 131 | # plot(z,taper0,z,taper,'r') 132 | }else{ppp=NULL} 133 | out =list() 134 | out$r_pos=r_pos 135 | out$th_tilt = th_tilt 136 | out$dr = dr 137 | out$gamma_t = gamma_t 138 | out$taper = taper 139 | out$x = x 140 | out$z = z 141 | out$plot <- ppp 142 | return(out) 143 | } 144 | 145 | 146 | -------------------------------------------------------------------------------- /inst/extdata/doc/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

ZooScatR – An R package for modelling the scattering properties of weak scattering targets using the Distorted Wave Born Approximation

4 |
5 |

6 | 7 | Sven Gastauer1,2, Dezhang Chu3, Martin J. Cox2 8 |

9 |

10 | 1Antarctic Climate and Ecosystem Cooperative Research Centre, University of Tasmania, Private Bag 80, Hobart, Tasmania, 7001, sven.gastauer@utas.edu.au
11 | 2Australian Antarctic Division, 203 Channel Highway, Kingston, TAS 7050, Australia
12 | 3Northwest Fisheries Science Center, National Marine Fisheries Service, National Oceanic and Atmospheric Administration, 2725 Montlake Boulevard East, Seattle, Washington 98112, USA 13 |

14 |
15 |
16 |

17 | Current version: 0.2.1
18 | Github site:
https://github.com/AustralianAntarcticDivision/ZooScatR 19 |

20 |
21 | TOC 22 |
23 |
    24 |
  1. Overview
  2. 25 |
  3. Copyright
  4. 26 |
  5. Available vignettes
  6. 27 |
  7. Additional help
  8. 28 |
29 |
30 |
31 |
32 |
33 |

Overview

34 | ZooScatR is an implementation of the Distorted Wave Born Approximation (DWBA) model for the simulation of acoustic scattering by weak scattering targets inside a fluid.
35 | It includes a shiny web application called DWBAapp for easy model parametrisation and result visualisation as well as the option to run the DWBA model from the command line. Additional functions to compute soundspeed in water, water density and Spherical Bessel functions with their derivatives (as needed in the analytical solution of a weakly scattering sphere, e.g. Neumann and Hankel functions). 36 |
37 |
38 |
39 |