Calculation Tools

Tools to help with microscopy-related calculations.

MicroscopyTools.Δ_phaseFunction
Δ_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
source
MicroscopyTools.soft_thetaFunction
soft_theta(x::T, k=T(1)) where T

This 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.

source
MicroscopyTools.soft_theta_pwFunction
soft_theta_pw(x::T, ϵ=T(0.01)) where T

A different version of the soft theta. Uses a cos instead of exp functions. Furthermore, is piecewise defined. A smaller e makes the edge harder.

source
MicroscopyTools.radial_meanFunction
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 average
  • maxbin: a maximum bin value
  • bin_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])
source
MicroscopyTools.soft_deltaFunction
soft_delta(x::T, k=T(1)) where T

This 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.

source
MicroscopyTools.soft_delta_pwFunction
soft_delta_pw(x::T, ϵ=T(1)) where T

This 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.

source
MicroscopyTools.moment_proj_normedFunction
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.5
source
MicroscopyTools.moment_projFunction
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
source