@photivra/engine 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +401 -6
- package/CITATION.cff +1 -1
- package/NODE_SUPPORT.md +64 -12
- package/README.md +301 -182
- package/SECURITY.md +37 -28
- package/THIRD_PARTY.md +148 -4
- package/dist/camera/equivalent-focal-length.d.ts +13 -14
- package/dist/camera/equivalent-focal-length.js +15 -13
- package/dist/camera/equivalent-focal-length.js.map +1 -1
- package/dist/camera/field-of-view.d.ts +30 -19
- package/dist/camera/field-of-view.js +67 -18
- package/dist/camera/field-of-view.js.map +1 -1
- package/dist/camera/lens-projection.d.ts +170 -0
- package/dist/camera/lens-projection.js +444 -0
- package/dist/camera/lens-projection.js.map +1 -0
- package/dist/camera/projected-object-size.d.ts +10 -11
- package/dist/camera/projected-object-size.js +12 -10
- package/dist/camera/projected-object-size.js.map +1 -1
- package/dist/capture/capture-export-metadata.d.ts +9 -10
- package/dist/capture/capture-export-metadata.js +8 -5
- package/dist/capture/capture-export-metadata.js.map +1 -1
- package/dist/capture/dng-import.d.ts +91 -0
- package/dist/capture/dng-import.js +343 -0
- package/dist/capture/dng-import.js.map +1 -0
- package/dist/capture/environment-raw-producer.d.ts +37 -17
- package/dist/capture/environment-raw-producer.js +43 -19
- package/dist/capture/environment-raw-producer.js.map +1 -1
- package/dist/capture/export-jpeg.d.ts +35 -4
- package/dist/capture/export-jpeg.js +133 -47
- package/dist/capture/export-jpeg.js.map +1 -1
- package/dist/capture/export-tiff.d.ts +48 -24
- package/dist/capture/export-tiff.js +91 -31
- package/dist/capture/export-tiff.js.map +1 -1
- package/dist/capture/focus-control.d.ts +42 -65
- package/dist/capture/focus-control.js +56 -75
- package/dist/capture/focus-control.js.map +1 -1
- package/dist/capture/host-yield-cadence.d.ts +25 -0
- package/dist/capture/host-yield-cadence.js +25 -0
- package/dist/capture/host-yield-cadence.js.map +1 -0
- package/dist/capture/linear-encoding.d.ts +14 -12
- package/dist/capture/linear-encoding.js +14 -13
- package/dist/capture/linear-encoding.js.map +1 -1
- package/dist/capture/lossless-jpeg.d.ts +27 -0
- package/dist/capture/lossless-jpeg.js +237 -0
- package/dist/capture/lossless-jpeg.js.map +1 -0
- package/dist/capture/native-environment-lean.d.ts +227 -0
- package/dist/capture/native-environment-lean.js +974 -0
- package/dist/capture/native-environment-lean.js.map +1 -0
- package/dist/capture/native-environment-optical-stage.d.ts +97 -0
- package/dist/capture/native-environment-optical-stage.js +340 -0
- package/dist/capture/native-environment-optical-stage.js.map +1 -0
- package/dist/capture/native-environment-raw.d.ts +140 -6
- package/dist/capture/native-environment-raw.js +435 -34
- package/dist/capture/native-environment-raw.js.map +1 -1
- package/dist/capture/native-raw-development.d.ts +118 -5
- package/dist/capture/native-raw-development.js +224 -59
- package/dist/capture/native-raw-development.js.map +1 -1
- package/dist/capture/native-raw-dng.d.ts +60 -0
- package/dist/capture/native-raw-dng.js +167 -0
- package/dist/capture/native-raw-dng.js.map +1 -0
- package/dist/capture/native-raw.d.ts +67 -10
- package/dist/capture/native-raw.js +90 -24
- package/dist/capture/native-raw.js.map +1 -1
- package/dist/capture/packed-sensor-raw.d.ts +160 -0
- package/dist/capture/packed-sensor-raw.js +221 -0
- package/dist/capture/packed-sensor-raw.js.map +1 -0
- package/dist/capture/photographic-export.d.ts +58 -35
- package/dist/capture/photographic-export.js +177 -70
- package/dist/capture/photographic-export.js.map +1 -1
- package/dist/capture/raw-development-kernel.d.ts +52 -0
- package/dist/capture/raw-development-kernel.js +88 -0
- package/dist/capture/raw-development-kernel.js.map +1 -0
- package/dist/capture/raw-frame-limits.d.ts +7 -7
- package/dist/capture/raw-frame-limits.js +7 -6
- package/dist/capture/raw-frame-limits.js.map +1 -1
- package/dist/capture/raw-frame-reconstruction.d.ts +8 -9
- package/dist/capture/raw-frame-reconstruction.js +9 -8
- package/dist/capture/raw-frame-reconstruction.js.map +1 -1
- package/dist/capture/raw-white-level.d.ts +55 -0
- package/dist/capture/raw-white-level.js +165 -0
- package/dist/capture/raw-white-level.js.map +1 -0
- package/dist/capture/release-sequence.d.ts +5 -7
- package/dist/capture/release-sequence.js +15 -13
- package/dist/capture/release-sequence.js.map +1 -1
- package/dist/capture/sensor-raw-frame.d.ts +5 -6
- package/dist/capture/sensor-raw-frame.js +26 -9
- package/dist/capture/sensor-raw-frame.js.map +1 -1
- package/dist/capture/sensor-raw-producer.d.ts +21 -13
- package/dist/capture/sensor-raw-producer.js +86 -25
- package/dist/capture/sensor-raw-producer.js.map +1 -1
- package/dist/capture/simulated-capture.d.ts +15 -16
- package/dist/capture/simulated-capture.js +22 -12
- package/dist/capture/simulated-capture.js.map +1 -1
- package/dist/color/camera-color-matrix.d.ts +69 -0
- package/dist/color/camera-color-matrix.js +132 -0
- package/dist/color/camera-color-matrix.js.map +1 -0
- package/dist/color/capture-color.d.ts +17 -10
- package/dist/color/capture-color.js +50 -17
- package/dist/color/capture-color.js.map +1 -1
- package/dist/color/chromatic-adaptation.d.ts +63 -0
- package/dist/color/chromatic-adaptation.js +91 -0
- package/dist/color/chromatic-adaptation.js.map +1 -0
- package/dist/color/color-difference.d.ts +104 -0
- package/dist/color/color-difference.js +205 -0
- package/dist/color/color-difference.js.map +1 -0
- package/dist/color/color-matching-functions.d.ts +168 -0
- package/dist/color/color-matching-functions.js +309 -0
- package/dist/color/color-matching-functions.js.map +1 -0
- package/dist/color/colorimetry-math.d.ts +52 -0
- package/dist/color/colorimetry-math.js +144 -0
- package/dist/color/colorimetry-math.js.map +1 -0
- package/dist/color/gamut-mapping.d.ts +54 -0
- package/dist/color/gamut-mapping.js +107 -0
- package/dist/color/gamut-mapping.js.map +1 -0
- package/dist/color/illuminants.d.ts +182 -0
- package/dist/color/illuminants.js +434 -0
- package/dist/color/illuminants.js.map +1 -0
- package/dist/color/rgb-color-spaces.d.ts +79 -0
- package/dist/color/rgb-color-spaces.js +115 -0
- package/dist/color/rgb-color-spaces.js.map +1 -0
- package/dist/color/sensor-color-development.d.ts +33 -11
- package/dist/color/sensor-color-development.js +104 -30
- package/dist/color/sensor-color-development.js.map +1 -1
- package/dist/color/srgb-icc.d.ts +9 -2
- package/dist/color/srgb-icc.js +16 -5
- package/dist/color/srgb-icc.js.map +1 -1
- package/dist/color/srgb-transfer.d.ts +1 -2
- package/dist/color/srgb-transfer.js +1 -1
- package/dist/color/srgb-transfer.js.map +1 -1
- package/dist/color/white-balance.d.ts +68 -19
- package/dist/color/white-balance.js +168 -35
- package/dist/color/white-balance.js.map +1 -1
- package/dist/composition/image-formation-plan.d.ts +152 -128
- package/dist/composition/image-formation-plan.js +292 -138
- package/dist/composition/image-formation-plan.js.map +1 -1
- package/dist/composition/plan-consumer.d.ts +6 -7
- package/dist/composition/plan-consumer.js +14 -11
- package/dist/composition/plan-consumer.js.map +1 -1
- package/dist/core/calculation-result.d.ts +21 -14
- package/dist/core/calculation-result.js +209 -11
- package/dist/core/calculation-result.js.map +1 -1
- package/dist/core/canonical-json.d.ts +13 -8
- package/dist/core/canonical-json.js +34 -15
- package/dist/core/canonical-json.js.map +1 -1
- package/dist/core/configuration-error.d.ts +5 -4
- package/dist/core/configuration-error.js +5 -3
- package/dist/core/configuration-error.js.map +1 -1
- package/dist/core/evidence-provenance.d.ts +12 -12
- package/dist/core/evidence-provenance.js +10 -9
- package/dist/core/evidence-provenance.js.map +1 -1
- package/dist/core/image-formation.d.ts +11 -10
- package/dist/core/image-formation.js +11 -9
- package/dist/core/image-formation.js.map +1 -1
- package/dist/core/owned-data.d.ts +9 -17
- package/dist/core/owned-data.js +9 -16
- package/dist/core/owned-data.js.map +1 -1
- package/dist/core/portable-math.d.ts +15 -0
- package/dist/core/portable-math.js +56 -0
- package/dist/core/portable-math.js.map +1 -0
- package/dist/core/record-validation.d.ts +48 -9
- package/dist/core/record-validation.js +93 -19
- package/dist/core/record-validation.js.map +1 -1
- package/dist/core/scientific-assurance.d.ts +16 -14
- package/dist/core/scientific-assurance.js +22 -18
- package/dist/core/scientific-assurance.js.map +1 -1
- package/dist/core/spectral-composition.d.ts +13 -14
- package/dist/core/spectral-composition.js +30 -27
- package/dist/core/spectral-composition.js.map +1 -1
- package/dist/core/spectral.d.ts +5 -6
- package/dist/core/spectral.js +9 -7
- package/dist/core/spectral.js.map +1 -1
- package/dist/core/validation.d.ts +3 -6
- package/dist/core/validation.js +3 -5
- package/dist/core/validation.js.map +1 -1
- package/dist/core/version.d.ts +6 -6
- package/dist/core/version.js +6 -5
- package/dist/core/version.js.map +1 -1
- package/dist/equipment/exposure-capabilities.d.ts +10 -10
- package/dist/equipment/exposure-capabilities.js +40 -30
- package/dist/equipment/exposure-capabilities.js.map +1 -1
- package/dist/equipment/generic-tier-assets.d.ts +13 -6
- package/dist/equipment/generic-tier-assets.js +34 -15
- package/dist/equipment/generic-tier-assets.js.map +1 -1
- package/dist/equipment/generic-tier-presets.d.ts +5 -6
- package/dist/equipment/generic-tier-presets.js +15 -13
- package/dist/equipment/generic-tier-presets.js.map +1 -1
- package/dist/equipment/iso-capabilities.d.ts +21 -22
- package/dist/equipment/iso-capabilities.js +49 -44
- package/dist/equipment/iso-capabilities.js.map +1 -1
- package/dist/equipment/metering-capabilities.d.ts +5 -6
- package/dist/equipment/metering-capabilities.js +22 -19
- package/dist/equipment/metering-capabilities.js.map +1 -1
- package/dist/equipment/release-capabilities.d.ts +3 -4
- package/dist/equipment/release-capabilities.js +18 -14
- package/dist/equipment/release-capabilities.js.map +1 -1
- package/dist/exposure/exposure-duration-control.d.ts +19 -17
- package/dist/exposure/exposure-duration-control.js +27 -23
- package/dist/exposure/exposure-duration-control.js.map +1 -1
- package/dist/exposure/exposure-mode-resolver.d.ts +42 -39
- package/dist/exposure/exposure-mode-resolver.js +127 -82
- package/dist/exposure/exposure-mode-resolver.js.map +1 -1
- package/dist/exposure/exposure.d.ts +17 -16
- package/dist/exposure/exposure.js +22 -15
- package/dist/exposure/exposure.js.map +1 -1
- package/dist/exposure/flash-ttl.d.ts +135 -0
- package/dist/exposure/flash-ttl.js +193 -0
- package/dist/exposure/flash-ttl.js.map +1 -0
- package/dist/exposure/flash.d.ts +144 -36
- package/dist/exposure/flash.js +259 -59
- package/dist/exposure/flash.js.map +1 -1
- package/dist/exposure/metering-scene-radiance.d.ts +10 -10
- package/dist/exposure/metering-scene-radiance.js +42 -23
- package/dist/exposure/metering-scene-radiance.js.map +1 -1
- package/dist/exposure/metering-target.d.ts +8 -8
- package/dist/exposure/metering-target.js +30 -20
- package/dist/exposure/metering-target.js.map +1 -1
- package/dist/exposure/metering-temporal.d.ts +16 -15
- package/dist/exposure/metering-temporal.js +41 -19
- package/dist/exposure/metering-temporal.js.map +1 -1
- package/dist/exposure/metering.d.ts +64 -17
- package/dist/exposure/metering.js +159 -30
- package/dist/exposure/metering.js.map +1 -1
- package/dist/exposure/program-line.d.ts +5 -5
- package/dist/exposure/program-line.js +20 -13
- package/dist/exposure/program-line.js.map +1 -1
- package/dist/facade/camera-preset.d.ts +8 -0
- package/dist/facade/camera-preset.js +102 -0
- package/dist/facade/camera-preset.js.map +1 -0
- package/dist/facade/chart-radiance-batch.d.ts +57 -0
- package/dist/facade/chart-radiance-batch.js +121 -0
- package/dist/facade/chart-radiance-batch.js.map +1 -0
- package/dist/facade/chart-scenes.d.ts +177 -0
- package/dist/facade/chart-scenes.js +232 -0
- package/dist/facade/chart-scenes.js.map +1 -0
- package/dist/facade/host-yield.d.ts +7 -0
- package/dist/facade/host-yield.js +23 -0
- package/dist/facade/host-yield.js.map +1 -0
- package/dist/facade/scene-radiance.d.ts +117 -0
- package/dist/facade/scene-radiance.js +205 -0
- package/dist/facade/scene-radiance.js.map +1 -0
- package/dist/facade/simulate-capture.d.ts +284 -0
- package/dist/facade/simulate-capture.js +1026 -0
- package/dist/facade/simulate-capture.js.map +1 -0
- package/dist/gpu/chart-radiance-gpu.d.ts +17 -0
- package/dist/gpu/chart-radiance-gpu.js +176 -0
- package/dist/gpu/chart-radiance-gpu.js.map +1 -0
- package/dist/gpu/image-kernel-accelerator.d.ts +132 -0
- package/dist/gpu/image-kernel-accelerator.js +720 -0
- package/dist/gpu/image-kernel-accelerator.js.map +1 -0
- package/dist/gpu/image-kernel-execution.d.ts +92 -0
- package/dist/gpu/image-kernel-execution.js +84 -0
- package/dist/gpu/image-kernel-execution.js.map +1 -0
- package/dist/gpu/sensor-stage-gpu.d.ts +44 -0
- package/dist/gpu/sensor-stage-gpu.js +317 -0
- package/dist/gpu/sensor-stage-gpu.js.map +1 -0
- package/dist/gpu/temporal-sum-gpu.d.ts +23 -0
- package/dist/gpu/temporal-sum-gpu.js +150 -0
- package/dist/gpu/temporal-sum-gpu.js.map +1 -0
- package/dist/gpu/webgpu-runtime.d.ts +63 -0
- package/dist/gpu/webgpu-runtime.js +215 -0
- package/dist/gpu/webgpu-runtime.js.map +1 -0
- package/dist/gpu/wgsl-chart-kernel.d.ts +30 -0
- package/dist/gpu/wgsl-chart-kernel.js +165 -0
- package/dist/gpu/wgsl-chart-kernel.js.map +1 -0
- package/dist/gpu/wgsl-kernels.d.ts +53 -0
- package/dist/gpu/wgsl-kernels.js +365 -0
- package/dist/gpu/wgsl-kernels.js.map +1 -0
- package/dist/gpu/wgsl-sensor-kernel.d.ts +64 -0
- package/dist/gpu/wgsl-sensor-kernel.js +409 -0
- package/dist/gpu/wgsl-sensor-kernel.js.map +1 -0
- package/dist/index.d.ts +89 -25
- package/dist/index.js +59 -15
- package/dist/index.js.map +1 -1
- package/dist/motion/camera-rotation.d.ts +92 -40
- package/dist/motion/camera-rotation.js +84 -47
- package/dist/motion/camera-rotation.js.map +1 -1
- package/dist/motion/capture-rotation-inverse-mapping.d.ts +37 -34
- package/dist/motion/capture-rotation-inverse-mapping.js +32 -24
- package/dist/motion/capture-rotation-inverse-mapping.js.map +1 -1
- package/dist/motion/capture-rotation-temporal-quadrature.d.ts +39 -35
- package/dist/motion/capture-rotation-temporal-quadrature.js +37 -28
- package/dist/motion/capture-rotation-temporal-quadrature.js.map +1 -1
- package/dist/motion/capture-rotation-trajectory.d.ts +32 -28
- package/dist/motion/capture-rotation-trajectory.js +36 -26
- package/dist/motion/capture-rotation-trajectory.js.map +1 -1
- package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts +23 -21
- package/dist/motion/capture-translation-parallax-temporal-quadrature.js +33 -14
- package/dist/motion/capture-translation-parallax-temporal-quadrature.js.map +1 -1
- package/dist/motion/extended-object-projection.d.ts +19 -16
- package/dist/motion/extended-object-projection.js +38 -18
- package/dist/motion/extended-object-projection.js.map +1 -1
- package/dist/motion/projected-motion.d.ts +18 -17
- package/dist/motion/projected-motion.js +25 -17
- package/dist/motion/projected-motion.js.map +1 -1
- package/dist/motion/temporal-exposure-sum.d.ts +55 -0
- package/dist/motion/temporal-exposure-sum.js +141 -0
- package/dist/motion/temporal-exposure-sum.js.map +1 -0
- package/dist/motion/video-sequence.d.ts +111 -0
- package/dist/motion/video-sequence.js +179 -0
- package/dist/motion/video-sequence.js.map +1 -0
- package/dist/optics/aperture.d.ts +14 -15
- package/dist/optics/aperture.js +13 -11
- package/dist/optics/aperture.js.map +1 -1
- package/dist/optics/atmospheric-haze.d.ts +83 -0
- package/dist/optics/atmospheric-haze.js +113 -0
- package/dist/optics/atmospheric-haze.js.map +1 -0
- package/dist/optics/brown-conrady-distortion.d.ts +116 -0
- package/dist/optics/brown-conrady-distortion.js +291 -0
- package/dist/optics/brown-conrady-distortion.js.map +1 -0
- package/dist/optics/circle-of-confusion.d.ts +10 -10
- package/dist/optics/circle-of-confusion.js +15 -11
- package/dist/optics/circle-of-confusion.js.map +1 -1
- package/dist/optics/complex-pupil-psf.d.ts +64 -33
- package/dist/optics/complex-pupil-psf.js +190 -98
- package/dist/optics/complex-pupil-psf.js.map +1 -1
- package/dist/optics/depth-of-field.d.ts +25 -15
- package/dist/optics/depth-of-field.js +67 -27
- package/dist/optics/depth-of-field.js.map +1 -1
- package/dist/optics/diffraction.d.ts +14 -13
- package/dist/optics/diffraction.js +14 -10
- package/dist/optics/diffraction.js.map +1 -1
- package/dist/optics/focus-breathing.d.ts +88 -27
- package/dist/optics/focus-breathing.js +114 -23
- package/dist/optics/focus-breathing.js.map +1 -1
- package/dist/optics/focus-state.d.ts +18 -18
- package/dist/optics/focus-state.js +21 -15
- package/dist/optics/focus-state.js.map +1 -1
- package/dist/optics/front-of-lens-filter.d.ts +45 -14
- package/dist/optics/front-of-lens-filter.js +259 -88
- package/dist/optics/front-of-lens-filter.js.map +1 -1
- package/dist/optics/illumination-vignetting.d.ts +16 -17
- package/dist/optics/illumination-vignetting.js +40 -17
- package/dist/optics/illumination-vignetting.js.map +1 -1
- package/dist/optics/irradiance-convolution.d.ts +59 -0
- package/dist/optics/irradiance-convolution.js +138 -0
- package/dist/optics/irradiance-convolution.js.map +1 -0
- package/dist/optics/lateral-chromatic-aberration.d.ts +33 -30
- package/dist/optics/lateral-chromatic-aberration.js +33 -23
- package/dist/optics/lateral-chromatic-aberration.js.map +1 -1
- package/dist/optics/lens-psf-kernels.d.ts +89 -0
- package/dist/optics/lens-psf-kernels.js +175 -0
- package/dist/optics/lens-psf-kernels.js.map +1 -0
- package/dist/optics/lens-psf-profile.d.ts +78 -46
- package/dist/optics/lens-psf-profile.js +335 -124
- package/dist/optics/lens-psf-profile.js.map +1 -1
- package/dist/optics/longitudinal-chromatic-aberration.d.ts +102 -0
- package/dist/optics/longitudinal-chromatic-aberration.js +210 -0
- package/dist/optics/longitudinal-chromatic-aberration.js.map +1 -0
- package/dist/optics/polygon-diffraction.d.ts +80 -23
- package/dist/optics/polygon-diffraction.js +130 -25
- package/dist/optics/polygon-diffraction.js.map +1 -1
- package/dist/optics/profile-contract.d.ts +5 -6
- package/dist/optics/profile-contract.js +14 -11
- package/dist/optics/profile-contract.js.map +1 -1
- package/dist/optics/psf-foundation.d.ts +23 -23
- package/dist/optics/psf-foundation.js +24 -21
- package/dist/optics/psf-foundation.js.map +1 -1
- package/dist/optics/pupil-vignetting.d.ts +118 -0
- package/dist/optics/pupil-vignetting.js +264 -0
- package/dist/optics/pupil-vignetting.js.map +1 -0
- package/dist/optics/radial-distortion.d.ts +34 -33
- package/dist/optics/radial-distortion.js +37 -30
- package/dist/optics/radial-distortion.js.map +1 -1
- package/dist/optics/scene-to-sensor-irradiance.d.ts +47 -33
- package/dist/optics/scene-to-sensor-irradiance.js +73 -45
- package/dist/optics/scene-to-sensor-irradiance.js.map +1 -1
- package/dist/optics/scene-to-sensor-quadrature.d.ts +23 -18
- package/dist/optics/scene-to-sensor-quadrature.js +16 -11
- package/dist/optics/scene-to-sensor-quadrature.js.map +1 -1
- package/dist/optics/sensor-aperture-rays.d.ts +20 -4
- package/dist/optics/sensor-aperture-rays.js +32 -14
- package/dist/optics/sensor-aperture-rays.js.map +1 -1
- package/dist/optics/sensor-environment-query.d.ts +81 -16
- package/dist/optics/sensor-environment-query.js +145 -12
- package/dist/optics/sensor-environment-query.js.map +1 -1
- package/dist/optics/sensor-psf-quadrature.d.ts +12 -10
- package/dist/optics/sensor-psf-quadrature.js +18 -11
- package/dist/optics/sensor-psf-quadrature.js.map +1 -1
- package/dist/optics/sensor-psf-support.d.ts +8 -6
- package/dist/optics/sensor-psf-support.js +8 -5
- package/dist/optics/sensor-psf-support.js.map +1 -1
- package/dist/optics/stray-light.d.ts +22 -19
- package/dist/optics/stray-light.js +18 -12
- package/dist/optics/stray-light.js.map +1 -1
- package/dist/optics/thin-lens.d.ts +10 -9
- package/dist/optics/thin-lens.js +12 -8
- package/dist/optics/thin-lens.js.map +1 -1
- package/dist/optics/zernike-wavefront.d.ts +154 -0
- package/dist/optics/zernike-wavefront.js +352 -0
- package/dist/optics/zernike-wavefront.js.map +1 -0
- package/dist/output/capture-corrected-sdr.d.ts +16 -8
- package/dist/output/capture-corrected-sdr.js +16 -8
- package/dist/output/capture-corrected-sdr.js.map +1 -1
- package/dist/output/capture-geometry.d.ts +34 -36
- package/dist/output/capture-geometry.js +52 -32
- package/dist/output/capture-geometry.js.map +1 -1
- package/dist/output/capture-sdr.d.ts +7 -6
- package/dist/output/capture-sdr.js +11 -8
- package/dist/output/capture-sdr.js.map +1 -1
- package/dist/output/crop.d.ts +22 -6
- package/dist/output/crop.js +40 -6
- package/dist/output/crop.js.map +1 -1
- package/dist/output/geometric-transforms.d.ts +60 -23
- package/dist/output/geometric-transforms.js +111 -24
- package/dist/output/geometric-transforms.js.map +1 -1
- package/dist/output/lens-corrections.d.ts +27 -19
- package/dist/output/lens-corrections.js +29 -13
- package/dist/output/lens-corrections.js.map +1 -1
- package/dist/output/native-capture-sdr.d.ts +71 -16
- package/dist/output/native-capture-sdr.js +190 -33
- package/dist/output/native-capture-sdr.js.map +1 -1
- package/dist/output/png-encoder.d.ts +65 -0
- package/dist/output/png-encoder.js +461 -0
- package/dist/output/png-encoder.js.map +1 -0
- package/dist/output/print-contrast-reference.d.ts +10 -9
- package/dist/output/print-contrast-reference.js +10 -8
- package/dist/output/print-contrast-reference.js.map +1 -1
- package/dist/output/print-detail.d.ts +18 -17
- package/dist/output/print-detail.js +12 -10
- package/dist/output/print-detail.js.map +1 -1
- package/dist/output/print-jpeg.d.ts +26 -5
- package/dist/output/print-jpeg.js +117 -50
- package/dist/output/print-jpeg.js.map +1 -1
- package/dist/output/print-plan.d.ts +19 -19
- package/dist/output/print-plan.js +11 -10
- package/dist/output/print-plan.js.map +1 -1
- package/dist/output/print-region-statistics.d.ts +14 -15
- package/dist/output/print-region-statistics.js +11 -11
- package/dist/output/print-region-statistics.js.map +1 -1
- package/dist/output/sdr-rendering.d.ts +48 -10
- package/dist/output/sdr-rendering.js +114 -25
- package/dist/output/sdr-rendering.js.map +1 -1
- package/dist/output/subject-framing-crop.d.ts +6 -10
- package/dist/output/subject-framing-crop.js +23 -13
- package/dist/output/subject-framing-crop.js.map +1 -1
- package/dist/processing/demosaic.d.ts +90 -0
- package/dist/processing/demosaic.js +275 -0
- package/dist/processing/demosaic.js.map +1 -0
- package/dist/processing/denoise.d.ts +68 -0
- package/dist/processing/denoise.js +214 -0
- package/dist/processing/denoise.js.map +1 -0
- package/dist/processing/focus-stacking.d.ts +17 -0
- package/dist/processing/focus-stacking.js +80 -0
- package/dist/processing/focus-stacking.js.map +1 -0
- package/dist/processing/hdr.d.ts +54 -0
- package/dist/processing/hdr.js +172 -0
- package/dist/processing/hdr.js.map +1 -0
- package/dist/processing/image-ops.d.ts +66 -0
- package/dist/processing/image-ops.js +192 -0
- package/dist/processing/image-ops.js.map +1 -0
- package/dist/processing/panorama.d.ts +51 -0
- package/dist/processing/panorama.js +305 -0
- package/dist/processing/panorama.js.map +1 -0
- package/dist/processing/processing-task.d.ts +85 -0
- package/dist/processing/processing-task.js +164 -0
- package/dist/processing/processing-task.js.map +1 -0
- package/dist/processing/tone-mapping.d.ts +69 -0
- package/dist/processing/tone-mapping.js +310 -0
- package/dist/processing/tone-mapping.js.map +1 -0
- package/dist/schema/camera.d.ts +5 -4
- package/dist/schema/illumination-spectral.d.ts +13 -19
- package/dist/schema/illumination-spectral.js +23 -19
- package/dist/schema/illumination-spectral.js.map +1 -1
- package/dist/schema/illumination-temporal.d.ts +12 -15
- package/dist/schema/illumination-temporal.js +43 -28
- package/dist/schema/illumination-temporal.js.map +1 -1
- package/dist/schema/illumination.d.ts +5 -4
- package/dist/schema/illumination.js +55 -20
- package/dist/schema/illumination.js.map +1 -1
- package/dist/schema/scene-radiance-temporal.d.ts +9 -11
- package/dist/schema/scene-radiance-temporal.js +26 -23
- package/dist/schema/scene-radiance-temporal.js.map +1 -1
- package/dist/schema/scene-radiance.d.ts +17 -17
- package/dist/schema/scene-radiance.js +56 -34
- package/dist/schema/scene-radiance.js.map +1 -1
- package/dist/schema/scene.d.ts +14 -13
- package/dist/schema/validation.d.ts +0 -1
- package/dist/schema/validation.js +17 -15
- package/dist/schema/validation.js.map +1 -1
- package/dist/sensor/accumulated-charge.d.ts +45 -64
- package/dist/sensor/accumulated-charge.js +41 -47
- package/dist/sensor/accumulated-charge.js.map +1 -1
- package/dist/sensor/architecture.d.ts +22 -25
- package/dist/sensor/architecture.js +17 -16
- package/dist/sensor/architecture.js.map +1 -1
- package/dist/sensor/camera-saturation-capacity.d.ts +21 -28
- package/dist/sensor/camera-saturation-capacity.js +36 -34
- package/dist/sensor/camera-saturation-capacity.js.map +1 -1
- package/dist/sensor/capture-color-sampling-binding.d.ts +46 -51
- package/dist/sensor/capture-color-sampling-binding.js +39 -41
- package/dist/sensor/capture-color-sampling-binding.js.map +1 -1
- package/dist/sensor/capture-mode-timing.d.ts +8 -9
- package/dist/sensor/capture-mode-timing.js +24 -21
- package/dist/sensor/capture-mode-timing.js.map +1 -1
- package/dist/sensor/capture-mode.d.ts +28 -30
- package/dist/sensor/capture-mode.js +33 -31
- package/dist/sensor/capture-mode.js.map +1 -1
- package/dist/sensor/color-sampling.d.ts +30 -33
- package/dist/sensor/color-sampling.js +32 -37
- package/dist/sensor/color-sampling.js.map +1 -1
- package/dist/sensor/constant-rate-temporal-integration.d.ts +19 -23
- package/dist/sensor/constant-rate-temporal-integration.js +28 -26
- package/dist/sensor/constant-rate-temporal-integration.js.map +1 -1
- package/dist/sensor/dark-current.d.ts +53 -49
- package/dist/sensor/dark-current.js +87 -46
- package/dist/sensor/dark-current.js.map +1 -1
- package/dist/sensor/environment-photo-signal.d.ts +71 -30
- package/dist/sensor/environment-photo-signal.js +127 -46
- package/dist/sensor/environment-photo-signal.js.map +1 -1
- package/dist/sensor/eqe-electron-rate.d.ts +14 -13
- package/dist/sensor/eqe-electron-rate.js +34 -14
- package/dist/sensor/eqe-electron-rate.js.map +1 -1
- package/dist/sensor/eqe-local-exposure.d.ts +24 -24
- package/dist/sensor/eqe-local-exposure.js +15 -11
- package/dist/sensor/eqe-local-exposure.js.map +1 -1
- package/dist/sensor/eqe-temporal-exposure.d.ts +11 -11
- package/dist/sensor/eqe-temporal-exposure.js +15 -10
- package/dist/sensor/eqe-temporal-exposure.js.map +1 -1
- package/dist/sensor/exposure-window.d.ts +48 -34
- package/dist/sensor/exposure-window.js +77 -36
- package/dist/sensor/exposure-window.js.map +1 -1
- package/dist/sensor/fixed-pattern-noise.d.ts +108 -0
- package/dist/sensor/fixed-pattern-noise.js +166 -0
- package/dist/sensor/fixed-pattern-noise.js.map +1 -0
- package/dist/sensor/iso-gain.d.ts +44 -0
- package/dist/sensor/iso-gain.js +119 -0
- package/dist/sensor/iso-gain.js.map +1 -0
- package/dist/sensor/iso-signal-chain.d.ts +25 -48
- package/dist/sensor/iso-signal-chain.js +52 -66
- package/dist/sensor/iso-signal-chain.js.map +1 -1
- package/dist/sensor/local-exposure-binding.d.ts +21 -21
- package/dist/sensor/local-exposure-binding.js +22 -18
- package/dist/sensor/local-exposure-binding.js.map +1 -1
- package/dist/sensor/optical-stack.d.ts +36 -40
- package/dist/sensor/optical-stack.js +34 -37
- package/dist/sensor/optical-stack.js.map +1 -1
- package/dist/sensor/photon-energy.d.ts +22 -28
- package/dist/sensor/photon-energy.js +42 -34
- package/dist/sensor/photon-energy.js.map +1 -1
- package/dist/sensor/physical-charge-capacity.d.ts +20 -30
- package/dist/sensor/physical-charge-capacity.js +35 -36
- package/dist/sensor/physical-charge-capacity.js.map +1 -1
- package/dist/sensor/pixel-pitch.d.ts +2 -3
- package/dist/sensor/pixel-pitch.js +4 -2
- package/dist/sensor/pixel-pitch.js.map +1 -1
- package/dist/sensor/radiometry-readiness.d.ts +13 -15
- package/dist/sensor/radiometry-readiness.js +20 -17
- package/dist/sensor/radiometry-readiness.js.map +1 -1
- package/dist/sensor/raw-readout.d.ts +173 -83
- package/dist/sensor/raw-readout.js +425 -160
- package/dist/sensor/raw-readout.js.map +1 -1
- package/dist/sensor/raw-reconstruction.d.ts +112 -44
- package/dist/sensor/raw-reconstruction.js +200 -47
- package/dist/sensor/raw-reconstruction.js.map +1 -1
- package/dist/sensor/readout-exposure-linkage.d.ts +103 -34
- package/dist/sensor/readout-exposure-linkage.js +125 -27
- package/dist/sensor/readout-exposure-linkage.js.map +1 -1
- package/dist/sensor/readout-timing.d.ts +43 -44
- package/dist/sensor/readout-timing.js +38 -30
- package/dist/sensor/readout-timing.js.map +1 -1
- package/dist/sensor/response-application-compatibility.d.ts +21 -28
- package/dist/sensor/response-application-compatibility.js +35 -34
- package/dist/sensor/response-application-compatibility.js.map +1 -1
- package/dist/sensor/response-operating-range.d.ts +26 -35
- package/dist/sensor/response-operating-range.js +40 -39
- package/dist/sensor/response-operating-range.js.map +1 -1
- package/dist/sensor/responsivity-photocurrent.d.ts +21 -29
- package/dist/sensor/responsivity-photocurrent.js +57 -40
- package/dist/sensor/responsivity-photocurrent.js.map +1 -1
- package/dist/sensor/sampling-aperture.d.ts +21 -25
- package/dist/sensor/sampling-aperture.js +29 -28
- package/dist/sensor/sampling-aperture.js.map +1 -1
- package/dist/sensor/scene-eqe-temporal-exposure.d.ts +14 -12
- package/dist/sensor/scene-eqe-temporal-exposure.js +13 -8
- package/dist/sensor/scene-eqe-temporal-exposure.js.map +1 -1
- package/dist/sensor/sensor-geometry.d.ts +28 -32
- package/dist/sensor/sensor-geometry.js +35 -20
- package/dist/sensor/sensor-geometry.js.map +1 -1
- package/dist/sensor/signal-noise.d.ts +14 -16
- package/dist/sensor/signal-noise.js +15 -13
- package/dist/sensor/signal-noise.js.map +1 -1
- package/dist/sensor/spatial-sample-reduction.d.ts +45 -60
- package/dist/sensor/spatial-sample-reduction.js +39 -48
- package/dist/sensor/spatial-sample-reduction.js.map +1 -1
- package/dist/sensor/spatial-sampling-quadrature.d.ts +46 -54
- package/dist/sensor/spatial-sampling-quadrature.js +31 -36
- package/dist/sensor/spatial-sampling-quadrature.js.map +1 -1
- package/dist/sensor/spatio-spectral-reduction.d.ts +32 -42
- package/dist/sensor/spatio-spectral-reduction.js +24 -29
- package/dist/sensor/spatio-spectral-reduction.js.map +1 -1
- package/dist/sensor/spectral-coverage.d.ts +6 -9
- package/dist/sensor/spectral-coverage.js +9 -6
- package/dist/sensor/spectral-coverage.js.map +1 -1
- package/dist/sensor/spectral-quadrature.d.ts +46 -60
- package/dist/sensor/spectral-quadrature.js +38 -48
- package/dist/sensor/spectral-quadrature.js.map +1 -1
- package/dist/sensor/spectral-response.d.ts +53 -41
- package/dist/sensor/spectral-response.js +80 -47
- package/dist/sensor/spectral-response.js.map +1 -1
- package/dist/sensor/stochastic-seed.d.ts +50 -0
- package/dist/sensor/stochastic-seed.js +123 -0
- package/dist/sensor/stochastic-seed.js.map +1 -0
- package/dist/sensor/temporal-eqe-sum.d.ts +2 -4
- package/dist/sensor/temporal-eqe-sum.js +5 -6
- package/dist/sensor/temporal-eqe-sum.js.map +1 -1
- package/dist/sensor/temporal-photo-signal.d.ts +5 -6
- package/dist/sensor/temporal-photo-signal.js +11 -10
- package/dist/sensor/temporal-photo-signal.js.map +1 -1
- package/dist/sensor/temporal-sample-binding.d.ts +1 -2
- package/dist/sensor/temporal-sample-binding.js +3 -3
- package/dist/sensor/temporal-sample-binding.js.map +1 -1
- package/dist/simulation/poc-simulation.d.ts +16 -16
- package/dist/simulation/poc-simulation.js +20 -15
- package/dist/simulation/poc-simulation.js.map +1 -1
- package/dist/stabilization/camera-shake.d.ts +42 -18
- package/dist/stabilization/camera-shake.js +43 -20
- package/dist/stabilization/camera-shake.js.map +1 -1
- package/dist/stabilization/system.d.ts +44 -41
- package/dist/stabilization/system.js +196 -108
- package/dist/stabilization/system.js.map +1 -1
- package/docs/AGENT_GUIDE.md +183 -0
- package/docs/API_REFERENCE.md +761 -2
- package/docs/QUICK_START.md +495 -0
- package/docs/USAGE.md +1719 -714
- package/docs/api/camera-equivalent-focal-length.md +6 -7
- package/docs/api/camera-field-of-view.md +16 -8
- package/docs/api/camera-lens-projection.md +246 -0
- package/docs/api/camera-projected-object-size.md +6 -5
- package/docs/api/capture-capture-export-metadata.md +10 -10
- package/docs/api/capture-dng-import.md +134 -0
- package/docs/api/capture-environment-raw-producer.md +17 -11
- package/docs/api/capture-export-jpeg.md +16 -0
- package/docs/api/capture-focus-control.md +25 -47
- package/docs/api/capture-linear-encoding.md +21 -12
- package/docs/api/capture-lossless-jpeg.md +49 -0
- package/docs/api/capture-native-environment-optical-stage.md +75 -0
- package/docs/api/capture-native-environment-raw.md +161 -4
- package/docs/api/capture-native-raw-development.md +69 -4
- package/docs/api/capture-native-raw-dng.md +84 -0
- package/docs/api/capture-native-raw.md +23 -8
- package/docs/api/capture-packed-sensor-raw.md +156 -0
- package/docs/api/capture-photographic-export.md +69 -31
- package/docs/api/capture-raw-frame-reconstruction.md +8 -8
- package/docs/api/capture-raw-white-level.md +37 -0
- package/docs/api/capture-release-sequence.md +6 -7
- package/docs/api/capture-sensor-raw-frame.md +6 -6
- package/docs/api/capture-sensor-raw-producer.md +17 -11
- package/docs/api/capture-simulated-capture.md +15 -15
- package/docs/api/color-camera-color-matrix.md +103 -0
- package/docs/api/color-capture-color.md +22 -11
- package/docs/api/color-chromatic-adaptation.md +82 -0
- package/docs/api/color-color-difference.md +134 -0
- package/docs/api/color-color-matching-functions.md +259 -0
- package/docs/api/color-colorimetry-math.md +54 -0
- package/docs/api/color-gamut-mapping.md +72 -0
- package/docs/api/color-illuminants.md +280 -0
- package/docs/api/color-rgb-color-spaces.md +151 -0
- package/docs/api/color-sensor-color-development.md +27 -0
- package/docs/api/color-srgb-icc.md +2 -4
- package/docs/api/color-white-balance.md +95 -19
- package/docs/api/composition-image-formation-plan.md +124 -95
- package/docs/api/composition-plan-consumer.md +7 -7
- package/docs/api/core-calculation-result.md +18 -14
- package/docs/api/core-configuration-error.md +1 -1
- package/docs/api/core-image-formation.md +7 -7
- package/docs/api/core-scientific-assurance.md +12 -10
- package/docs/api/core-spectral-composition.md +14 -14
- package/docs/api/core-spectral.md +6 -6
- package/docs/api/core-validation.md +3 -3
- package/docs/api/core-version.md +7 -6
- package/docs/api/equipment-exposure-capabilities.md +11 -10
- package/docs/api/equipment-generic-tier-assets.md +7 -2
- package/docs/api/equipment-generic-tier-presets.md +6 -6
- package/docs/api/equipment-iso-capabilities.md +18 -18
- package/docs/api/equipment-metering-capabilities.md +6 -6
- package/docs/api/equipment-release-capabilities.md +4 -4
- package/docs/api/exports.json +2213 -8
- package/docs/api/exposure-exposure-duration-control.md +9 -9
- package/docs/api/exposure-exposure-mode-resolver.md +35 -31
- package/docs/api/exposure-exposure.md +10 -10
- package/docs/api/exposure-flash-ttl.md +182 -0
- package/docs/api/exposure-flash.md +183 -28
- package/docs/api/exposure-metering-scene-radiance.md +11 -10
- package/docs/api/exposure-metering-target.md +9 -8
- package/docs/api/exposure-metering-temporal.md +8 -8
- package/docs/api/exposure-metering.md +69 -9
- package/docs/api/exposure-program-line.md +6 -5
- package/docs/api/facade-chart-radiance-batch.md +96 -0
- package/docs/api/facade-chart-scenes.md +240 -0
- package/docs/api/facade-scene-radiance.md +122 -0
- package/docs/api/facade-simulate-capture.md +324 -0
- package/docs/api/gpu-image-kernel-accelerator.md +157 -0
- package/docs/api/gpu-image-kernel-execution.md +152 -0
- package/docs/api/motion-camera-rotation.md +43 -26
- package/docs/api/motion-capture-rotation-inverse-mapping.md +24 -23
- package/docs/api/motion-capture-rotation-temporal-quadrature.md +22 -22
- package/docs/api/motion-capture-rotation-trajectory.md +15 -15
- package/docs/api/motion-capture-translation-parallax-temporal-quadrature.md +15 -14
- package/docs/api/motion-extended-object-projection.md +10 -8
- package/docs/api/motion-projected-motion.md +8 -8
- package/docs/api/motion-temporal-exposure-sum.md +98 -0
- package/docs/api/motion-video-sequence.md +159 -0
- package/docs/api/optics-aperture.md +8 -8
- package/docs/api/optics-atmospheric-haze.md +104 -0
- package/docs/api/optics-brown-conrady-distortion.md +123 -0
- package/docs/api/optics-circle-of-confusion.md +5 -4
- package/docs/api/optics-complex-pupil-psf.md +57 -16
- package/docs/api/optics-depth-of-field.md +12 -6
- package/docs/api/optics-diffraction.md +8 -7
- package/docs/api/optics-focus-breathing.md +104 -16
- package/docs/api/optics-focus-state.md +9 -10
- package/docs/api/optics-front-of-lens-filter.md +72 -14
- package/docs/api/optics-illumination-vignetting.md +10 -10
- package/docs/api/optics-irradiance-convolution.md +95 -0
- package/docs/api/optics-lateral-chromatic-aberration.md +22 -21
- package/docs/api/optics-lens-psf-kernels.md +72 -0
- package/docs/api/optics-lens-psf-profile.md +48 -26
- package/docs/api/optics-longitudinal-chromatic-aberration.md +128 -0
- package/docs/api/optics-polygon-diffraction.md +78 -13
- package/docs/api/optics-profile-contract.md +4 -4
- package/docs/api/optics-psf-foundation.md +12 -12
- package/docs/api/optics-pupil-vignetting.md +132 -0
- package/docs/api/optics-radial-distortion.md +12 -12
- package/docs/api/optics-scene-to-sensor-irradiance.md +25 -14
- package/docs/api/optics-scene-to-sensor-quadrature.md +15 -12
- package/docs/api/optics-sensor-aperture-rays.md +3 -2
- package/docs/api/optics-sensor-environment-query.md +52 -9
- package/docs/api/optics-sensor-psf-quadrature.md +13 -10
- package/docs/api/optics-stray-light.md +12 -11
- package/docs/api/optics-thin-lens.md +4 -3
- package/docs/api/optics-zernike-wavefront.md +229 -0
- package/docs/api/output-capture-corrected-sdr.md +10 -7
- package/docs/api/output-capture-geometry.md +35 -36
- package/docs/api/output-capture-sdr.md +4 -4
- package/docs/api/output-crop.md +7 -4
- package/docs/api/output-geometric-transforms.md +65 -19
- package/docs/api/output-lens-corrections.md +17 -15
- package/docs/api/output-native-capture-sdr.md +26 -13
- package/docs/api/output-png-encoder.md +105 -0
- package/docs/api/output-print-contrast-reference.md +8 -8
- package/docs/api/output-print-detail.md +14 -14
- package/docs/api/output-print-jpeg.md +22 -5
- package/docs/api/output-print-plan.md +18 -18
- package/docs/api/output-print-region-statistics.md +14 -14
- package/docs/api/output-sdr-rendering.md +52 -10
- package/docs/api/output-subject-framing-crop.md +5 -6
- package/docs/api/processing-demosaic.md +120 -0
- package/docs/api/processing-denoise.md +148 -0
- package/docs/api/processing-focus-stacking.md +41 -0
- package/docs/api/processing-hdr.md +113 -0
- package/docs/api/processing-panorama.md +82 -0
- package/docs/api/processing-processing-task.md +107 -0
- package/docs/api/processing-tone-mapping.md +142 -0
- package/docs/api/schema-camera.md +6 -4
- package/docs/api/schema-illumination-spectral.md +10 -11
- package/docs/api/schema-illumination-temporal.md +13 -15
- package/docs/api/schema-illumination.md +4 -4
- package/docs/api/schema-scene-radiance-temporal.md +10 -11
- package/docs/api/schema-scene-radiance.md +18 -17
- package/docs/api/schema-scene.md +9 -9
- package/docs/api/schema-validation.md +1 -1
- package/docs/api/sensor-accumulated-charge.md +12 -20
- package/docs/api/sensor-architecture.md +15 -16
- package/docs/api/sensor-camera-saturation-capacity.md +9 -11
- package/docs/api/sensor-capture-color-sampling-binding.md +47 -51
- package/docs/api/sensor-capture-mode-timing.md +9 -9
- package/docs/api/sensor-capture-mode.md +29 -30
- package/docs/api/sensor-color-sampling.md +31 -33
- package/docs/api/sensor-constant-rate-temporal-integration.md +10 -11
- package/docs/api/sensor-dark-current.md +30 -14
- package/docs/api/sensor-environment-photo-signal.md +13 -6
- package/docs/api/sensor-eqe-electron-rate.md +9 -8
- package/docs/api/sensor-eqe-local-exposure.md +18 -17
- package/docs/api/sensor-eqe-temporal-exposure.md +12 -11
- package/docs/api/sensor-exposure-window.md +24 -24
- package/docs/api/sensor-fixed-pattern-noise.md +104 -0
- package/docs/api/sensor-iso-gain.md +63 -0
- package/docs/api/sensor-iso-signal-chain.md +13 -22
- package/docs/api/sensor-local-exposure-binding.md +12 -13
- package/docs/api/sensor-optical-stack.md +37 -40
- package/docs/api/sensor-photon-energy.md +10 -11
- package/docs/api/sensor-physical-charge-capacity.md +8 -13
- package/docs/api/sensor-pixel-pitch.md +1 -1
- package/docs/api/sensor-radiometry-readiness.md +9 -9
- package/docs/api/sensor-raw-readout.md +118 -52
- package/docs/api/sensor-raw-reconstruction.md +97 -20
- package/docs/api/sensor-readout-exposure-linkage.md +120 -24
- package/docs/api/sensor-readout-timing.md +33 -35
- package/docs/api/sensor-response-application-compatibility.md +9 -11
- package/docs/api/sensor-response-operating-range.md +14 -18
- package/docs/api/sensor-responsivity-photocurrent.md +9 -12
- package/docs/api/sensor-sampling-aperture.md +22 -25
- package/docs/api/sensor-scene-eqe-temporal-exposure.md +9 -8
- package/docs/api/sensor-sensor-geometry.md +23 -24
- package/docs/api/sensor-signal-noise.md +10 -10
- package/docs/api/sensor-spatial-sample-reduction.md +27 -30
- package/docs/api/sensor-spatial-sampling-quadrature.md +37 -39
- package/docs/api/sensor-spatio-spectral-reduction.md +27 -29
- package/docs/api/sensor-spectral-coverage.md +5 -5
- package/docs/api/sensor-spectral-quadrature.md +33 -35
- package/docs/api/sensor-spectral-response.md +28 -16
- package/docs/api/sensor-temporal-photo-signal.md +6 -6
- package/docs/api/simulation-poc-simulation.md +17 -16
- package/docs/api/stabilization-camera-shake.md +29 -10
- package/docs/api/stabilization-system.md +25 -21
- package/docs/examples/production-request.json +3821 -2157
- package/docs/examples/simulate-capture.mjs +14 -0
- package/llms.txt +35 -0
- package/package.json +32 -12
- package/AGENTS.md +0 -674
- package/CONTRIBUTING.md +0 -76
- package/DCO +0 -33
- package/dist/camera/equivalent-focal-length.d.ts.map +0 -1
- package/dist/camera/field-of-view.d.ts.map +0 -1
- package/dist/camera/projected-object-size.d.ts.map +0 -1
- package/dist/capture/capture-export-metadata.d.ts.map +0 -1
- package/dist/capture/environment-raw-producer.d.ts.map +0 -1
- package/dist/capture/export-jpeg.d.ts.map +0 -1
- package/dist/capture/export-tiff.d.ts.map +0 -1
- package/dist/capture/focus-control.d.ts.map +0 -1
- package/dist/capture/linear-encoding.d.ts.map +0 -1
- package/dist/capture/native-environment-raw.d.ts.map +0 -1
- package/dist/capture/native-raw-development.d.ts.map +0 -1
- package/dist/capture/native-raw.d.ts.map +0 -1
- package/dist/capture/photographic-export.d.ts.map +0 -1
- package/dist/capture/raw-frame-limits.d.ts.map +0 -1
- package/dist/capture/raw-frame-reconstruction.d.ts.map +0 -1
- package/dist/capture/release-sequence.d.ts.map +0 -1
- package/dist/capture/sensor-raw-frame.d.ts.map +0 -1
- package/dist/capture/sensor-raw-producer.d.ts.map +0 -1
- package/dist/capture/simulated-capture.d.ts.map +0 -1
- package/dist/color/capture-color.d.ts.map +0 -1
- package/dist/color/sensor-color-development.d.ts.map +0 -1
- package/dist/color/srgb-icc.d.ts.map +0 -1
- package/dist/color/srgb-transfer.d.ts.map +0 -1
- package/dist/color/white-balance.d.ts.map +0 -1
- package/dist/composition/image-formation-plan.d.ts.map +0 -1
- package/dist/composition/plan-consumer.d.ts.map +0 -1
- package/dist/core/calculation-result.d.ts.map +0 -1
- package/dist/core/canonical-json.d.ts.map +0 -1
- package/dist/core/configuration-error.d.ts.map +0 -1
- package/dist/core/evidence-provenance.d.ts.map +0 -1
- package/dist/core/image-formation.d.ts.map +0 -1
- package/dist/core/owned-data.d.ts.map +0 -1
- package/dist/core/record-validation.d.ts.map +0 -1
- package/dist/core/scientific-assurance.d.ts.map +0 -1
- package/dist/core/spectral-composition.d.ts.map +0 -1
- package/dist/core/spectral.d.ts.map +0 -1
- package/dist/core/validation.d.ts.map +0 -1
- package/dist/core/version.d.ts.map +0 -1
- package/dist/equipment/exposure-capabilities.d.ts.map +0 -1
- package/dist/equipment/generic-tier-assets.d.ts.map +0 -1
- package/dist/equipment/generic-tier-presets.d.ts.map +0 -1
- package/dist/equipment/iso-capabilities.d.ts.map +0 -1
- package/dist/equipment/metering-capabilities.d.ts.map +0 -1
- package/dist/equipment/release-capabilities.d.ts.map +0 -1
- package/dist/exposure/exposure-duration-control.d.ts.map +0 -1
- package/dist/exposure/exposure-mode-resolver.d.ts.map +0 -1
- package/dist/exposure/exposure.d.ts.map +0 -1
- package/dist/exposure/flash.d.ts.map +0 -1
- package/dist/exposure/metering-scene-radiance.d.ts.map +0 -1
- package/dist/exposure/metering-target.d.ts.map +0 -1
- package/dist/exposure/metering-temporal.d.ts.map +0 -1
- package/dist/exposure/metering.d.ts.map +0 -1
- package/dist/exposure/program-line.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/motion/camera-rotation.d.ts.map +0 -1
- package/dist/motion/capture-rotation-inverse-mapping.d.ts.map +0 -1
- package/dist/motion/capture-rotation-temporal-quadrature.d.ts.map +0 -1
- package/dist/motion/capture-rotation-trajectory.d.ts.map +0 -1
- package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts.map +0 -1
- package/dist/motion/extended-object-projection.d.ts.map +0 -1
- package/dist/motion/projected-motion.d.ts.map +0 -1
- package/dist/optics/aperture.d.ts.map +0 -1
- package/dist/optics/circle-of-confusion.d.ts.map +0 -1
- package/dist/optics/complex-pupil-psf.d.ts.map +0 -1
- package/dist/optics/depth-of-field.d.ts.map +0 -1
- package/dist/optics/diffraction.d.ts.map +0 -1
- package/dist/optics/focus-breathing.d.ts.map +0 -1
- package/dist/optics/focus-state.d.ts.map +0 -1
- package/dist/optics/front-of-lens-filter.d.ts.map +0 -1
- package/dist/optics/illumination-vignetting.d.ts.map +0 -1
- package/dist/optics/lateral-chromatic-aberration.d.ts.map +0 -1
- package/dist/optics/lens-psf-profile.d.ts.map +0 -1
- package/dist/optics/polygon-diffraction.d.ts.map +0 -1
- package/dist/optics/profile-contract.d.ts.map +0 -1
- package/dist/optics/psf-foundation.d.ts.map +0 -1
- package/dist/optics/radial-distortion.d.ts.map +0 -1
- package/dist/optics/scene-to-sensor-irradiance.d.ts.map +0 -1
- package/dist/optics/scene-to-sensor-quadrature.d.ts.map +0 -1
- package/dist/optics/sensor-aperture-rays.d.ts.map +0 -1
- package/dist/optics/sensor-environment-query.d.ts.map +0 -1
- package/dist/optics/sensor-psf-quadrature.d.ts.map +0 -1
- package/dist/optics/sensor-psf-support.d.ts.map +0 -1
- package/dist/optics/stray-light.d.ts.map +0 -1
- package/dist/optics/thin-lens.d.ts.map +0 -1
- package/dist/output/capture-corrected-sdr.d.ts.map +0 -1
- package/dist/output/capture-geometry.d.ts.map +0 -1
- package/dist/output/capture-sdr.d.ts.map +0 -1
- package/dist/output/crop.d.ts.map +0 -1
- package/dist/output/geometric-transforms.d.ts.map +0 -1
- package/dist/output/lens-corrections.d.ts.map +0 -1
- package/dist/output/native-capture-sdr.d.ts.map +0 -1
- package/dist/output/print-contrast-reference.d.ts.map +0 -1
- package/dist/output/print-detail.d.ts.map +0 -1
- package/dist/output/print-jpeg.d.ts.map +0 -1
- package/dist/output/print-plan.d.ts.map +0 -1
- package/dist/output/print-region-statistics.d.ts.map +0 -1
- package/dist/output/sdr-rendering.d.ts.map +0 -1
- package/dist/output/subject-framing-crop.d.ts.map +0 -1
- package/dist/schema/camera.d.ts.map +0 -1
- package/dist/schema/camera.js +0 -3
- package/dist/schema/camera.js.map +0 -1
- package/dist/schema/illumination-spectral.d.ts.map +0 -1
- package/dist/schema/illumination-temporal.d.ts.map +0 -1
- package/dist/schema/illumination.d.ts.map +0 -1
- package/dist/schema/scene-radiance-temporal.d.ts.map +0 -1
- package/dist/schema/scene-radiance.d.ts.map +0 -1
- package/dist/schema/scene.d.ts.map +0 -1
- package/dist/schema/scene.js +0 -3
- package/dist/schema/scene.js.map +0 -1
- package/dist/schema/validation.d.ts.map +0 -1
- package/dist/sensor/accumulated-charge.d.ts.map +0 -1
- package/dist/sensor/architecture.d.ts.map +0 -1
- package/dist/sensor/camera-saturation-capacity.d.ts.map +0 -1
- package/dist/sensor/capture-color-sampling-binding.d.ts.map +0 -1
- package/dist/sensor/capture-mode-timing.d.ts.map +0 -1
- package/dist/sensor/capture-mode.d.ts.map +0 -1
- package/dist/sensor/color-sampling.d.ts.map +0 -1
- package/dist/sensor/constant-rate-temporal-integration.d.ts.map +0 -1
- package/dist/sensor/dark-current.d.ts.map +0 -1
- package/dist/sensor/environment-photo-signal.d.ts.map +0 -1
- package/dist/sensor/eqe-electron-rate.d.ts.map +0 -1
- package/dist/sensor/eqe-local-exposure.d.ts.map +0 -1
- package/dist/sensor/eqe-temporal-exposure.d.ts.map +0 -1
- package/dist/sensor/exposure-window.d.ts.map +0 -1
- package/dist/sensor/iso-signal-chain.d.ts.map +0 -1
- package/dist/sensor/local-exposure-binding.d.ts.map +0 -1
- package/dist/sensor/optical-stack.d.ts.map +0 -1
- package/dist/sensor/photon-energy.d.ts.map +0 -1
- package/dist/sensor/physical-charge-capacity.d.ts.map +0 -1
- package/dist/sensor/pixel-pitch.d.ts.map +0 -1
- package/dist/sensor/radiometry-readiness.d.ts.map +0 -1
- package/dist/sensor/raw-readout.d.ts.map +0 -1
- package/dist/sensor/raw-reconstruction.d.ts.map +0 -1
- package/dist/sensor/readout-exposure-linkage.d.ts.map +0 -1
- package/dist/sensor/readout-timing.d.ts.map +0 -1
- package/dist/sensor/response-application-compatibility.d.ts.map +0 -1
- package/dist/sensor/response-operating-range.d.ts.map +0 -1
- package/dist/sensor/responsivity-photocurrent.d.ts.map +0 -1
- package/dist/sensor/sampling-aperture.d.ts.map +0 -1
- package/dist/sensor/scene-eqe-temporal-exposure.d.ts.map +0 -1
- package/dist/sensor/sensor-geometry.d.ts.map +0 -1
- package/dist/sensor/signal-noise.d.ts.map +0 -1
- package/dist/sensor/spatial-sample-reduction.d.ts.map +0 -1
- package/dist/sensor/spatial-sampling-quadrature.d.ts.map +0 -1
- package/dist/sensor/spatio-spectral-reduction.d.ts.map +0 -1
- package/dist/sensor/spectral-coverage.d.ts.map +0 -1
- package/dist/sensor/spectral-quadrature.d.ts.map +0 -1
- package/dist/sensor/spectral-response.d.ts.map +0 -1
- package/dist/sensor/temporal-eqe-sum.d.ts.map +0 -1
- package/dist/sensor/temporal-photo-signal.d.ts.map +0 -1
- package/dist/sensor/temporal-sample-binding.d.ts.map +0 -1
- package/dist/simulation/poc-simulation.d.ts.map +0 -1
- package/dist/stabilization/camera-shake.d.ts.map +0 -1
- package/dist/stabilization/system.d.ts.map +0 -1
- package/docs/API_STYLE.md +0 -235
- package/docs/ARCHITECTURE.md +0 -356
- package/docs/AUTOMATION_COORDINATION.md +0 -190
- package/docs/CAPTURE_COLOR.md +0 -25
- package/docs/CAPTURE_CORRECTED_SDR.md +0 -25
- package/docs/CAPTURE_EXPORT_METADATA.md +0 -27
- package/docs/CAPTURE_SDR.md +0 -22
- package/docs/DEVELOPERS.md +0 -68
- package/docs/DIGITAL_OPTICS_FOUNDATION.md +0 -69
- package/docs/ENVIRONMENT_RAW_CAPTURE.md +0 -208
- package/docs/EXPORT_ACCEPTANCE.md +0 -133
- package/docs/GENERIC_TIER_PRESETS.md +0 -269
- package/docs/GEOMETRIC_PREPARATION_REUSE.md +0 -141
- package/docs/IMAGE_FORMATION.md +0 -247
- package/docs/LINEAR_CAPTURE_ENCODING.md +0 -25
- package/docs/MOTION_AND_SIGNAL.md +0 -250
- package/docs/NATIVE_CAPTURE_SDR.md +0 -70
- package/docs/NATIVE_CAPTURE_SDR_REVIEW.md +0 -37
- package/docs/NATIVE_CAPTURE_SDR_VALIDATION.md +0 -34
- package/docs/NATIVE_RAW_AND_PRINT.md +0 -47
- package/docs/NUMERICAL_CORRECTNESS.md +0 -191
- package/docs/PERFORMANCE_BASELINE.md +0 -56
- package/docs/PHOTOGRAPHIC_EXPORT.md +0 -206
- package/docs/PHYSICS_FOUNDATION.md +0 -426
- package/docs/POC_API.md +0 -278
- package/docs/POC_PROJECTION_PLATFORM_REFERENCE.md +0 -12
- package/docs/POC_PROJECTION_REUSE.md +0 -124
- package/docs/PRINT_195_196_REVIEW.md +0 -93
- package/docs/PRINT_196_ENGINE_ACCEPTANCE.md +0 -45
- package/docs/PRINT_CONTRAST_REFERENCE.md +0 -43
- package/docs/PRINT_DETAIL_ASSESSMENT.md +0 -81
- package/docs/PRINT_DETAIL_JPEG_EVIDENCE.md +0 -36
- package/docs/PRINT_DETAIL_SDR_EVIDENCE.md +0 -29
- package/docs/PRINT_DETAIL_VALIDATION.md +0 -36
- package/docs/PRINT_PLANNING.md +0 -75
- package/docs/PRINT_REGION_STATISTICS.md +0 -38
- package/docs/PROCESSED_OUTPUT.md +0 -157
- package/docs/PRODUCTION_COMPOSITION.md +0 -373
- package/docs/PRODUCTION_ENVIRONMENT_CAPTURE.md +0 -131
- package/docs/PROVENANCE.md +0 -115
- package/docs/PSF_FOUNDATION.md +0 -165
- package/docs/RAW_FRAME_ENVELOPE.md +0 -56
- package/docs/RAW_FRAME_RECONSTRUCTION.md +0 -30
- package/docs/RELEASE_1_0.md +0 -66
- package/docs/RELEASE_1_0_1.md +0 -61
- package/docs/RELEASE_1_1_0.md +0 -25
- package/docs/RELEASE_1_2_0.md +0 -51
- package/docs/RELEASE_1_3_0.md +0 -15
- package/docs/RELEASE_1_4_0.md +0 -23
- package/docs/RELEASE_AUDIT.md +0 -39
- package/docs/SCENE_RADIANCE_AND_ILLUMINATION.md +0 -298
- package/docs/SCENE_SENSOR_QUADRATURE.md +0 -98
- package/docs/SCENE_SENSOR_TEMPORAL_EXPOSURE.md +0 -86
- package/docs/SCIENTIFIC_ASSURANCE.md +0 -280
- package/docs/SCIENTIFIC_CONFORMANCE.md +0 -83
- package/docs/SDR_RENDERING.md +0 -33
- package/docs/SENSOR_APERTURE_RAYS.md +0 -23
- package/docs/SENSOR_ENVIRONMENT_QUERY.md +0 -86
- package/docs/SENSOR_EQE_LOCAL_EXPOSURE.md +0 -104
- package/docs/SENSOR_EQE_TEMPORAL_EXPOSURE.md +0 -74
- package/docs/SENSOR_PSF_QUADRATURE.md +0 -90
- package/docs/SENSOR_RAW_FRAME.md +0 -20
- package/docs/SENSOR_RAW_PRODUCER.md +0 -77
- package/docs/SIGNAL_CONFORMANCE.md +0 -23
- package/docs/SIMULATED_CAPTURE.md +0 -65
- package/docs/STABILIZATION.md +0 -234
- package/docs/TEMPORAL_PHOTO_RAW.md +0 -83
- package/docs/TIER_ACCEPTANCE.md +0 -129
- package/docs/TIER_PRESET_ACCEPTANCE.md +0 -59
- package/docs/V1_COMPOSITION_MAP.md +0 -123
- package/docs/V1_HELPER_REUSE_REVIEW.md +0 -60
- package/docs/V1_PERFORMANCE_DISPOSITION.md +0 -88
- package/docs/benchmarks/2026-10-01-main-baseline.json +0 -694
- package/docs/benchmarks/2026-10-02-geometric-preparation-reuse.json +0 -2190
- package/docs/benchmarks/2026-10-02-poc-projection-reuse.json +0 -2423
- package/docs/benchmarks/2026-10-02-v1-environment-gc-profile.json +0 -210
- package/docs/benchmarks/2026-10-02-v1-environment-ordinary.json +0 -187
- package/docs/benchmarks/2026-10-02-v1-geometry-gc-profile.json +0 -756
- package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-1.json +0 -711
- package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-2.json +0 -711
- package/docs/benchmarks/2026-10-02-v1-poc-gc-profile.json +0 -885
- package/docs/benchmarks/2026-10-02-v1-poc-ordinary-1.json +0 -868
- package/docs/benchmarks/2026-10-02-v1-poc-ordinary-2.json +0 -868
- package/docs/licenses/castleCSF-MIT.txt +0 -21
- package/docs/validation/documentation-fragments.json +0 -212
- package/docs/validation/native-capture-sdr-darwin-arm64-node26-review.jsonl +0 -4
- package/docs/validation/native-capture-sdr-darwin-arm64.jsonl +0 -3
- package/docs/validation/native-raw-print-2026-10-04/fractional-asymmetric-crop.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/gray-ramp.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/linear-area-checker.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/manifest.json +0 -218
- package/docs/validation/native-raw-print-2026-10-04/megapixel-native.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/native-color.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel-validation.json +0 -9
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json +0 -29
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.codes.u16le.gz +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.jpg +0 -0
- package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.rgb.gz +0 -0
- package/docs/validation/native-raw-print-2026-10-04/srgb.icc +0 -0
- package/docs/validation/native-raw-print-2026-10-04/validation.json +0 -41
- package/docs/validation/print-196-candidate-capabilities.json +0 -28
- package/docs/validation/print-196-candidate-evidence.json +0 -356
- package/docs/validation/print-196-engine-acceptance.json +0 -81
- package/docs/validation/print-detail-capabilities.json +0 -103
- package/docs/validation/print-detail-jpeg-evidence.json +0 -116
- package/docs/validation/print-detail-sdr-evidence.json +0 -81
- package/docs/validation/release-audit-inventory.json +0 -1306
- package/docs/validation/tier-acceptance-report-v1.json +0 -2538
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"front-of-lens-filter.js","sourceRoot":"","sources":["../../src/optics/front-of-lens-filter.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;GAQG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,iBAAiB,EAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAE7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAIpE,MAAM,CAAC,MAAM,2CAA2C,GACtD,OAAgB,CAAC;AA2JnB,SAAS,aAAa,CACpB,KAAc,EACd,IAAY;IAEZ,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EACpB,CAAC;QACD,MAAM,IAAI,yBAAyB,CACjC,IAAI,GAAG,qBAAqB,CAC7B,CAAC;IACJ,CAAC;IACD,OAAO,KAAsB,CAAC;AAChC,CAAC;AAED,SAAS,qBAAqB,CAC5B,KAAc,EACd,IAAY;IAEZ,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EACzB,CAAC;QACD,MAAM,IAAI,yBAAyB,CACjC,IAAI,GAAG,8BAA8B,CACtC,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC;AAED,SAAS,aAAa,CACpB,KAAc,EACd,IAAY;IAEZ,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,MAAM,CAAC,QA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Q,GAAG,CAAC,EACZ,CAAC;QACD,MAAM,IAAI,2BAA2B,CACnC,wEAAwE,CACzE,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GACT,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,2BAA2B,CACnC,iDAAiD,CAClD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,aAAa,EACX,2CAA2C;QAC7C,oBAAoB,EAClB,oBAAoB,CAClB,KAAK,CAAC,oBAAoB,CAC3B;QACH,eAAe,EACb,KAAK,CAAC,eAAe;QACvB,kBAAkB,EAChB,UAAU,CAAC,MAAM;QACnB,UAAU;QACV,gCAAgC,EAC9B,QAAQ;QACV,wBAAwB,EACtB,KAAK;QACP,gBAAgB,EACd,UAAU,CAAC,IAAI,CACb,CAAC,SAAS,EAAE,EAAE,CACZ,SAAS;aACN,gBAAgB;YACnB,eAAe,CAClB;YACC,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,YAAY;QAClB,sBAAsB,EACpB,gBAAgB;QAClB,qBAAqB,EACnB,6JAA6J;QAC/J,gBAAgB,EACd,iFAAiF;QACnF,mBAAmB,EACjB,KAAK;QACP,iCAAiC,EAC/B,KAAK;QACP,wBAAwB,EACtB,KAAK;QACP,0BAA0B,EACxB,KAAK;QACP,uBAAuB,EACrB,KAAK;KACR,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"front-of-lens-filter.js","sourceRoot":"","sources":["../../src/optics/front-of-lens-filter.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACL,iBAAiB,EAGlB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAE7B,MAAM,qBAAqB,CAA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,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,mBAAmB,CAC7C,CAAC;IACF,OAAO;QACL,aAAa,EAAE,mBAAmB;YAChC,CAAC,CAAC,8CAA8C;YAChD,CAAC,CAAC,2CAA2C;QAC/C,oBAAoB,EAClB,oBAAoB,CAClB,KAAK,CAAC,oBAAoB,CAC3B;QACH,eAAe,EACb,KAAK,CAAC,eAAe;QACvB,kBAAkB,EAChB,UAAU,CAAC,MAAM;QACnB,UAAU;QACV,gCAAgC,EAC9B,QAAQ;QACV,wBAAwB,EACtB,KAAK;QACP,gBAAgB,EACd,UAAU,CAAC,IAAI,CACb,CAAC,SAAS,EAAE,EAAE,CACZ,SAAS;aACN,gBAAgB;YACnB,eAAe,CAClB;YACC,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,YAAY;QAClB,sBAAsB,EACpB,gBAAgB;QAClB,qBAAqB,EACnB,6JAA6J;QAC/J,gBAAgB,EAAE,mBAAmB;YACnC,CAAC,CAAC,2DAA2D;YAC7D,CAAC,CAAC,iFAAiF;QACrF,mBAAmB;QACnB,oBAAoB;QACpB,uBAAuB,EACrB,eAAe,CAAC,MAAM,CAAC;QACzB,iCAAiC,EAC/B,KAAK;QACP,wBAAwB,EACtB,KAAK;QACP,0BAA0B,EACxB,KAAK;QACP,uBAAuB,EACrB,KAAK;KACR,CAAC;AACJ,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Generic filters that screw onto the front of the lens.\n *\n * Schema 0.1.0 is explicitly unbranded and unpolarized. It models only passive transmission in front\n * of the lens. It does not cover reflections between stacked filters, flare or ghosting, or filters\n * that change wavelength.\n *\n * Schema 0.2.0 adds one polarizing kind: a linear (partial) polarizer. It has a principal\n * transmittance k1, an extinction ratio k1/k2 and a transmission-axis angle. Polarization is carried\n * as linear Stokes parameters (S0, S1, S2). Filters are applied in order using the Mueller matrix of\n * a linear diattenuator (Gil, arXiv:2002.04105, eqs. 134-135, free; Malus's law: OpenStax University\n * Physics Vol. 3, sec. 1.7, free. Also see: Chipman, Handbook of Optics vol. I ch. 22, 3rd ed., 2010;\n * Goldstein, Polarized Light, 3rd ed., ch. 4-5; Born & Wolf, Principles of Optics, sec. 1.4.2):\n * T = (k1 + k2)/2 + (k1 - k2)/2 * P * cos(2 (psi - theta))\n * Here P is the incident light's degree of linear polarization, psi its polarization angle and theta\n * the filter axis angle.\n * - For P = 1 this is Malus's law: k1 cos^2(psi - theta) + k2 sin^2(psi - theta).\n * - For unpolarized light it is (k1 + k2)/2, about half of k1.\n * Not modelled: circular polarization, retardance (for example the quarter-wave plate in a circular\n * polarizer), dependence on the angle of incidence, and depolarization.\n * @see docs/PHYSICS_FOUNDATION.md for the equations, units, coordinate conventions, known blockers\n * and support limits.\n */\n\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport {\n parseEvidenceList,\n type EvidenceBackedFact,\n type EvidenceProvenance\n} from \"../core/evidence-provenance.js\";\nimport {\n parseSpectralWavelengthBasis,\n type SpectralWavelengthBasis\n} from \"../core/spectral.js\";\nimport { InvalidScientificInputError } from \"../core/validation.js\";\nimport { requireInputKeys, rejectUnknownFields, rejectUnknownVariantFields, UNCERTAINTY_VARIANT_FIELDS } from \"../core/record-validation.js\";\n\ntype UnknownRecord = Record<string, unknown>;\n\nexport const FRONT_OF_LENS_FILTER_PROFILE_SCHEMA_VERSION =\n \"0.1.0\" as const;\n/** Schema that also allows the `linear-polarizer` transmission kind. */\nexport const FRONT_OF_LENS_POLARIZER_PROFILE_SCHEMA_VERSION =\n \"0.2.0\" as const;\n\nexport type FrontOfLensFilterProfileSchemaVersion =\n | typeof FRONT_OF_LENS_FILTER_PROFILE_SCHEMA_VERSION\n | typeof FRONT_OF_LENS_POLARIZER_PROFILE_SCHEMA_VERSION;\n\n/** Partially linearly polarized light: degree P in [0, 1] and polarization angle psi. */\nexport interface LinearPolarizationState {\n /** Degree of linear polarization P in [0, 1]; 0 is unpolarized. */\n degreeOfLinearPolarization: number;\n /** Electric-field polarization angle, degrees counter-clockwise from image +X. */\n angleDegrees: number;\n}\n\nexport type FrontOfLensFilterScientificStatus =\n | \"calibrated\"\n | \"approximation\";\n\nexport type FrontOfLensFilterUncertainty =\n | {\n kind: \"relative\";\n fraction: number;\n basis: string;\n }\n | {\n kind: \"not-quantified\";\n limitation: string;\n };\n\nexport interface FrontOfLensFilterSpectralSample {\n wavelengthNanometers: number;\n linearTransmissionFactor: number;\n}\n\nexport type FrontOfLensFilterTransmissionModel =\n | {\n kind: \"neutral-linear-transmission\";\n linearTransmissionFactor:\n EvidenceBackedFact<number>;\n }\n | {\n kind: \"neutral-optical-density\";\n opticalDensityBase10:\n EvidenceBackedFact<number>;\n }\n | {\n kind: \"spectral-transmission\";\n samples:\n EvidenceBackedFact<\n readonly FrontOfLensFilterSpectralSample[]\n >;\n }\n | {\n /** Schema 0.2.0 only. Neutral (wavelength-independent) within the declared range. */\n kind: \"linear-polarizer\";\n /** k1: intensity transmittance for light polarized along the transmission axis, (0, 1]. */\n principalTransmittance:\n EvidenceBackedFact<number>;\n /** k1 / k2. Finite and >= 1. Use a large finite ratio for a near-ideal polarizer. */\n extinctionRatio:\n EvidenceBackedFact<number>;\n /** Transmission-axis angle as mounted, degrees counter-clockwise from image +X. */\n transmissionAxisDegrees: number;\n };\n\nexport interface FrontOfLensFilterProfile {\n schemaVersion:\n FrontOfLensFilterProfileSchemaVersion;\n filterId: string;\n profileVersion: string;\n identityScope:\n \"photivra-generic-unbranded\";\n position: \"front-of-lens\";\n scientificStatus:\n FrontOfLensFilterScientificStatus;\n wavelengthBasis:\n Exclude<\n SpectralWavelengthBasis,\n \"unspecified\"\n >;\n wavelengthRangeNanometers: {\n minimum: number;\n maximum: number;\n };\n transmission:\n FrontOfLensFilterTransmissionModel;\n uncertainty:\n FrontOfLensFilterUncertainty;\n /** True exactly when the transmission kind is `linear-polarizer` (schema 0.2.0). */\n polarizationModeled: boolean;\n wavelengthChangingBehaviorModeled:\n false;\n evidence: readonly EvidenceProvenance[];\n limitations: readonly string[];\n}\n\nexport interface ResolveFrontOfLensFilterTransmissionInput {\n profile: FrontOfLensFilterProfile;\n wavelengthNanometers: number;\n wavelengthBasis:\n Exclude<\n SpectralWavelengthBasis,\n \"unspecified\"\n >;\n /** Incident polarization; omitted means unpolarized. */\n incidentPolarization?: LinearPolarizationState;\n}\n\nexport interface ResolvedFrontOfLensFilterTransmission {\n schemaVersion:\n FrontOfLensFilterProfileSchemaVersion;\n filterId: string;\n profileVersion: string;\n identityScope:\n \"photivra-generic-unbranded\";\n position: \"front-of-lens\";\n scientificStatus:\n FrontOfLensFilterScientificStatus;\n wavelengthNanometers: number;\n wavelengthBasis:\n Exclude<\n SpectralWavelengthBasis,\n \"unspecified\"\n >;\n transmissionKind:\n FrontOfLensFilterTransmissionModel[\"kind\"];\n /** Intensity transmittance for the declared incident polarization. */\n linearTransmissionFactor: number;\n attenuationStops: number;\n opticalDensityBase10: number;\n polarizationModeled: boolean;\n incidentPolarization: LinearPolarizationState;\n transmittedPolarization: LinearPolarizationState;\n wavelengthChangingBehaviorModeled:\n false;\n lensTransmissionIncluded: false;\n sensorOpticalStackIncluded: false;\n fieldThroughputIncluded: false;\n uncertainty:\n FrontOfLensFilterUncertainty;\n evidence: readonly EvidenceProvenance[];\n limitations: readonly string[];\n}\n\nexport interface ComposeFrontOfLensFilterTransmissionInput {\n /** Filters in light-path order (scene side first). */\n filters:\n readonly FrontOfLensFilterProfile[];\n wavelengthNanometers: number;\n wavelengthBasis:\n Exclude<\n SpectralWavelengthBasis,\n \"unspecified\"\n >;\n /** Incident scene polarization; omitted means unpolarized. */\n incidentPolarization?: LinearPolarizationState;\n}\n\nexport interface ComposedFrontOfLensFilterTransmission {\n schemaVersion:\n FrontOfLensFilterProfileSchemaVersion;\n wavelengthNanometers: number;\n wavelengthBasis:\n Exclude<\n SpectralWavelengthBasis,\n \"unspecified\"\n >;\n appliedFilterCount: number;\n components:\n readonly ResolvedFrontOfLensFilterTransmission[];\n combinedLinearTransmissionFactor:\n number;\n combinedAttenuationStops: number;\n scientificStatus:\n FrontOfLensFilterScientificStatus;\n uncertaintyPropagation:\n \"not-propagated\";\n uncertaintyLimitation: string;\n compositionModel:\n | \"independent-multiplicative-unpolarized-transmission-no-inter-filter-reflections\"\n | \"ordered-linear-stokes-mueller-no-inter-filter-reflections\";\n polarizationModeled: boolean;\n incidentPolarization: LinearPolarizationState;\n transmittedPolarization: LinearPolarizationState;\n wavelengthChangingBehaviorModeled:\n false;\n lensTransmissionIncluded: false;\n sensorOpticalStackIncluded: false;\n fieldThroughputIncluded: false;\n}\n\nfunction requireRecord(\n value: unknown,\n path: string,\n allowedKeys: readonly string[] | null\n): UnknownRecord {\n if (\n typeof value !== \"object\" ||\n value === null ||\n Array.isArray(value)\n ) {\n throw new InvalidConfigurationError(\n path + \" must be an object.\"\n );\n }\n if (allowedKeys !== null) rejectUnknownFields(value, allowedKeys, path);\n return value as UnknownRecord;\n}\n\nfunction requireNonEmptyString(\n value: unknown,\n path: string\n): string {\n if (\n typeof value !== \"string\" ||\n value.trim().length === 0\n ) {\n throw new InvalidConfigurationError(\n path + \" must be a non-empty string.\"\n );\n }\n return value.trim();\n}\n\nfunction requireFinite(\n value: unknown,\n path: string\n): number {\n if (\n typeof value !== \"number\" ||\n !Number.isFinite(value)\n ) {\n throw new InvalidConfigurationError(\n path + \" must be finite.\"\n );\n }\n return value;\n}\n\nfunction requirePositiveFinite(\n value: unknown,\n path: string\n): number {\n const parsed = requireFinite(\n value,\n path\n );\n if (parsed <= 0) {\n throw new InvalidConfigurationError(\n path +\n \" must be greater than zero.\"\n );\n }\n return parsed;\n}\n\nfunction requireNonNegativeFinite(\n value: unknown,\n path: string\n): number {\n const parsed = requireFinite(\n value,\n path\n );\n if (parsed < 0) {\n throw new InvalidConfigurationError(\n path +\n \" must be greater than or equal to zero.\"\n );\n }\n return parsed;\n}\n\nfunction requirePassiveTransmission(\n value: unknown,\n path: string\n): number {\n const parsed = requirePositiveFinite(\n value,\n path\n );\n if (parsed > 1) {\n throw new InvalidConfigurationError(\n path +\n \" must be less than or equal to one for a passive filter.\"\n );\n }\n return parsed;\n}\n\nfunction parseRange(\n value: unknown,\n path: string\n): {\n minimum: number;\n maximum: number;\n} {\n const record = requireRecord(\n value,\n path, [\"minimum\", \"maximum\"]\n );\n const minimum =\n requirePositiveFinite(\n record.minimum,\n path + \".minimum\"\n );\n const maximum =\n requirePositiveFinite(\n record.maximum,\n path + \".maximum\"\n );\n if (minimum > maximum) {\n throw new InvalidConfigurationError(\n path +\n \".minimum must be less than or equal to maximum.\"\n );\n }\n return {\n minimum,\n maximum\n };\n}\n\nfunction parseResolvedBasis(\n value: unknown,\n path: string\n): Exclude<\n SpectralWavelengthBasis,\n \"unspecified\"\n> {\n const parsed =\n parseSpectralWavelengthBasis(\n value,\n path\n );\n if (parsed === \"unspecified\") {\n throw new InvalidConfigurationError(\n path +\n ' must resolve to \"air\" or \"vacuum\".'\n );\n }\n return parsed;\n}\n\nfunction parseScientificStatus(\n value: unknown,\n path: string\n): FrontOfLensFilterScientificStatus {\n if (\n value !== \"calibrated\" &&\n value !== \"approximation\"\n ) {\n throw new InvalidConfigurationError(\n path + \" is invalid.\"\n );\n }\n return value;\n}\n\nfunction parseUncertainty(\n value: unknown,\n path: string\n): FrontOfLensFilterUncertainty {\n const record = requireRecord(\n value,\n path, null\n );\n rejectUnknownVariantFields(record, \"kind\", UNCERTAINTY_VARIANT_FIELDS, path);\n\n if (record.kind === \"relative\") {\n const fraction =\n requireNonNegativeFinite(\n record.fraction,\n path + \".fraction\"\n );\n if (fraction > 1) {\n throw new InvalidConfigurationError(\n path +\n \".fraction must be less than or equal to one.\"\n );\n }\n return {\n kind: \"relative\",\n fraction,\n basis:\n requireNonEmptyString(\n record.basis,\n path + \".basis\"\n )\n };\n }\n\n if (\n record.kind ===\n \"not-quantified\"\n ) {\n return {\n kind: \"not-quantified\",\n limitation:\n requireNonEmptyString(\n record.limitation,\n path + \".limitation\"\n )\n };\n }\n\n throw new InvalidConfigurationError(\n path + \".kind is invalid.\"\n );\n}\n\nfunction parseLimitations(\n value: unknown,\n path: string\n): readonly string[] {\n if (!Array.isArray(value)) {\n throw new InvalidConfigurationError(\n path + \" must be an array.\"\n );\n }\n const parsed = value.map(\n (entry, index) =>\n requireNonEmptyString(\n entry,\n path +\n \"[\" +\n index +\n \"]\"\n )\n );\n if (\n new Set(parsed).size !==\n parsed.length\n ) {\n throw new InvalidConfigurationError(\n path +\n \" must not contain duplicates.\"\n );\n }\n return parsed;\n}\n\nfunction parseReusableNumericEvidence(\n value: unknown,\n path: string\n): readonly EvidenceProvenance[] {\n const evidence =\n parseEvidenceList(\n value,\n path\n );\n if (\n evidence.some(\n (entry) =>\n entry.reuseStatus ===\n \"factual-reference-only\"\n )\n ) {\n throw new InvalidConfigurationError(\n path +\n \" for embedded numeric filter data must be reusable-data or photivra-owned.\"\n );\n }\n return evidence;\n}\n\nfunction parseSpectralSamples(\n value: unknown,\n path: string\n): readonly FrontOfLensFilterSpectralSample[] {\n if (\n !Array.isArray(value) ||\n value.length < 2\n ) {\n throw new InvalidConfigurationError(\n path +\n \" must contain at least two samples.\"\n );\n }\n\n let previous =\n Number.NEGATIVE_INFINITY;\n return value.map(\n (entry, index) => {\n const samplePath =\n path +\n \"[\" +\n index +\n \"]\";\n const record =\n requireRecord(\n entry,\n samplePath, [\"wavelengthNanometers\", \"linearTransmissionFactor\"]\n );\n const wavelengthNanometers =\n requirePositiveFinite(\n record.wavelengthNanometers,\n samplePath +\n \".wavelengthNanometers\"\n );\n if (\n wavelengthNanometers <=\n previous\n ) {\n throw new InvalidConfigurationError(\n path +\n \" wavelengths must be strictly increasing.\"\n );\n }\n previous =\n wavelengthNanometers;\n return {\n wavelengthNanometers,\n linearTransmissionFactor:\n requirePassiveTransmission(\n record.linearTransmissionFactor,\n samplePath +\n \".linearTransmissionFactor\"\n )\n };\n }\n );\n}\n\nfunction parseTransmission(\n value: unknown,\n path: string,\n polarizerAllowed: boolean\n): FrontOfLensFilterTransmissionModel {\n const record = requireRecord(\n value,\n path, null\n );\n rejectUnknownVariantFields(record, \"kind\", {\n \"neutral-linear-transmission\": [\"kind\", \"linearTransmissionFactor\"],\n \"neutral-optical-density\": [\"kind\", \"opticalDensityBase10\"],\n \"spectral-transmission\": [\"kind\", \"samples\"],\n \"linear-polarizer\": [\"kind\", \"principalTransmittance\", \"extinctionRatio\", \"transmissionAxisDegrees\"]\n }, path);\n\n if (record.kind === \"linear-polarizer\") {\n if (!polarizerAllowed) {\n throw new InvalidConfigurationError(\n path + '.kind \"linear-polarizer\" requires schemaVersion \"' +\n FRONT_OF_LENS_POLARIZER_PROFILE_SCHEMA_VERSION + '\".'\n );\n }\n const principal = requireRecord(\n record.principalTransmittance,\n path + \".principalTransmittance\", [\"value\", \"evidence\"]\n );\n const extinction = requireRecord(\n record.extinctionRatio,\n path + \".extinctionRatio\", [\"value\", \"evidence\"]\n );\n const ratio = requireFinite(\n extinction.value,\n path + \".extinctionRatio.value\"\n );\n if (ratio < 1) {\n throw new InvalidConfigurationError(\n path + \".extinctionRatio.value must be at least one.\"\n );\n }\n return {\n kind: \"linear-polarizer\",\n principalTransmittance: {\n value: requirePassiveTransmission(\n principal.value,\n path + \".principalTransmittance.value\"\n ),\n evidence: parseEvidenceList(\n principal.evidence,\n path + \".principalTransmittance.evidence\"\n )\n },\n extinctionRatio: {\n value: ratio,\n evidence: parseEvidenceList(\n extinction.evidence,\n path + \".extinctionRatio.evidence\"\n )\n },\n transmissionAxisDegrees: requireFinite(\n record.transmissionAxisDegrees,\n path + \".transmissionAxisDegrees\"\n )\n };\n }\n\n if (\n record.kind ===\n \"neutral-linear-transmission\"\n ) {\n const fact = requireRecord(\n record.linearTransmissionFactor,\n path +\n \".linearTransmissionFactor\", [\"value\", \"evidence\"]\n );\n return {\n kind:\n \"neutral-linear-transmission\",\n linearTransmissionFactor: {\n value:\n requirePassiveTransmission(\n fact.value,\n path +\n \".linearTransmissionFactor.value\"\n ),\n evidence:\n parseEvidenceList(\n fact.evidence,\n path +\n \".linearTransmissionFactor.evidence\"\n )\n }\n };\n }\n\n if (\n record.kind ===\n \"neutral-optical-density\"\n ) {\n const fact = requireRecord(\n record.opticalDensityBase10,\n path +\n \".opticalDensityBase10\", [\"value\", \"evidence\"]\n );\n return {\n kind:\n \"neutral-optical-density\",\n opticalDensityBase10: {\n value:\n requireNonNegativeFinite(\n fact.value,\n path +\n \".opticalDensityBase10.value\"\n ),\n evidence:\n parseEvidenceList(\n fact.evidence,\n path +\n \".opticalDensityBase10.evidence\"\n )\n }\n };\n }\n\n if (\n record.kind ===\n \"spectral-transmission\"\n ) {\n const fact = requireRecord(\n record.samples,\n path + \".samples\", [\"value\", \"evidence\"]\n );\n return {\n kind:\n \"spectral-transmission\",\n samples: {\n value:\n parseSpectralSamples(\n fact.value,\n path +\n \".samples.value\"\n ),\n evidence:\n parseReusableNumericEvidence(\n fact.evidence,\n path +\n \".samples.evidence\"\n )\n }\n };\n }\n\n throw new InvalidConfigurationError(\n path + \".kind is invalid.\"\n );\n}\n\n/**\n * Parses one generic front-of-lens transmission filter.\n *\n * Schema 0.1.0 is explicitly unbranded and unpolarized. It models only\n * passive transmission in front of the lens. It does not cover reflections\n * between stacked filters, polarization, flare or ghosting, or filters that\n * change wavelength.\n */\nexport function parseFrontOfLensFilterProfile(\n value: unknown\n): FrontOfLensFilterProfile {\n const record = requireRecord(\n value,\n \"frontOfLensFilterProfile\", [\"schemaVersion\", \"identityScope\", \"position\", \"wavelengthChangingBehaviorModeled\", \"polarizationModeled\", \"scientificStatus\", \"uncertainty\", \"wavelengthRangeNanometers\", \"transmission\", \"filterId\", \"profileVersion\", \"wavelengthBasis\", \"evidence\", \"limitations\"]\n );\n\n if (\n record.schemaVersion !==\n FRONT_OF_LENS_FILTER_PROFILE_SCHEMA_VERSION &&\n record.schemaVersion !==\n FRONT_OF_LENS_POLARIZER_PROFILE_SCHEMA_VERSION\n ) {\n throw new InvalidConfigurationError(\n 'frontOfLensFilterProfile.schemaVersion must be \"' +\n FRONT_OF_LENS_FILTER_PROFILE_SCHEMA_VERSION +\n '\" or \"' +\n FRONT_OF_LENS_POLARIZER_PROFILE_SCHEMA_VERSION +\n '\".'\n );\n }\n const schemaVersion =\n record.schemaVersion as FrontOfLensFilterProfileSchemaVersion;\n if (\n record.identityScope !==\n \"photivra-generic-unbranded\"\n ) {\n throw new InvalidConfigurationError(\n 'frontOfLensFilterProfile.identityScope must be \"photivra-generic-unbranded\".'\n );\n }\n if (\n record.position !==\n \"front-of-lens\"\n ) {\n throw new InvalidConfigurationError(\n 'frontOfLensFilterProfile.position must be \"front-of-lens\".'\n );\n }\n if (\n record.wavelengthChangingBehaviorModeled !==\n false ||\n (schemaVersion ===\n FRONT_OF_LENS_FILTER_PROFILE_SCHEMA_VERSION &&\n record.polarizationModeled !== false)\n ) {\n throw new InvalidConfigurationError(\n \"frontOfLensFilterProfile must explicitly keep polarization and wavelength-changing behavior unmodeled in schema 0.1.0.\"\n );\n }\n\n const status =\n parseScientificStatus(\n record.scientificStatus,\n \"frontOfLensFilterProfile.scientificStatus\"\n );\n const uncertainty =\n parseUncertainty(\n record.uncertainty,\n \"frontOfLensFilterProfile.uncertainty\"\n );\n\n if (\n status === \"calibrated\" &&\n uncertainty.kind !==\n \"relative\"\n ) {\n throw new InvalidConfigurationError(\n \"A calibrated filter profile requires quantified relative uncertainty.\"\n );\n }\n\n const range =\n parseRange(\n record.wavelengthRangeNanometers,\n \"frontOfLensFilterProfile.wavelengthRangeNanometers\"\n );\n const transmission =\n parseTransmission(\n record.transmission,\n \"frontOfLensFilterProfile.transmission\",\n schemaVersion ===\n FRONT_OF_LENS_POLARIZER_PROFILE_SCHEMA_VERSION\n );\n const polarizationModeled =\n transmission.kind === \"linear-polarizer\";\n if (record.polarizationModeled !== polarizationModeled) {\n throw new InvalidConfigurationError(\n \"frontOfLensFilterProfile.polarizationModeled must be true exactly for a linear-polarizer transmission.\"\n );\n }\n\n if (\n transmission.kind ===\n \"spectral-transmission\"\n ) {\n const samples =\n transmission.samples.value;\n if (\n samples[0]!\n .wavelengthNanometers >\n range.minimum ||\n samples[\n samples.length - 1\n ]!.wavelengthNanometers <\n range.maximum\n ) {\n throw new InvalidConfigurationError(\n \"Spectral filter samples must cover the declared wavelength range.\"\n );\n }\n }\n\n return {\n schemaVersion,\n filterId:\n requireNonEmptyString(\n record.filterId,\n \"frontOfLensFilterProfile.filterId\"\n ),\n profileVersion:\n requireNonEmptyString(\n record.profileVersion,\n \"frontOfLensFilterProfile.profileVersion\"\n ),\n identityScope:\n \"photivra-generic-unbranded\",\n position:\n \"front-of-lens\",\n scientificStatus:\n status,\n wavelengthBasis:\n parseResolvedBasis(\n record.wavelengthBasis,\n \"frontOfLensFilterProfile.wavelengthBasis\"\n ),\n wavelengthRangeNanometers:\n range,\n transmission,\n uncertainty,\n polarizationModeled,\n wavelengthChangingBehaviorModeled:\n false,\n evidence:\n parseEvidenceList(\n record.evidence,\n \"frontOfLensFilterProfile.evidence\"\n ),\n limitations:\n parseLimitations(\n record.limitations,\n \"frontOfLensFilterProfile.limitations\"\n )\n };\n}\n\nfunction interpolateSpectralTransmission(\n samples:\n readonly FrontOfLensFilterSpectralSample[],\n wavelengthNanometers: number\n): number {\n const first =\n samples[0]!;\n const last =\n samples[\n samples.length - 1\n ]!;\n\n if (\n wavelengthNanometers ===\n first.wavelengthNanometers\n ) {\n return first\n .linearTransmissionFactor;\n }\n\n for (\n let index = 1;\n index < samples.length;\n index += 1\n ) {\n const right =\n samples[index]!;\n if (\n wavelengthNanometers <=\n right.wavelengthNanometers\n ) {\n const left =\n samples[\n index - 1\n ]!;\n if (\n wavelengthNanometers ===\n right.wavelengthNanometers\n ) {\n return right\n .linearTransmissionFactor;\n }\n const phase =\n (wavelengthNanometers -\n left.wavelengthNanometers) /\n (right.wavelengthNanometers -\n left.wavelengthNanometers);\n return (\n left\n .linearTransmissionFactor +\n phase *\n (right\n .linearTransmissionFactor -\n left\n .linearTransmissionFactor)\n );\n }\n }\n\n return last\n .linearTransmissionFactor;\n}\n\nfunction scientificWavelength(\n value: number\n): number {\n if (\n !Number.isFinite(value) ||\n value <= 0\n ) {\n throw new InvalidScientificInputError(\n \"wavelengthNanometers must be finite and greater than zero.\"\n );\n }\n return value;\n}\n\nfunction transmissionEvidence(\n transmission:\n FrontOfLensFilterTransmissionModel\n): readonly EvidenceProvenance[] {\n if (\n transmission.kind ===\n \"neutral-linear-transmission\"\n ) {\n return transmission\n .linearTransmissionFactor\n .evidence;\n }\n if (\n transmission.kind ===\n \"neutral-optical-density\"\n ) {\n return transmission\n .opticalDensityBase10\n .evidence;\n }\n if (transmission.kind === \"linear-polarizer\") {\n return [\n ...transmission.principalTransmittance.evidence,\n ...transmission.extinctionRatio.evidence\n ];\n }\n return transmission\n .samples.evidence;\n}\n\n/** Linear Stokes vector (S0, S1, S2); circular S3 is not modeled. */\ninterface LinearStokes {\n s0: number;\n s1: number;\n s2: number;\n}\n\nconst UNPOLARIZED: LinearPolarizationState = Object.freeze({\n degreeOfLinearPolarization: 0,\n angleDegrees: 0\n});\n\nfunction parsePolarizationState(\n value: LinearPolarizationState | undefined,\n path: string\n): LinearPolarizationState {\n if (value === undefined) {\n return { ...UNPOLARIZED };\n }\n if (typeof value !== \"object\" || value === null) {\n throw new InvalidConfigurationError(path + \" must be an object.\");\n }\n const degree = value.degreeOfLinearPolarization;\n const angle = value.angleDegrees;\n if (\n typeof degree !== \"number\" ||\n !Number.isFinite(degree) ||\n degree < 0 ||\n degree > 1\n ) {\n throw new InvalidScientificInputError(\n path + \".degreeOfLinearPolarization must lie in [0, 1].\"\n );\n }\n if (typeof angle !== \"number\" || !Number.isFinite(angle)) {\n throw new InvalidScientificInputError(\n path + \".angleDegrees must be finite.\"\n );\n }\n return { degreeOfLinearPolarization: degree, angleDegrees: angle };\n}\n\nfunction stokesFromState(state: LinearPolarizationState): LinearStokes {\n const twice = (2 * state.angleDegrees * Math.PI) / 180;\n return {\n s0: 1,\n s1: state.degreeOfLinearPolarization * Math.cos(twice),\n s2: state.degreeOfLinearPolarization * Math.sin(twice)\n };\n}\n\nfunction stateFromStokes(stokes: LinearStokes): LinearPolarizationState {\n const polarized = Math.hypot(stokes.s1, stokes.s2);\n const degree = Math.min(1, polarized / stokes.s0);\n if (degree === 0) {\n return { ...UNPOLARIZED };\n }\n let angle = (Math.atan2(stokes.s2, stokes.s1) * 90) / Math.PI;\n if (angle < 0) angle += 180;\n return { degreeOfLinearPolarization: degree, angleDegrees: angle };\n}\n\n/**\n * Mueller matrix of a linear diattenuator (principal intensity transmittances k1 along the axis\n * and k2 across it, axis at theta) applied to a linear Stokes vector.\n */\nfunction applyLinearPolarizer(\n stokes: LinearStokes,\n k1: number,\n k2: number,\n axisDegrees: number\n): LinearStokes {\n const twice = (2 * axisDegrees * Math.PI) / 180;\n const c = Math.cos(twice);\n const sn = Math.sin(twice);\n const sum = (k1 + k2) / 2;\n const difference = (k1 - k2) / 2;\n const geometric = Math.sqrt(k1 * k2);\n return {\n s0: sum * stokes.s0 + difference * (c * stokes.s1 + sn * stokes.s2),\n s1:\n difference * c * stokes.s0 +\n (sum * c * c + geometric * sn * sn) * stokes.s1 +\n (sum - geometric) * c * sn * stokes.s2,\n s2:\n difference * sn * stokes.s0 +\n (sum - geometric) * c * sn * stokes.s1 +\n (sum * sn * sn + geometric * c * c) * stokes.s2\n };\n}\n\ninterface ResolvedComponent {\n resolved: ResolvedFrontOfLensFilterTransmission;\n outgoing: LinearStokes;\n}\n\nfunction resolveComponent(\n input: ResolveFrontOfLensFilterTransmissionInput,\n incoming: LinearStokes\n): ResolvedComponent {\n const profile =\n parseFrontOfLensFilterProfile(\n input.profile\n );\n const wavelength =\n scientificWavelength(\n input.wavelengthNanometers\n );\n\n if (\n input.wavelengthBasis !==\n profile.wavelengthBasis\n ) {\n throw new InvalidScientificInputError(\n \"Filter and requested wavelength bases must match; implicit air/vacuum conversion is not performed.\"\n );\n }\n if (\n wavelength <\n profile\n .wavelengthRangeNanometers\n .minimum ||\n wavelength >\n profile\n .wavelengthRangeNanometers\n .maximum\n ) {\n throw new InvalidScientificInputError(\n \"Requested wavelength lies outside the filter applicability range.\"\n );\n }\n\n let factor: number;\n let outgoing: LinearStokes;\n const transmission =\n profile.transmission;\n\n if (\n transmission.kind ===\n \"linear-polarizer\"\n ) {\n const k1 = transmission.principalTransmittance.value;\n const k2 = k1 / transmission.extinctionRatio.value;\n outgoing = applyLinearPolarizer(\n incoming,\n k1,\n k2,\n transmission.transmissionAxisDegrees\n );\n factor = outgoing.s0 / incoming.s0;\n } else {\n if (\n transmission.kind ===\n \"neutral-linear-transmission\"\n ) {\n factor =\n transmission\n .linearTransmissionFactor\n .value;\n } else if (\n transmission.kind ===\n \"neutral-optical-density\"\n ) {\n factor =\n Math.pow(\n 10,\n -transmission\n .opticalDensityBase10\n .value\n );\n } else {\n factor =\n interpolateSpectralTransmission(\n transmission.samples.value,\n wavelength\n );\n }\n outgoing = {\n s0: incoming.s0 * factor,\n s1: incoming.s1 * factor,\n s2: incoming.s2 * factor\n };\n }\n\n if (\n !Number.isFinite(factor) ||\n factor <= 0 ||\n factor > 1\n ) {\n throw new InvalidScientificInputError(\n \"Resolved passive filter transmission must remain finite and in (0, 1].\"\n );\n }\n\n const attenuationStops =\n -Math.log2(factor);\n const opticalDensityBase10 =\n -Math.log10(factor);\n\n if (\n !Number.isFinite(\n attenuationStops\n ) ||\n !Number.isFinite(\n opticalDensityBase10\n )\n ) {\n throw new InvalidScientificInputError(\n \"Resolved filter attenuation diagnostics must remain finite.\"\n );\n }\n\n const polarizer = transmission.kind === \"linear-polarizer\";\n return {\n outgoing,\n resolved: {\n schemaVersion:\n profile.schemaVersion,\n filterId:\n profile.filterId,\n profileVersion:\n profile.profileVersion,\n identityScope:\n \"photivra-generic-unbranded\",\n position:\n \"front-of-lens\",\n scientificStatus:\n profile.scientificStatus,\n wavelengthNanometers:\n wavelength,\n wavelengthBasis:\n input.wavelengthBasis,\n transmissionKind:\n transmission.kind,\n linearTransmissionFactor:\n factor,\n attenuationStops,\n opticalDensityBase10,\n polarizationModeled:\n polarizer,\n incidentPolarization:\n stateFromStokes(incoming),\n transmittedPolarization:\n stateFromStokes(outgoing),\n wavelengthChangingBehaviorModeled:\n false,\n lensTransmissionIncluded:\n false,\n sensorOpticalStackIncluded:\n false,\n fieldThroughputIncluded:\n false,\n uncertainty:\n profile.uncertainty,\n evidence: [\n ...profile.evidence,\n ...transmissionEvidence(\n transmission\n )\n ],\n limitations: [\n ...profile.limitations,\n \"Front-of-lens transmission is independent of lens aperture geometry, focus/DOF, diffraction and sensor optical-stack response.\",\n polarizer\n ? \"Linear diattenuator on linear Stokes parameters; circular polarization, retardance, angle-of-incidence dependence and inter-filter reflections/flare/ghosting are not modeled.\"\n : \"Polarization and inter-filter reflections/flare/ghosting are not modeled.\"\n ]\n }\n };\n}\n\n/**\n * Resolves one passive filter at one wavelength. Non-polarizing filters scale all Stokes\n * components equally, so their transmission does not depend on the incident polarization.\n */\nexport function resolveFrontOfLensFilterTransmission(\n input:\n ResolveFrontOfLensFilterTransmissionInput\n): ResolvedFrontOfLensFilterTransmission {\n requireInputKeys(input, \"resolveFrontOfLensFilterTransmission\", [\"profile\", \"wavelengthNanometers\", \"wavelengthBasis\", \"incidentPolarization\"]);\n return resolveComponent(\n input,\n stokesFromState(\n parsePolarizationState(\n input.incidentPolarization,\n \"incidentPolarization\"\n )\n )\n ).resolved;\n}\n\n/**\n * Combines several passive front-of-lens filters at one wavelength, in light-path order, and keeps\n * each filter's identity. Without a polarizer the result is the product of the transmissions. With\n * one, linear Stokes parameters pass through the Mueller matrices in order.\n */\nexport function composeFrontOfLensFilterTransmission(\n input:\n ComposeFrontOfLensFilterTransmissionInput\n): ComposedFrontOfLensFilterTransmission {\n requireInputKeys(input, \"composeFrontOfLensFilterTransmission\", [\"filters\", \"wavelengthNanometers\", \"wavelengthBasis\", \"incidentPolarization\"]);\n if (\n !Array.isArray(\n input.filters\n ) ||\n input.filters.length === 0\n ) {\n throw new InvalidConfigurationError(\n \"filters must be a non-empty array.\"\n );\n }\n\n const incidentPolarization = parsePolarizationState(\n input.incidentPolarization,\n \"incidentPolarization\"\n );\n const incident = stokesFromState(incidentPolarization);\n let stokes = incident;\n const components: ResolvedFrontOfLensFilterTransmission[] = [];\n for (const profile of input.filters) {\n const component = resolveComponent(\n {\n profile,\n wavelengthNanometers:\n input.wavelengthNanometers,\n wavelengthBasis:\n input.wavelengthBasis\n },\n stokes\n );\n components.push(component.resolved);\n stokes = component.outgoing;\n }\n\n const combined = stokes.s0 / incident.s0;\n if (\n !Number.isFinite(combined) ||\n combined <= 0 ||\n combined > 1\n ) {\n throw new InvalidScientificInputError(\n \"Combined passive filter transmission must remain finite and in (0, 1].\"\n );\n }\n\n const stops =\n -Math.log2(combined);\n if (!Number.isFinite(stops)) {\n throw new InvalidScientificInputError(\n \"Combined filter attenuation must remain finite.\"\n );\n }\n\n const polarizationModeled = components.some(\n (component) => component.polarizationModeled\n );\n return {\n schemaVersion: polarizationModeled\n ? FRONT_OF_LENS_POLARIZER_PROFILE_SCHEMA_VERSION\n : FRONT_OF_LENS_FILTER_PROFILE_SCHEMA_VERSION,\n wavelengthNanometers:\n scientificWavelength(\n input.wavelengthNanometers\n ),\n wavelengthBasis:\n input.wavelengthBasis,\n appliedFilterCount:\n components.length,\n components,\n combinedLinearTransmissionFactor:\n combined,\n combinedAttenuationStops:\n stops,\n scientificStatus:\n components.some(\n (component) =>\n component\n .scientificStatus ===\n \"approximation\"\n )\n ? \"approximation\"\n : \"calibrated\",\n uncertaintyPropagation:\n \"not-propagated\",\n uncertaintyLimitation:\n \"Component filter uncertainties are preserved individually; aggregate numeric uncertainty is not propagated because independence/correlation is not assumed.\",\n compositionModel: polarizationModeled\n ? \"ordered-linear-stokes-mueller-no-inter-filter-reflections\"\n : \"independent-multiplicative-unpolarized-transmission-no-inter-filter-reflections\",\n polarizationModeled,\n incidentPolarization,\n transmittedPolarization:\n stateFromStokes(stokes),\n wavelengthChangingBehaviorModeled:\n false,\n lensTransmissionIncluded:\n false,\n sensorOpticalStackIncluded:\n false,\n fieldThroughputIncluded:\n false\n };\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @see docs/PHYSICS_FOUNDATION.md for equations, coordinate
|
|
8
|
-
* limits.
|
|
2
|
+
* Generic illumination falloff across the image (vignetting), as a factor that multiplies linear
|
|
3
|
+
* light.
|
|
4
|
+
*
|
|
5
|
+
* A profile is accepted only if its relative throughput stays strictly positive and never exceeds 1
|
|
6
|
+
* (the value on the optical axis) anywhere in its declared range.
|
|
7
|
+
* @see docs/PHYSICS_FOUNDATION.md for the equations, units, coordinate conventions, known blockers
|
|
8
|
+
* and support limits.
|
|
9
9
|
*/
|
|
10
10
|
import { type CalculationResult } from "../core/calculation-result.js";
|
|
11
11
|
import type { LensFieldPointMm } from "./radial-distortion.js";
|
|
@@ -36,8 +36,8 @@ export interface CalculateIlluminationVignettingInput {
|
|
|
36
36
|
/**
|
|
37
37
|
* Ideal image-plane field position relative to the optical axis, in mm.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* Throughput is evaluated at this ideal field coordinate. Geometric
|
|
40
|
+
* distortion is neither applied nor inverted.
|
|
41
41
|
*/
|
|
42
42
|
imagePointMm: LensFieldPointMm;
|
|
43
43
|
profile: IlluminationVignettingProfile;
|
|
@@ -46,9 +46,9 @@ export interface IlluminationVignetting {
|
|
|
46
46
|
imagePointMm: LensFieldPointMm;
|
|
47
47
|
normalizedRadius: number;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* Factor that multiplies scene-linear or channel-linear signal.
|
|
50
50
|
*
|
|
51
|
-
* 1 means no attenuation
|
|
51
|
+
* 1 means no attenuation. Values must stay in (0, 1].
|
|
52
52
|
*/
|
|
53
53
|
linearThroughputFactor: number;
|
|
54
54
|
/** Positive exposure loss relative to the optical axis, in stops. */
|
|
@@ -57,12 +57,11 @@ export interface IlluminationVignetting {
|
|
|
57
57
|
profileMaximumThroughputFactor: number;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Calculates generic
|
|
61
|
-
* linear
|
|
60
|
+
* Calculates generic illumination falloff across the image (vignetting) as a
|
|
61
|
+
* factor that multiplies linear light.
|
|
62
62
|
*
|
|
63
|
-
*
|
|
64
|
-
* positive and never exceeds the optical
|
|
65
|
-
*
|
|
63
|
+
* A profile is accepted only if its relative throughput stays strictly
|
|
64
|
+
* positive and never exceeds 1 (the value on the optical axis) anywhere in
|
|
65
|
+
* its declared range.
|
|
66
66
|
*/
|
|
67
67
|
export declare function calculateIlluminationVignetting(input: CalculateIlluminationVignettingInput): CalculationResult<IlluminationVignetting>;
|
|
68
|
-
//# sourceMappingURL=illumination-vignetting.d.ts.map
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @see docs/PHYSICS_FOUNDATION.md for equations, coordinate
|
|
9
|
-
* limits.
|
|
3
|
+
* Generic illumination falloff across the image (vignetting), as a factor that multiplies linear
|
|
4
|
+
* light.
|
|
5
|
+
*
|
|
6
|
+
* A profile is accepted only if its relative throughput stays strictly positive and never exceeds 1
|
|
7
|
+
* (the value on the optical axis) anywhere in its declared range.
|
|
8
|
+
* @see docs/PHYSICS_FOUNDATION.md for the equations, units, coordinate conventions, known blockers
|
|
9
|
+
* and support limits.
|
|
10
10
|
*/
|
|
11
11
|
import { approximationResult } from "../core/calculation-result.js";
|
|
12
12
|
import { InvalidScientificInputError, requirePositiveFinite } from "../core/validation.js";
|
|
13
|
+
import { requireInputObject, requireInputKeys } from "../core/record-validation.js";
|
|
13
14
|
function requireFinite(name, value) {
|
|
14
15
|
if (!Number.isFinite(value)) {
|
|
15
16
|
throw new InvalidScientificInputError(`${name} must be finite.`);
|
|
@@ -24,22 +25,42 @@ function throughputFromSquaredRadius(squaredRadius, coefficients) {
|
|
|
24
25
|
squaredRadius *
|
|
25
26
|
squaredRadius);
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Real roots of dT/ds, where s = rho². Every interior maximum or minimum of the throughput lies at
|
|
30
|
+
* one of these roots. The validator checks them along with both ends of the range. So a profile
|
|
31
|
+
* that dips below zero, or rises above one, mid-field is rejected even when both ends are valid.
|
|
32
|
+
*
|
|
33
|
+
* The quadratic is scaled before solving and uses the numerically stable q-form roots. This stops a
|
|
34
|
+
* tiny cubic term from erasing the smaller root through cancellation. The radial-distortion
|
|
35
|
+
* validator uses the same scheme.
|
|
36
|
+
*/
|
|
27
37
|
function throughputCriticalSquaredRadii(coefficients) {
|
|
28
|
-
// For s = rho²:
|
|
29
38
|
// T(s) = 1 + r2*s + r4*s² + r6*s³
|
|
30
39
|
// dT/ds = r2 + 2*r4*s + 3*r6*s²
|
|
31
40
|
const a = 3 * coefficients.r6;
|
|
32
41
|
const b = 2 * coefficients.r4;
|
|
33
42
|
const c = coefficients.r2;
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
const coefficientScale = Math.max(Math.abs(a), Math.abs(b), Math.abs(c));
|
|
44
|
+
if (coefficientScale === 0) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
const scaledA = a / coefficientScale;
|
|
48
|
+
const scaledB = b / coefficientScale;
|
|
49
|
+
const scaledC = c / coefficientScale;
|
|
50
|
+
if (scaledA === 0) {
|
|
51
|
+
return scaledB === 0 ? [] : [-scaledC / scaledB];
|
|
36
52
|
}
|
|
37
|
-
const discriminant =
|
|
53
|
+
const discriminant = scaledB * scaledB - 4 * scaledA * scaledC;
|
|
38
54
|
if (discriminant < 0) {
|
|
39
55
|
return [];
|
|
40
56
|
}
|
|
41
57
|
const root = Math.sqrt(discriminant);
|
|
42
|
-
|
|
58
|
+
const q = -0.5 * (scaledB + (scaledB >= 0 ? root : -root));
|
|
59
|
+
if (q === 0) {
|
|
60
|
+
// Only when b = c = 0: the double root is s = 0.
|
|
61
|
+
return [0];
|
|
62
|
+
}
|
|
63
|
+
return [q / scaledA, scaledC / q];
|
|
43
64
|
}
|
|
44
65
|
function validateProfile(profile) {
|
|
45
66
|
requirePositiveFinite("profile.normalizationRadiusMm", profile.normalizationRadiusMm);
|
|
@@ -83,14 +104,16 @@ function assumptions() {
|
|
|
83
104
|
];
|
|
84
105
|
}
|
|
85
106
|
/**
|
|
86
|
-
* Calculates generic
|
|
87
|
-
* linear
|
|
107
|
+
* Calculates generic illumination falloff across the image (vignetting) as a
|
|
108
|
+
* factor that multiplies linear light.
|
|
88
109
|
*
|
|
89
|
-
*
|
|
90
|
-
* positive and never exceeds the optical
|
|
91
|
-
*
|
|
110
|
+
* A profile is accepted only if its relative throughput stays strictly
|
|
111
|
+
* positive and never exceeds 1 (the value on the optical axis) anywhere in
|
|
112
|
+
* its declared range.
|
|
92
113
|
*/
|
|
93
114
|
export function calculateIlluminationVignetting(input) {
|
|
115
|
+
requireInputKeys(input, "calculateIlluminationVignetting", ["imagePointMm", "profile"]);
|
|
116
|
+
requireInputObject(input.imagePointMm, "imagePointMm");
|
|
94
117
|
requireFinite("imagePointMm.x", input.imagePointMm.x);
|
|
95
118
|
requireFinite("imagePointMm.y", input.imagePointMm.y);
|
|
96
119
|
const profile = validateProfile(input.profile);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"illumination-vignetting.js","sourceRoot":"","sources":["../../src/optics/illumination-vignetting.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;GAQG;AAEH,OAAO,EACL,mBAAmB,EAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AA8D/B,SAAS,aAAa,CAAC,IAAY,EA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C,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAEzC,OAAO,mBAAmB,CACxB;QACE,YAAY,EAAE,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE;QACvC,gBAAgB;QAChB,sBAAsB;QACtB,gBAAgB;QAChB,8BAA8B,EAAE,OAAO,CAAC,uBAAuB;QAC/D,8BAA8B,EAAE,OAAO,CAAC,uBAAuB;KAChE,EACD,wCAAwC,EACxC,OAAO,EACP,WAAW,EAAE,CACd,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"illumination-vignetting.js","sourceRoot":"","sources":["../../src/optics/illumination-vignetting.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;GAQG;AAEH,OAAO,EACL,mBAAmB,EAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AA6DpF,SAAS,aAAa,CAAC,IAAY,EAAE,KAAa;IAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,2BAA2B,CAAC,GAAG,IAAI,kBAAkB,CAAC,CAAC;IACnE,CAAC;AACH,CAAC;AAED,SAAS,2BAA2B,CAClC,aAAqB,EACrB,YAAgD;IAEhD,OAAO,CACL,CAAC;QACD,YAAY,CAAC,EAAE,GAAG,aAAa;QAC/B,YAAY,CAAC,EAAE,GAAG,aAAa,GAAG,aAAa;QAC/C,YAAY,CAAC,EAAE;YACb,aAAa;YACb,aAAa;YACb,aAAa,CAChB,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,8BAA8B,CACrC,YAAgD;IAEhD,kCAAkC;IAClC,gCAAgC;IAChC,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,EAAE,CAAC;IAC9B,MAAM,CAAC,GAA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AA2B,CACxD,aAAa,EACb,OAAO,CAAC,YAAY,CACrB,CAAC;IAEF,MAAM,gBAAgB,GACpB,sBAAsB,KAAK,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAEzC,OAAO,mBAAmB,CACxB;QACE,YAAY,EAAE,EAAE,GAAG,KAAK,CAAC,YAAY,EAAE;QACvC,gBAAgB;QAChB,sBAAsB;QACtB,gBAAgB;QAChB,8BAA8B,EAAE,OAAO,CAAC,uBAAuB;QAC/D,8BAA8B,EAAE,OAAO,CAAC,uBAAuB;KAChE,EACD,wCAAwC,EACxC,OAAO,EACP,WAAW,EAAE,CACd,CAAC;AACJ,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Generic illumination falloff across the image (vignetting), as a factor that multiplies linear\n * light.\n *\n * A profile is accepted only if its relative throughput stays strictly positive and never exceeds 1\n * (the value on the optical axis) anywhere in its declared range.\n * @see docs/PHYSICS_FOUNDATION.md for the equations, units, coordinate conventions, known blockers\n * and support limits.\n */\n\nimport {\n approximationResult,\n type CalculationResult\n} from \"../core/calculation-result.js\";\nimport {\n InvalidScientificInputError,\n requirePositiveFinite\n} from \"../core/validation.js\";\nimport type { LensFieldPointMm } from \"./radial-distortion.js\";\nimport { requireInputObject, requireInputKeys } from \"../core/record-validation.js\";\n\nexport interface IlluminationVignettingCoefficients {\n /** Coefficient on normalized radius squared. */\n r2: number;\n /** Coefficient on normalized radius to the fourth power. */\n r4: number;\n /** Coefficient on normalized radius to the sixth power. */\n r6: number;\n}\n\nexport interface IlluminationVignettingProfile {\n /** Physical image-plane radius used to normalize field position, in mm. */\n normalizationRadiusMm: number;\n /** Maximum normalized image-plane radius over which the profile is valid. */\n maximumNormalizedRadius: number;\n /**\n * Generic radial relative-illumination coefficients.\n *\n * Relative linear throughput is:\n * 1 + r2 * rho^2 + r4 * rho^4 + r6 * rho^6\n *\n * where rho is physical image-plane radius / normalizationRadiusMm.\n */\n coefficients: IlluminationVignettingCoefficients;\n}\n\nexport interface CalculateIlluminationVignettingInput {\n /**\n * Ideal image-plane field position relative to the optical axis, in mm.\n *\n * Throughput is evaluated at this ideal field coordinate. Geometric\n * distortion is neither applied nor inverted.\n */\n imagePointMm: LensFieldPointMm;\n profile: IlluminationVignettingProfile;\n}\n\nexport interface IlluminationVignetting {\n imagePointMm: LensFieldPointMm;\n normalizedRadius: number;\n /**\n * Factor that multiplies scene-linear or channel-linear signal.\n *\n * 1 means no attenuation. Values must stay in (0, 1].\n */\n linearThroughputFactor: number;\n /** Positive exposure loss relative to the optical axis, in stops. */\n attenuationStops: number;\n profileMinimumThroughputFactor: number;\n profileMaximumThroughputFactor: number;\n}\n\ninterface ValidatedIlluminationProfile {\n normalizationRadiusMm: number;\n maximumNormalizedRadius: number;\n coefficients: IlluminationVignettingCoefficients;\n minimumThroughputFactor: number;\n maximumThroughputFactor: number;\n}\n\nfunction requireFinite(name: string, value: number): void {\n if (!Number.isFinite(value)) {\n throw new InvalidScientificInputError(`${name} must be finite.`);\n }\n}\n\nfunction throughputFromSquaredRadius(\n squaredRadius: number,\n coefficients: IlluminationVignettingCoefficients\n): number {\n return (\n 1 +\n coefficients.r2 * squaredRadius +\n coefficients.r4 * squaredRadius * squaredRadius +\n coefficients.r6 *\n squaredRadius *\n squaredRadius *\n squaredRadius\n );\n}\n\n/**\n * Real roots of dT/ds, where s = rho². Every interior maximum or minimum of the throughput lies at\n * one of these roots. The validator checks them along with both ends of the range. So a profile\n * that dips below zero, or rises above one, mid-field is rejected even when both ends are valid.\n *\n * The quadratic is scaled before solving and uses the numerically stable q-form roots. This stops a\n * tiny cubic term from erasing the smaller root through cancellation. The radial-distortion\n * validator uses the same scheme.\n */\nfunction throughputCriticalSquaredRadii(\n coefficients: IlluminationVignettingCoefficients\n): number[] {\n // T(s) = 1 + r2*s + r4*s² + r6*s³\n // dT/ds = r2 + 2*r4*s + 3*r6*s²\n const a = 3 * coefficients.r6;\n const b = 2 * coefficients.r4;\n const c = coefficients.r2;\n const coefficientScale = Math.max(Math.abs(a), Math.abs(b), Math.abs(c));\n if (coefficientScale === 0) {\n return [];\n }\n const scaledA = a / coefficientScale;\n const scaledB = b / coefficientScale;\n const scaledC = c / coefficientScale;\n\n if (scaledA === 0) {\n return scaledB === 0 ? [] : [-scaledC / scaledB];\n }\n\n const discriminant = scaledB * scaledB - 4 * scaledA * scaledC;\n if (discriminant < 0) {\n return [];\n }\n const root = Math.sqrt(discriminant);\n const q = -0.5 * (scaledB + (scaledB >= 0 ? root : -root));\n if (q === 0) {\n // Only when b = c = 0: the double root is s = 0.\n return [0];\n }\n return [q / scaledA, scaledC / q];\n}\n\nfunction validateProfile(\n profile: IlluminationVignettingProfile\n): ValidatedIlluminationProfile {\n requirePositiveFinite(\n \"profile.normalizationRadiusMm\",\n profile.normalizationRadiusMm\n );\n requirePositiveFinite(\n \"profile.maximumNormalizedRadius\",\n profile.maximumNormalizedRadius\n );\n requireFinite(\"profile.coefficients.r2\", profile.coefficients.r2);\n requireFinite(\"profile.coefficients.r4\", profile.coefficients.r4);\n requireFinite(\"profile.coefficients.r6\", profile.coefficients.r6);\n\n const maximumSquaredRadius =\n profile.maximumNormalizedRadius * profile.maximumNormalizedRadius;\n const candidates = [\n 0,\n maximumSquaredRadius,\n ...throughputCriticalSquaredRadii(profile.coefficients).filter(\n (value) => value > 0 && value < maximumSquaredRadius\n )\n ];\n const throughputs = candidates.map((squaredRadius) =>\n throughputFromSquaredRadius(squaredRadius, profile.coefficients)\n );\n const minimumThroughputFactor = Math.min(...throughputs);\n const maximumThroughputFactor = Math.max(...throughputs);\n\n if (\n !Number.isFinite(minimumThroughputFactor) ||\n minimumThroughputFactor <= 0\n ) {\n throw new InvalidScientificInputError(\n \"Illumination vignetting profile must keep relative linear throughput strictly greater than zero over maximumNormalizedRadius.\"\n );\n }\n\n if (\n !Number.isFinite(maximumThroughputFactor) ||\n maximumThroughputFactor > 1\n ) {\n throw new InvalidScientificInputError(\n \"Illumination vignetting profile must not amplify relative linear throughput above the optical-axis value of 1.\"\n );\n }\n\n return {\n normalizationRadiusMm: profile.normalizationRadiusMm,\n maximumNormalizedRadius: profile.maximumNormalizedRadius,\n coefficients: { ...profile.coefficients },\n minimumThroughputFactor,\n maximumThroughputFactor\n };\n}\n\nfunction assumptions(): readonly string[] {\n return [\n \"Generic rotationally symmetric illumination-vignetting approximation evaluated from ideal image-plane field radius\",\n \"Relative linear throughput is normalized to 1 on the optical axis\",\n \"The model attenuates scene-linear/channel-linear signal only and must be applied before display/gamma encoding\",\n \"The model changes throughput only; it does not alter field coordinates, pupil shape, PSF shape, bokeh, or focus\",\n \"Mechanical/pupil vignetting and cat's-eye bokeh are separate pupil/PSF effects\",\n \"The profile is a generic caller-supplied radial approximation, not calibrated radiometry or a named-lens measurement\"\n ];\n}\n\n/**\n * Calculates generic illumination falloff across the image (vignetting) as a\n * factor that multiplies linear light.\n *\n * A profile is accepted only if its relative throughput stays strictly\n * positive and never exceeds 1 (the value on the optical axis) anywhere in\n * its declared range.\n */\nexport function calculateIlluminationVignetting(\n input: CalculateIlluminationVignettingInput\n): CalculationResult<IlluminationVignetting> {\n requireInputKeys(input, \"calculateIlluminationVignetting\", [\"imagePointMm\", \"profile\"]);\n requireInputObject(input.imagePointMm, \"imagePointMm\");\n requireFinite(\"imagePointMm.x\", input.imagePointMm.x);\n requireFinite(\"imagePointMm.y\", input.imagePointMm.y);\n\n const profile = validateProfile(input.profile);\n const radiusMm = Math.hypot(input.imagePointMm.x, input.imagePointMm.y);\n const normalizedRadius = radiusMm / profile.normalizationRadiusMm;\n\n if (normalizedRadius > profile.maximumNormalizedRadius) {\n throw new InvalidScientificInputError(\n \"imagePointMm lies outside the illumination vignetting profile maximumNormalizedRadius.\"\n );\n }\n\n const squaredRadius = normalizedRadius * normalizedRadius;\n const linearThroughputFactor = throughputFromSquaredRadius(\n squaredRadius,\n profile.coefficients\n );\n\n const attenuationStops =\n linearThroughputFactor === 1\n ? 0\n : -Math.log2(linearThroughputFactor);\n\n return approximationResult(\n {\n imagePointMm: { ...input.imagePointMm },\n normalizedRadius,\n linearThroughputFactor,\n attenuationStops,\n profileMinimumThroughputFactor: profile.minimumThroughputFactor,\n profileMaximumThroughputFactor: profile.maximumThroughputFactor\n },\n \"generic-radial-illumination-vignetting\",\n \"1.0.0\",\n assumptions()\n );\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const IRRADIANCE_CONVOLUTION_SCHEMA_VERSION: "0.1.0";
|
|
2
|
+
export declare const IRRADIANCE_CONVOLUTION_LIMITS: Readonly<{
|
|
3
|
+
maximumPixels: 24000000;
|
|
4
|
+
maximumDimension: 16384;
|
|
5
|
+
maximumKernelRadius: 32;
|
|
6
|
+
maximumPatchCount: 4096;
|
|
7
|
+
maximumKernelWeights: 4194304;
|
|
8
|
+
/** A kernel may lose energy (vignetting, transmission) but may not create it, beyond rounding slack. */
|
|
9
|
+
maximumKernelSum: number;
|
|
10
|
+
/** Inputs larger than this are rejected so that float32 execution cannot overflow. */
|
|
11
|
+
maximumSampleMagnitude: number;
|
|
12
|
+
}>;
|
|
13
|
+
export interface IrradianceConvolutionInput {
|
|
14
|
+
schemaVersion: typeof IRRADIANCE_CONVOLUTION_SCHEMA_VERSION;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
/** Row-major samples. Finite, non-negative, linear and additive (for example irradiance, or expected photons per site). */
|
|
18
|
+
samples: Float32Array | Float64Array;
|
|
19
|
+
/** Kernel half-width in grid sites. Each kernel is (2r+1)×(2r+1). */
|
|
20
|
+
kernelRadius: number;
|
|
21
|
+
/** Patch size in grid sites. The last row and column of patches may be partial. */
|
|
22
|
+
patchWidth: number;
|
|
23
|
+
patchHeight: number;
|
|
24
|
+
/**
|
|
25
|
+
* Finite non-negative weights, `[patchRow][patchColumn][v + r][u + r]`, one kernel per patch in
|
|
26
|
+
* row-major patch order. Each kernel sums to at most 1 (+2^-20 rounding slack).
|
|
27
|
+
*/
|
|
28
|
+
kernels: Float32Array | Float64Array;
|
|
29
|
+
boundary: "zero-outside-grid";
|
|
30
|
+
}
|
|
31
|
+
/** Validated, immutable geometry of a convolution request. Sample arrays are borrowed, not copied. */
|
|
32
|
+
export interface IrradianceConvolutionPlan {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
kernelRadius: number;
|
|
36
|
+
kernelSize: number;
|
|
37
|
+
tapCount: number;
|
|
38
|
+
patchWidth: number;
|
|
39
|
+
patchHeight: number;
|
|
40
|
+
patchColumns: number;
|
|
41
|
+
patchRows: number;
|
|
42
|
+
/** Largest kernel sum and largest input magnitude. The float32 error bound uses them. */
|
|
43
|
+
maximumKernelSum: number;
|
|
44
|
+
maximumSampleMagnitude: number;
|
|
45
|
+
}
|
|
46
|
+
/** Validates the request and returns its plan. Every sample and weight is checked once. */
|
|
47
|
+
export declare function calculateIrradianceConvolutionPlan(input: IrradianceConvolutionInput): IrradianceConvolutionPlan;
|
|
48
|
+
/**
|
|
49
|
+
* Reference gather for output rows `[y0, y1)`, written into `output` at `(y - y0) * width + x`.
|
|
50
|
+
* The summation order (v outer, u inner, both ascending) is part of the contract shared with the
|
|
51
|
+
* WGSL (WebGPU shader) kernel.
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export declare function convolveIrradianceRows(plan: IrradianceConvolutionPlan, samples: Float32Array | Float64Array, kernels: Float32Array | Float64Array, y0: number, y1: number, output: Float64Array): void;
|
|
55
|
+
/** Synchronous float64 reference for bounded grids. Use the image-kernel accelerator for large grids. */
|
|
56
|
+
export declare function calculateIrradianceConvolution(input: IrradianceConvolutionInput): {
|
|
57
|
+
plan: IrradianceConvolutionPlan;
|
|
58
|
+
values: Float64Array;
|
|
59
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
/**
|
|
3
|
+
* Blurs a sampled image-plane quantity with caller-supplied PSF (point-spread function) kernels, one
|
|
4
|
+
* kernel per patch of the image. The quantity must be linear and additive (for example irradiance).
|
|
5
|
+
* Each patch is treated as shift-invariant ("isoplanatic"): the same PSF applies everywhere inside it.
|
|
6
|
+
* The PSFs are incoherent intensity PSFs.
|
|
7
|
+
*
|
|
8
|
+
* This is the CPU float64 reference for the optics-as-convolution step (#277). The `webgpu-f32`
|
|
9
|
+
* path runs the same equation; see docs/WEBGPU.md.
|
|
10
|
+
*
|
|
11
|
+
* Equation (indexed by source site; an energy-conserving scatter written as a gather):
|
|
12
|
+
* out(x, y) = Σ_{v=-r..r} Σ_{u=-r..r} in(x − u, y − v) · K_{p(x − u, y − v)}(u, v)
|
|
13
|
+
* where `p(s)` is the patch containing the **source** site and `K_p(u, v)` is the fraction of the source
|
|
14
|
+
* site's quantity that lands at displacement (+u right, +v down), in grid sites.
|
|
15
|
+
*
|
|
16
|
+
* Incoherent imaging is a linear sum of intensity PSFs: the output intensity is the input intensity
|
|
17
|
+
* convolved with the intensity PSF (MIT OpenCourseWare 2.71 Optics, Spring 2009, lecture 22, free).
|
|
18
|
+
* A PSF that varies across the field is approximated as constant inside each patch, as in methods
|
|
19
|
+
* that divide the image into isoplanatic subsections (van de Ketterij et al., arXiv:2011.01738,
|
|
20
|
+
* sec. 1, free). Also see: Goodman, Introduction to Fourier Optics, 4th ed., 2017, §6.1. Camera
|
|
21
|
+
* simulators such as ISETCam use the same piecewise shift-invariant method
|
|
22
|
+
* (Farrell et al., Proc. SPIE 8299, 2012). The caller chooses the patch size and kernels, and so
|
|
23
|
+
* owns the patch approximation.
|
|
24
|
+
*
|
|
25
|
+
* Edges: the grid holds every source. Sources outside the grid are not represented. Anything
|
|
26
|
+
* scattered outside the grid is lost; compare `inputSum` with `outputSum` to see how much. There is no
|
|
27
|
+
* padding, reflection or renormalization.
|
|
28
|
+
*/
|
|
29
|
+
import { InvalidConfigurationError } from "../core/configuration-error.js";
|
|
30
|
+
import { requireAllowlistedRecord } from "../core/record-validation.js";
|
|
31
|
+
export const IRRADIANCE_CONVOLUTION_SCHEMA_VERSION = "0.1.0";
|
|
32
|
+
export const IRRADIANCE_CONVOLUTION_LIMITS = Object.freeze({
|
|
33
|
+
maximumPixels: 24_000_000,
|
|
34
|
+
maximumDimension: 16_384,
|
|
35
|
+
maximumKernelRadius: 32,
|
|
36
|
+
maximumPatchCount: 4_096,
|
|
37
|
+
maximumKernelWeights: 4_194_304,
|
|
38
|
+
/** A kernel may lose energy (vignetting, transmission) but may not create it, beyond rounding slack. */
|
|
39
|
+
maximumKernelSum: 1 + 2 ** -20,
|
|
40
|
+
/** Inputs larger than this are rejected so that float32 execution cannot overflow. */
|
|
41
|
+
maximumSampleMagnitude: 2 ** 100
|
|
42
|
+
});
|
|
43
|
+
function positiveInteger(value, maximum) {
|
|
44
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0 || value > maximum) {
|
|
45
|
+
throw new InvalidConfigurationError("Invalid irradiance convolution geometry.");
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
/** Validates the request and returns its plan. Every sample and weight is checked once. */
|
|
50
|
+
export function calculateIrradianceConvolutionPlan(input) {
|
|
51
|
+
const r = requireAllowlistedRecord(input, ["schemaVersion", "width", "height", "samples", "kernelRadius", "patchWidth",
|
|
52
|
+
"patchHeight", "kernels", "boundary"], "Invalid irradiance convolution input.");
|
|
53
|
+
const L = IRRADIANCE_CONVOLUTION_LIMITS;
|
|
54
|
+
if (r.schemaVersion !== IRRADIANCE_CONVOLUTION_SCHEMA_VERSION || r.boundary !== "zero-outside-grid") {
|
|
55
|
+
throw new InvalidConfigurationError("Unsupported irradiance convolution schema or boundary.");
|
|
56
|
+
}
|
|
57
|
+
const width = positiveInteger(r.width, L.maximumDimension), height = positiveInteger(r.height, L.maximumDimension);
|
|
58
|
+
if (width * height > L.maximumPixels)
|
|
59
|
+
throw new InvalidConfigurationError("Irradiance convolution grid exceeds the pixel limit.");
|
|
60
|
+
const radius = r.kernelRadius;
|
|
61
|
+
if (typeof radius !== "number" || !Number.isSafeInteger(radius) || radius < 0 || radius > L.maximumKernelRadius) {
|
|
62
|
+
throw new InvalidConfigurationError("Invalid irradiance convolution kernel radius.");
|
|
63
|
+
}
|
|
64
|
+
const patchWidth = positiveInteger(r.patchWidth, width), patchHeight = positiveInteger(r.patchHeight, height);
|
|
65
|
+
const patchColumns = Math.ceil(width / patchWidth), patchRows = Math.ceil(height / patchHeight);
|
|
66
|
+
const kernelSize = 2 * radius + 1, tapCount = kernelSize * kernelSize, patchCount = patchColumns * patchRows;
|
|
67
|
+
if (patchCount > L.maximumPatchCount || patchCount * tapCount > L.maximumKernelWeights) {
|
|
68
|
+
throw new InvalidConfigurationError("Irradiance convolution kernels exceed the declared limits.");
|
|
69
|
+
}
|
|
70
|
+
const samples = r.samples, kernels = r.kernels;
|
|
71
|
+
if (!(samples instanceof Float32Array || samples instanceof Float64Array) || samples.length !== width * height ||
|
|
72
|
+
!(kernels instanceof Float32Array || kernels instanceof Float64Array) || kernels.length !== patchCount * tapCount) {
|
|
73
|
+
throw new InvalidConfigurationError("Irradiance convolution arrays do not match the declared geometry.");
|
|
74
|
+
}
|
|
75
|
+
let maximumSampleMagnitude = 0;
|
|
76
|
+
for (let i = 0; i < samples.length; i++) {
|
|
77
|
+
const v = samples[i];
|
|
78
|
+
// Negated comparison also rejects NaN.
|
|
79
|
+
if (!(v >= 0 && v <= L.maximumSampleMagnitude)) {
|
|
80
|
+
throw new InvalidConfigurationError("Irradiance samples must be finite, non-negative and within the declared magnitude.");
|
|
81
|
+
}
|
|
82
|
+
if (v > maximumSampleMagnitude)
|
|
83
|
+
maximumSampleMagnitude = v;
|
|
84
|
+
}
|
|
85
|
+
let maximumKernelSum = 0;
|
|
86
|
+
for (let p = 0; p < patchCount; p++) {
|
|
87
|
+
let sum = 0;
|
|
88
|
+
for (let t = p * tapCount, end = t + tapCount; t < end; t++) {
|
|
89
|
+
const w = kernels[t];
|
|
90
|
+
if (!(w >= 0 && w <= 1))
|
|
91
|
+
throw new InvalidConfigurationError("PSF kernel weights must be finite and within [0, 1].");
|
|
92
|
+
sum += w;
|
|
93
|
+
}
|
|
94
|
+
if (sum > L.maximumKernelSum)
|
|
95
|
+
throw new InvalidConfigurationError("A PSF kernel may not create energy (sum exceeds 1).");
|
|
96
|
+
if (sum > maximumKernelSum)
|
|
97
|
+
maximumKernelSum = sum;
|
|
98
|
+
}
|
|
99
|
+
return Object.freeze({ width, height, kernelRadius: radius, kernelSize, tapCount, patchWidth, patchHeight, patchColumns, patchRows,
|
|
100
|
+
maximumKernelSum, maximumSampleMagnitude });
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Reference gather for output rows `[y0, y1)`, written into `output` at `(y - y0) * width + x`.
|
|
104
|
+
* The summation order (v outer, u inner, both ascending) is part of the contract shared with the
|
|
105
|
+
* WGSL (WebGPU shader) kernel.
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
export function convolveIrradianceRows(plan, samples, kernels, y0, y1, output) {
|
|
109
|
+
const { width, height, kernelRadius: r, kernelSize, tapCount, patchWidth, patchHeight, patchColumns, patchRows } = plan;
|
|
110
|
+
for (let y = y0; y < y1; y++) {
|
|
111
|
+
for (let x = 0; x < width; x++) {
|
|
112
|
+
let sum = 0;
|
|
113
|
+
for (let v = -r; v <= r; v++) {
|
|
114
|
+
const sy = y - v;
|
|
115
|
+
if (sy < 0 || sy >= height)
|
|
116
|
+
continue;
|
|
117
|
+
const patchRowBase = Math.min(Math.floor(sy / patchHeight), patchRows - 1) * patchColumns;
|
|
118
|
+
const kernelRow = (v + r) * kernelSize + r, sampleRow = sy * width;
|
|
119
|
+
for (let u = -r; u <= r; u++) {
|
|
120
|
+
const sx = x - u;
|
|
121
|
+
if (sx < 0 || sx >= width)
|
|
122
|
+
continue;
|
|
123
|
+
const patch = patchRowBase + Math.min(Math.floor(sx / patchWidth), patchColumns - 1);
|
|
124
|
+
sum += samples[sampleRow + sx] * kernels[patch * tapCount + kernelRow + u];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
output[(y - y0) * width + x] = sum;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/** Synchronous float64 reference for bounded grids. Use the image-kernel accelerator for large grids. */
|
|
132
|
+
export function calculateIrradianceConvolution(input) {
|
|
133
|
+
const plan = calculateIrradianceConvolutionPlan(input);
|
|
134
|
+
const values = new Float64Array(plan.width * plan.height);
|
|
135
|
+
convolveIrradianceRows(plan, input.samples, input.kernels, 0, plan.height, values);
|
|
136
|
+
return { plan, values };
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=irradiance-convolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"irradiance-convolution.js","sourceRoot":"","sources":["../../src/optics/irradiance-convolution.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,MAAM,CAAC,MAAM,qCAAqC,GAAG,OAAgB,CAAC;AACtE,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,CAAC;IACzD,aAAa,EAAE,UAAU;IACzB,gBAAgB,EAAE,MAAM;IACxB,mBAAmB,EAAE,EAAE;IACvB,iBAAiB,EAAE,KAAK;IACxB,oBAAoB,EAAE,SAAS;IAC/B,wGAAwG;IACxG,gBAAgB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;IAC9B,sFAAsF;IACtF,sBAAsB,EAAE,CAAC,IAAI,GAAG;CACjC,CAAC,CAAC;AAqCH,SAAS,eAAe,CAAC,KAAc,EAAE,OAAe;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,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AAE,CAAE,GAAG,OAAO,CAAC,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,CAAC,CAAE,CAAC;gBAC/E,CAAC;YACH,CAAC;YACD,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;QACrC,CAAC;IACH,CAAC;AACH,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,8BAA8B,CAAC,KAAiC;IAC9E,MAAM,IAAI,GAAG,kCAAkC,CAAC,KAAK,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1D,sBAAsB,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Blurs a sampled image-plane quantity with caller-supplied PSF (point-spread function) kernels, one\n * kernel per patch of the image. The quantity must be linear and additive (for example irradiance).\n * Each patch is treated as shift-invariant (\"isoplanatic\"): the same PSF applies everywhere inside it.\n * The PSFs are incoherent intensity PSFs.\n *\n * This is the CPU float64 reference for the optics-as-convolution step (#277). The `webgpu-f32`\n * path runs the same equation; see docs/WEBGPU.md.\n *\n * Equation (indexed by source site; an energy-conserving scatter written as a gather):\n * out(x, y) = Σ_{v=-r..r} Σ_{u=-r..r} in(x − u, y − v) · K_{p(x − u, y − v)}(u, v)\n * where `p(s)` is the patch containing the **source** site and `K_p(u, v)` is the fraction of the source\n * site's quantity that lands at displacement (+u right, +v down), in grid sites.\n *\n * Incoherent imaging is a linear sum of intensity PSFs: the output intensity is the input intensity\n * convolved with the intensity PSF (MIT OpenCourseWare 2.71 Optics, Spring 2009, lecture 22, free).\n * A PSF that varies across the field is approximated as constant inside each patch, as in methods\n * that divide the image into isoplanatic subsections (van de Ketterij et al., arXiv:2011.01738,\n * sec. 1, free). Also see: Goodman, Introduction to Fourier Optics, 4th ed., 2017, §6.1. Camera\n * simulators such as ISETCam use the same piecewise shift-invariant method\n * (Farrell et al., Proc. SPIE 8299, 2012). The caller chooses the patch size and kernels, and so\n * owns the patch approximation.\n *\n * Edges: the grid holds every source. Sources outside the grid are not represented. Anything\n * scattered outside the grid is lost; compare `inputSum` with `outputSum` to see how much. There is no\n * padding, reflection or renormalization.\n */\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\nimport { requireAllowlistedRecord } from \"../core/record-validation.js\";\n\nexport const IRRADIANCE_CONVOLUTION_SCHEMA_VERSION = \"0.1.0\" as const;\nexport const IRRADIANCE_CONVOLUTION_LIMITS = Object.freeze({\n maximumPixels: 24_000_000,\n maximumDimension: 16_384,\n maximumKernelRadius: 32,\n maximumPatchCount: 4_096,\n maximumKernelWeights: 4_194_304,\n /** A kernel may lose energy (vignetting, transmission) but may not create it, beyond rounding slack. */\n maximumKernelSum: 1 + 2 ** -20,\n /** Inputs larger than this are rejected so that float32 execution cannot overflow. */\n maximumSampleMagnitude: 2 ** 100\n});\n\nexport interface IrradianceConvolutionInput {\n schemaVersion: typeof IRRADIANCE_CONVOLUTION_SCHEMA_VERSION;\n width: number;\n height: number;\n /** Row-major samples. Finite, non-negative, linear and additive (for example irradiance, or expected photons per site). */\n samples: Float32Array | Float64Array;\n /** Kernel half-width in grid sites. Each kernel is (2r+1)×(2r+1). */\n kernelRadius: number;\n /** Patch size in grid sites. The last row and column of patches may be partial. */\n patchWidth: number;\n patchHeight: number;\n /**\n * Finite non-negative weights, `[patchRow][patchColumn][v + r][u + r]`, one kernel per patch in\n * row-major patch order. Each kernel sums to at most 1 (+2^-20 rounding slack).\n */\n kernels: Float32Array | Float64Array;\n boundary: \"zero-outside-grid\";\n}\n\n/** Validated, immutable geometry of a convolution request. Sample arrays are borrowed, not copied. */\nexport interface IrradianceConvolutionPlan {\n width: number;\n height: number;\n kernelRadius: number;\n kernelSize: number;\n tapCount: number;\n patchWidth: number;\n patchHeight: number;\n patchColumns: number;\n patchRows: number;\n /** Largest kernel sum and largest input magnitude. The float32 error bound uses them. */\n maximumKernelSum: number;\n maximumSampleMagnitude: number;\n}\n\nfunction positiveInteger(value: unknown, maximum: number): number {\n if (typeof value !== \"number\" || !Number.isSafeInteger(value) || value <= 0 || value > maximum) {\n throw new InvalidConfigurationError(\"Invalid irradiance convolution geometry.\");\n }\n return value;\n}\n\n/** Validates the request and returns its plan. Every sample and weight is checked once. */\nexport function calculateIrradianceConvolutionPlan(input: IrradianceConvolutionInput): IrradianceConvolutionPlan {\n const r = requireAllowlistedRecord(input, [\"schemaVersion\", \"width\", \"height\", \"samples\", \"kernelRadius\", \"patchWidth\",\n \"patchHeight\", \"kernels\", \"boundary\"], \"Invalid irradiance convolution input.\");\n const L = IRRADIANCE_CONVOLUTION_LIMITS;\n if (r.schemaVersion !== IRRADIANCE_CONVOLUTION_SCHEMA_VERSION || r.boundary !== \"zero-outside-grid\") {\n throw new InvalidConfigurationError(\"Unsupported irradiance convolution schema or boundary.\");\n }\n const width = positiveInteger(r.width, L.maximumDimension), height = positiveInteger(r.height, L.maximumDimension);\n if (width * height > L.maximumPixels) throw new InvalidConfigurationError(\"Irradiance convolution grid exceeds the pixel limit.\");\n const radius = r.kernelRadius;\n if (typeof radius !== \"number\" || !Number.isSafeInteger(radius) || radius < 0 || radius > L.maximumKernelRadius) {\n throw new InvalidConfigurationError(\"Invalid irradiance convolution kernel radius.\");\n }\n const patchWidth = positiveInteger(r.patchWidth, width), patchHeight = positiveInteger(r.patchHeight, height);\n const patchColumns = Math.ceil(width / patchWidth), patchRows = Math.ceil(height / patchHeight);\n const kernelSize = 2 * radius + 1, tapCount = kernelSize * kernelSize, patchCount = patchColumns * patchRows;\n if (patchCount > L.maximumPatchCount || patchCount * tapCount > L.maximumKernelWeights) {\n throw new InvalidConfigurationError(\"Irradiance convolution kernels exceed the declared limits.\");\n }\n const samples = r.samples, kernels = r.kernels;\n if (!(samples instanceof Float32Array || samples instanceof Float64Array) || samples.length !== width * height ||\n !(kernels instanceof Float32Array || kernels instanceof Float64Array) || kernels.length !== patchCount * tapCount) {\n throw new InvalidConfigurationError(\"Irradiance convolution arrays do not match the declared geometry.\");\n }\n let maximumSampleMagnitude = 0;\n for (let i = 0; i < samples.length; i++) {\n const v = samples[i]!;\n // Negated comparison also rejects NaN.\n if (!(v >= 0 && v <= L.maximumSampleMagnitude)) {\n throw new InvalidConfigurationError(\"Irradiance samples must be finite, non-negative and within the declared magnitude.\");\n }\n if (v > maximumSampleMagnitude) maximumSampleMagnitude = v;\n }\n let maximumKernelSum = 0;\n for (let p = 0; p < patchCount; p++) {\n let sum = 0;\n for (let t = p * tapCount, end = t + tapCount; t < end; t++) {\n const w = kernels[t]!;\n if (!(w >= 0 && w <= 1)) throw new InvalidConfigurationError(\"PSF kernel weights must be finite and within [0, 1].\");\n sum += w;\n }\n if (sum > L.maximumKernelSum) throw new InvalidConfigurationError(\"A PSF kernel may not create energy (sum exceeds 1).\");\n if (sum > maximumKernelSum) maximumKernelSum = sum;\n }\n return Object.freeze({ width, height, kernelRadius: radius, kernelSize, tapCount, patchWidth, patchHeight, patchColumns, patchRows,\n maximumKernelSum, maximumSampleMagnitude });\n}\n\n/**\n * Reference gather for output rows `[y0, y1)`, written into `output` at `(y - y0) * width + x`.\n * The summation order (v outer, u inner, both ascending) is part of the contract shared with the\n * WGSL (WebGPU shader) kernel.\n * @internal\n */\nexport function convolveIrradianceRows(plan: IrradianceConvolutionPlan, samples: Float32Array | Float64Array,\n kernels: Float32Array | Float64Array, y0: number, y1: number, output: Float64Array): void {\n const { width, height, kernelRadius: r, kernelSize, tapCount, patchWidth, patchHeight, patchColumns, patchRows } = plan;\n for (let y = y0; y < y1; y++) {\n for (let x = 0; x < width; x++) {\n let sum = 0;\n for (let v = -r; v <= r; v++) {\n const sy = y - v;\n if (sy < 0 || sy >= height) continue;\n const patchRowBase = Math.min(Math.floor(sy / patchHeight), patchRows - 1) * patchColumns;\n const kernelRow = (v + r) * kernelSize + r, sampleRow = sy * width;\n for (let u = -r; u <= r; u++) {\n const sx = x - u;\n if (sx < 0 || sx >= width) continue;\n const patch = patchRowBase + Math.min(Math.floor(sx / patchWidth), patchColumns - 1);\n sum += samples[sampleRow + sx]! * kernels[patch * tapCount + kernelRow + u]!;\n }\n }\n output[(y - y0) * width + x] = sum;\n }\n }\n}\n\n/** Synchronous float64 reference for bounded grids. Use the image-kernel accelerator for large grids. */\nexport function calculateIrradianceConvolution(input: IrradianceConvolutionInput): { plan: IrradianceConvolutionPlan; values: Float64Array } {\n const plan = calculateIrradianceConvolutionPlan(input);\n const values = new Float64Array(plan.width * plan.height);\n convolveIrradianceRows(plan, input.samples, input.kernels, 0, plan.height, values);\n return { plan, values };\n}\n"]}
|