IntensityConversion#

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

ベースクラス: 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.

パラメータ:
  • 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".

変数:

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

サンプル

>>> 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]])

メモ

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[ソース]

Fit the transformer to the input data.

パラメータ:
  • X (np.ndarray of shape (n_samples, n_features)) -- The input data to fit the transformer to.

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

戻り値:

self -- The fitted transformer.

戻り値の型:

IntensityConversion

transform(X: ndarray, y=None) ndarray[ソース]

Convert the input data to the target unit.

パラメータ:
  • X (np.ndarray of shape (n_samples, n_features)) -- The input data to transform.

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

戻り値:

X_converted -- The converted data.

戻り値の型:

np.ndarray of shape (n_samples, n_features)