#! /usr/bin/python3 # Last edited on 2025-08-18 21:01:04 by stolfi # Reads a set of multispectral images and spectral analysis data and # splits the former into an affine combination of specified inks. Then # writes images with those ink components. # import sys, re, os from math import sqrt, sin, cos, log, exp, floor, pi, inf import numpy def main(): A = numpy.array \ ( [ [ 10, 20, 30, ], [ 10, 30, 20, ] ] ) B = numpy.linalg.pinv(A) sys.stderr.write(f"B.shape = {numpy.shape(B)}\n") sys.stderr.write(f"B =\n{B}\n") a = numpy.array([ 10, 20, 30 ]) b = numpy.array([ 10, 30, 20 ]) c = a + b d = c + numpy.array([ -50, 10, 10 ]) for x in (a, b, c, d,): sys.stderr.write(f"x = {x}\n") y = x @ B sys.stderr.write(f"y = {y}\n") sys.stderr.write(f"\n") return 0 # ---------------------------------------------------------------------- main()