IntensityConversion#

class chemotools.physics.IntensityConversion(input_unit: str = 'absorbance', output_unit: str = 'transmittance')[fuente]

Bases: DocLinkMixin, TransformerMixin, OneToOneFeatureMixin, BaseEstimator

A transformer that converts spectral intensity data between common measurement units used in vibrational and diffuse reflectance spectroscopy. For the full list of supported conversions and their equations, see the Notes section below.

All ratio units (transmittance, reflectance) use the standard fraction convention (0–1). Data in percent (0–100) must be divided by 100 before using this transformer.

Parámetros:
  • input_unit (str, default="absorbance") – The unit of the input data. One of: "absorbance", "transmittance", "reflectance", "kubelka_munk", "pseudoabsorbance".

  • output_unit (str, default="transmittance") – The unit of the output data. One of: "absorbance", "transmittance", "reflectance", "kubelka_munk", "pseudoabsorbance".

Variables:

n_features_in (int) – The number of features in the input data.

Ejemplos

>>> import numpy as np
>>> from chemotools.physics import IntensityConversion
>>> X = np.array([[0.0, 1.0, 2.0]])
>>> converter = IntensityConversion(
        input_unit="absorbance", output_unit="transmittance"
    )
IntensityConversion()
>>> converter.fit_transform(X)
array([[1.  , 0.1 , 0.01]])

Notas

Supported conversion pairs:

  • "absorbance""transmittance":

    \[T = 10^{-A}, \quad A = -\log_{10}(T)\]
  • "reflectance""kubelka_munk":

    \[F(R) = \frac{(1-R)^2}{2R}\]
  • "kubelka_munk""reflectance":

    \[R = (1+F) - \sqrt{(1+F)^2 - 1}\]
  • "reflectance""pseudoabsorbance":

    \[PA = -\log_{10}(R), \quad R = 10^{-PA}\]
fit(X: ndarray, y=None) IntensityConversion[fuente]

Fit the transformer to the input data.

Parámetros:
  • X (np.ndarray of shape (n_samples, n_features)) – The input data to fit the transformer to.

  • y (None) – Ignored to align with API.

Devuelve:

self – The fitted transformer.

Tipo del valor devuelto:

IntensityConversion

transform(X: ndarray, y=None) ndarray[fuente]

Convert the input data to the target unit.

Parámetros:
  • X (np.ndarray of shape (n_samples, n_features)) – The input data to transform.

  • y (None) – Ignored to align with API.

Devuelve:

X_converted – The converted data.

Tipo del valor devuelto:

np.ndarray of shape (n_samples, n_features)