https://github.com/emmt/randfieldstructfuncs.jl
Structure functions in Julia
https://github.com/emmt/randfieldstructfuncs.jl
Last synced: 5 months ago
JSON representation
Structure functions in Julia
- Host: GitHub
- URL: https://github.com/emmt/randfieldstructfuncs.jl
- Owner: emmt
- License: mit
- Created: 2023-03-29T11:02:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-24T13:16:06.000Z (almost 2 years ago)
- Last Synced: 2025-01-29T05:41:18.741Z (over 1 year ago)
- Language: Julia
- Size: 73.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Structure functions of random fields in Julia
[](https://github.com/emmt/RandFieldStructFuncs.jl/actions/workflows/CI.yml?query=branch%3Amain) [](https://ci.appveyor.com/project/emmt/RandFieldStructFuncs-jl) [](https://codecov.io/gh/emmt/RandFieldStructFuncs.jl)
This package is to deal with structure functions of random fields with stationary
increments in Julia.
The structure function of a random field `φ` is defined by:
``` julia
Dᵩ(Δr) = ⟨[φ(r + Δr) - φ(r)]²⟩
```
where `⟨…⟩` denotes expectation while `r` and `Δr` are absolute and relative positions. If
`φ` has stationary increments, its structure function does not depend on `r`, only on `Δr`.
This package let you build structure function objects, generate the associated covariance
matrix, and simulate random fields having a given structure function `Dᵩ` and piston
standard deviation `σ`. If `σ > 0` holds, the covariance of `φ` is invertible.
This [LaTeX file](notes/structure-functions.tex) provides some mathematical background.
## Usage
To measure empirically a structure function:
``` julia
# Create structure function object with support S.
A = EmpiricalStructFunc(S)
for ϕₜ in Φ
# Integrate structure function.
push!(A, ϕₜ)
end
T = nobs(A); # get the number of observations
D_ϕ = values(A); # compute the structure function
```
At any moment:
``` julia
a = A.den; # get the denominator: `a = S ⊗ S`
fft_b = A.num; # get the numerator in the frequency domain
```
It is also possible to define theoretical structure functions. For example, Kolmogorov
structure function for Fried's parameter `r0` is built by:
``` julia
D = KolmogorovStructFunc(r0);
```
which yields a callable object `D` such that `D(r)` returns the value of the structure
function at position `r`. Note that `r` and `r0` are assumed to have the same units if
`r0` has no units; otherwise; `r` must have the same unit dimensions as `r0`.