Calculation Tools
Tools to help with microscopy-related calculations.
MicroscopyTools.Δ_phase — Function
Δ_phase(arr, dim)Calculates the relative phase slope along dimension dim of a non-zero array arr without wrap-around problems.
Arguments:
- arr: array of which to evaluate the phase slope
- dim: dimension along which to evaluate the slope
MicroscopyTools.soft_theta — Function
soft_theta(x::T, k=T(1)) where TThis is a version of the theta function that uses a soft transition and is differentiable. It is implemented as 1 / (1+exp(-2 * k * x)). A larger k makes the edge harder.
MicroscopyTools.soft_theta_pw — Function
soft_theta_pw(x::T, ϵ=T(0.01)) where TA different version of the soft theta. Uses a cos instead of exp functions. Furthermore, is piecewise defined. A smaller e makes the edge harder.
MicroscopyTools.radial_mean — Function
radial_mean(data; maxbin=nothing, bin_step=nothing, pixelsize=nothing)Calculates the radial mean of a dataset data. Returns a tuple of the radialmean and the bincenters.
Arguments:
data: data to radially averagemaxbin: a maximum bin valuebin_step: optionally defines the step between the bins
Examples
julia> radial_mean([5, 1, 1, 3, 15])
([1.0, 2.0, 10.0], [0.5, 1.5, 2.5])MicroscopyTools.soft_delta — Function
soft_delta(x::T, k=T(1)) where TThis is a smooth version of the delta function that uses a soft peak and is differentiable. Based on a Gaussian function. A larger k makes the edge harder.
MicroscopyTools.soft_delta_pw — Function
soft_delta_pw(x::T, ϵ=T(1)) where TThis is a smooth version of the delta function that uses a soft peak and is differentiable. Based on a cosine function. A larger k makes the edge harder.
MicroscopyTools.moment_proj_normed — Function
moment_proj_normed(data, h=3; pdims=3)Performs a projection over the h-th moment of the data along dimension(s) pdims normed by the variance.
Example
julia> MicroscopyTools.moment_proj_normed([1 3; 2 4], 2, pdims=(1,))
1×2 Matrix{Float64}:
0.5 0.5MicroscopyTools.moment_proj — Function
moment_proj(data, h=3; pdims=3)Performs a projection over the h-th moment of the data along dimension(s) pdims. See also moment_proj_normed
Example
julia> MicroscopyTools.moment_proj([1 3; 2 4], 2, pdims=(1,))
1×2 Matrix{Float64}:
0.25 0.25