Various mathematical functions

Submodule containing functions used in fitting

Fitting the continuum

specmodels.specmodels_functions.polyf_o1(x, a1, a0)[source]

Affine function

(1)\[P(x) = a_{1} \cdot x + a_{0}\]
Parameters:
  • x (array[float]) – The independant variable

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o1 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o2(x, a2, a1, a0)[source]

Polynomial function of order 2

(2)\[P(x) = a_{2} \cdot x^{2} + a_{1} \cdot x + a_{0}\]
Parameters:
  • x (array[float]) – The independant variable

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o2 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o3(x, a3, a2, a1, a0)[source]

Polynomial function of order 3

(3)\[P(x) = a_{3} \cdot x^{3} + a_{2} \cdot x^{2} + a_{1} \cdot x + a_{0}\]
Parameters:
  • x (array[float]) – The independant variable

  • a3 (float) – term for order 3

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o3 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o4(x, a4, a3, a2, a1, a0)[source]

Polynomial function of order 4

(4)\[P(x) = \sum_{i=0}^{4} a_{i} \cdot x^{i}\]
Parameters:
  • x (array[float]) – The independant variable

  • a4 (float) – term for order 4

  • a3 (float) – term for order 3

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o4 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o5(x, a5, a4, a3, a2, a1, a0)[source]

Polynomial function of order 6

(5)\[P(x) = \sum_{i=0}^{5} a_{i} \cdot x^{i}\]
Parameters:
  • x (array[float]) – The independant variable

  • a5 (float) – term for order 5

  • a4 (float) – term for order 4

  • a3 (float) – term for order 3

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o5 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o6(x, a6, a5, a4, a3, a2, a1, a0)[source]

Polynomial function of order 6

(6)\[P(x) = \sum_{i=0}^{6} a_{i} \cdot x^{i}\]
Parameters:
  • x (array[float]) – The independant variable

  • a6 (float) – term for order 6

  • a5 (float) – term for order 5

  • a4 (float) – term for order 4

  • a3 (float) – term for order 3

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o6 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o7(x, a7, a6, a5, a4, a3, a2, a1, a0)[source]

Polynomial function of order 7

(7)\[P(x) = \sum_{i=0}^{7} a_{i} \cdot x^{i}\]
Parameters:
  • x (array[float]) – The independant variable

  • a7 (float) – term for order 7

  • a6 (float) – term for order 6

  • a5 (float) – term for order 5

  • a4 (float) – term for order 4

  • a3 (float) – term for order 3

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o7 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o8(x, a8, a7, a6, a5, a4, a3, a2, a1, a0)[source]

Polynomial function of order 8

(8)\[P(x) = \sum_{i=0}^{8} a_{i} \cdot x^{i}\]
Parameters:
  • x (array[float]) – The independant variable

  • a8 (float) – term for order 8

  • a7 (float) – term for order 7

  • a6 (float) – term for order 6

  • a5 (float) – term for order 5

  • a4 (float) – term for order 4

  • a3 (float) – term for order 3

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o8 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o9(x, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0)[source]

Polynomial function of order 9

(9)\[P(x) = \sum_{i=0}^{9} a_{i} \cdot x^{i}\]
Parameters:
  • x (array[float]) – The independant variable

  • a9 (float) – term for order 9

  • a8 (float) – term for order 8

  • a7 (float) – term for order 7

  • a6 (float) – term for order 6

  • a5 (float) – term for order 5

  • a4 (float) – term for order 4

  • a3 (float) – term for order 3

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o9 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_o10(x, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0)[source]

Polynomial function of order 10

(10)\[P(x) = \sum_{i=0}^{10} a_{i} \cdot x^{i}\]
Parameters:
  • x (array[float]) – The independant variable

  • a10 (float) – term for order 10

  • a9 (float) – term for order 9

  • a8 (float) – term for order 8

  • a7 (float) – term for order 7

  • a6 (float) – term for order 6

  • a5 (float) – term for order 5

  • a4 (float) – term for order 4

  • a3 (float) – term for order 3

  • a2 (float) – term for order 2

  • a1 (float) – term for order 1

  • a0 (float) – constant term

Returns:

The value of the polyf_o10 function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.polyf_gen(order=1)[source]

Setup switch for polynomial function

Parameters:

order (int) – Order of polynomial function to return.

Returns:

The polynomial function of the required order

Return type:

function

Fitting bands

specmodels.specmodels_functions.gaussian(x, amplitude, mean, stddev)[source]

Canonical gaussian function

Parameters:
  • x (array[float]) – The independant variable

  • amplitude (float) – The amplitude of the band

  • mean (float) – The central position of the band

  • stddev (float) – The root-square of the width of the band

Returns:

The value of the gaussian function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.emg(x, amplitude, mean, stddev, rfactor)[source]

Exponentially Modified Gaussian (Chromatography expression)

Check Pottin+2020 and Grushka+1972 for details on the function

Parameters:
  • x (array[float]) – The independant variable (e.g. wavelength)

  • amplitude (float) – The amplitude of the band

  • mean (float) – The central position of the band

  • stddev (float) – The root-square of the width of the band

  • rfactor (float) – The asymmetry factor of the band

Returns:

The value of the EMG function at each value of x

Return type:

array[float]

specmodels.specmodels_functions.emg_alt(x, amplitude, mean, stddev)[source]

Exponentially Modified Gaussian (Canonical expression)

Check Pottin+2020 and Grushka+1972 for details on the function

Parameters:
  • x (array[float]) – The independant variable (e.g. wavelength)

  • amplitude (float) – The amplitude of the band

  • mean (float) – The central position of the band

  • stddev (float) – The root-square of the width of the band

Returns:

The value of the EMG function at each value of x

Return type:

array[float]