Densiometry
densiometry
Here data and functions for handling and specifying density values is included.
Functions:
-
adx16_decode–Converts from ADX16 values to absolute APD density.
-
adx16_encode–Converts from absolute APD density values to ADX16 values.
-
compute_printer_lights–Converts the APD printer light to a three light matrix by splitting into separate
-
construct_spectral_density–Split single density curve into separate layers using local extrema.
-
interpolate_status_density–Converts logarithmic status density values to a normalized linear status density
-
output_to_density–Numerically invert the mapping:
-
wavelength_argmax–Gets the argmax of a spectral distribution.
-
wavelength_argmin–Gets the argmax of a spectral distribution.
Attributes:
-
APD–ACES printing density.
-
DENSIOMETRY–A dict with relevant density measures.
-
DENSITY_MEASURE–The available density measures.
-
STATUS_A–Status A density measure.
-
STATUS_M–Status M density measure.
APD
module-attribute
APD = np.asarray(
colour.MultiSpectralDistributions(APD).align(SPECTRAL_SHAPE).values,
dtype=DEFAULT_DTYPE,
)
ACES printing density.
DENSIOMETRY
module-attribute
A dict with relevant density measures.
DENSITY_MEASURE
module-attribute
DENSITY_MEASURE = Literal['status_a', 'status_m', 'apd', 'absolute', 'bw']
The available density measures.
STATUS_A
module-attribute
STATUS_A = np.asarray(interpolate_status_density(STATUS_A))
Status A density measure.
STATUS_M
module-attribute
STATUS_M = np.asarray(interpolate_status_density(STATUS_M))
Status M density measure.
adx16_decode
Converts from ADX16 values to absolute APD density. Instead of as 16 bit int the output is expected as a float in the range [0, 1].
Parameters:
-
(adxndarray) –ADX16 values in the range [0, 1].
-
(apd_minndarray | None, default:None) –The D-min values of the film that has been compensated for.
-
(scalingfloat, default:1.0) –Linear scaling removed from the values. For 1.0 it is ADX16-like and for 4.0 it is ADX10-like.
Returns:
-
ndarray–Absolute APD density values.
adx16_encode
Converts from absolute APD density values to ADX16 values. Instead of as 16 bit int, the output is encoded as a float in the range [0, 1].
Parameters:
-
(apdndarray) –The density values.
-
(apd_minndarray | None, default:None) –The D-min values of the film to compensate for.
-
(scalingfloat, default:1.0) –Linear scaling applied to the values. For 1.0 it is ADX16-like and for 4.0 it is ADX10-like.
Returns:
-
ndarray–ADX-like encoded values in the [0, 1] range.
compute_printer_lights
compute_printer_lights() -> tuple[ndarray, ndarray]
Converts the APD printer light to a three light matrix by splitting into separate red, green, and blue lights.
construct_spectral_density
construct_spectral_density(ref_density: SpectralDistribution, sigma=25) -> ndarray
Split single density curve into separate layers using local extrema.
interpolate_status_density
interpolate_status_density(
status: list[dict[int, float]], spectral_shape=SPECTRAL_SHAPE
) -> ndarray
Converts logarithmic status density values to a normalized linear status density matrix.
output_to_density
output_to_density(
y: ndarray,
a: ndarray,
b: ndarray,
x0: ndarray | None = None,
method: str = "lm",
) -> ndarray
Numerically invert the mapping
y = (10 ** -(x @ a.T)) @ b
to recover x.
Parameters
y : array-like, shape (p,) Output vector. a : array-like, shape (m, n) Density matrix (used in forward map). b : array-like, shape (m, p) Output matrix (used in forward map). x0 : array-like, shape (n,), optional Initial guess for x. Defaults to zeros. method : str, optional Least-squares solver method: 'lm', 'trf', or 'dogbox'.
Returns
x : ndarray, shape (n,) Estimated vector such that (10 ** -(x @ a.T)) @ b ≈ y
wavelength_argmax
wavelength_argmax(distribution: SpectralDistribution, low=None, high=None) -> int
Gets the argmax of a spectral distribution.
wavelength_argmin
wavelength_argmin(distribution: SpectralDistribution, low=None, high=None) -> int
Gets the argmax of a spectral distribution.