Skip to content
Leandro Acquaroli edited this page Jun 3, 2021 · 27 revisions

This module wraps some useful functions used inside the ThinFilmsTools.jl module.

Usage

To see the available functions, type:

julia> Utils.Info()

 Available functions from Utils module:
 
   	build_interpolation(X)
	multiple_reflections(n)
	find_closest(x, x0)
	blackbody_radiation(λ, T)
	wavelength2rgb(λ)
	simple_moving_average(x)
        exponential_moving_average(x)
	flatten_arrays(x)
	array_arrays(x, y)
	average_polarisation(pol, Xp, Xs)
	gaussian(x, p)
	lorentzian(x, p)
	voigtian(x, p)

     To use any of these functions type: ?Utils.function

Also, you can check the information per functions:

julia> ?
help?> Utils.average_polarisation
  Return the polarisation averaged spectrum.
  
      X = Utils.average_polarisation(pol, Xp, Xs)
  
          pol: indicates the polarisation (1.0 = p, 0.0 = s, between 0.0 and 1.0 = average)
          Xp: p/TM polarisation quantity (e.g. Rp)
          Xs: s/TE polarisation quantity (e.g. Rs)
          Xavg: unpolarized quantity = pol*Rp + (1.0 - pol)*Rs

help?> Utils.blackbody_radiation
  Returns the spectral radiance (W·sr^-1·m^-3), given the
wavelength (m) and the absolute temperature (K).
  
  	B = Utils.blackbody_radiation(λ, T)
  
  		λ: range of wavelengths [m]
  		T: range of temperatures [K]
  		B: spectral radiance [W·sr^-1·m^-3]
  
  Source: https://en.wikipedia.org/wiki/Planck%27s_law

help?> Utils.gaussian
  Multipeak Gaussian PDF curve.
  
    modelg = gaussian(x, p)
  
        x = vector with data of the x-axis
        p = [
              [p0], # offset
              [A1, μ1, σ1], # first peak
              [A2, μ2, σ2], # second peak
              ..., # so on
            ]
            p0: offset of the total curve
            Ai: amplitude of peak i
            μi: position of peak i (mean or expectation of the distribution)
            σi: standard deviation of peak i
            i = 1,...,n
  
  Source: https://en.wikipedia.org/wiki/Normal_distribution
Clone this wiki locally