@photivra/engine 2.9.0 → 2.10.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 +85 -1
- package/CITATION.cff +1 -1
- package/README.md +6 -6
- package/SECURITY.md +1 -1
- package/THIRD_PARTY.md +2 -0
- package/dist/capture/native-environment-lean.js +89 -5
- package/dist/capture/native-environment-lean.js.map +1 -1
- package/dist/capture/native-environment-tabulated.d.ts +37 -0
- package/dist/capture/native-environment-tabulated.js +42 -6
- package/dist/capture/native-environment-tabulated.js.map +1 -1
- package/dist/core/portable-math.d.ts +13 -0
- package/dist/core/portable-math.js +43 -0
- package/dist/core/portable-math.js.map +1 -1
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/dist/core/version.js.map +1 -1
- package/dist/facade/channel-response.d.ts +15 -0
- package/dist/facade/channel-response.js +33 -0
- package/dist/facade/channel-response.js.map +1 -0
- package/dist/facade/diffraction-provider.js +50 -15
- package/dist/facade/diffraction-provider.js.map +1 -1
- package/dist/facade/display-view.d.ts +75 -0
- package/dist/facade/display-view.js +471 -109
- package/dist/facade/display-view.js.map +1 -1
- package/dist/facade/expected-signal-setup.js +2 -1
- package/dist/facade/expected-signal-setup.js.map +1 -1
- package/dist/facade/expected-signal.d.ts +32 -3
- package/dist/facade/expected-signal.js +192 -24
- package/dist/facade/expected-signal.js.map +1 -1
- package/dist/facade/simulate-capture.d.ts +51 -4
- package/dist/facade/simulate-capture.js +130 -31
- package/dist/facade/simulate-capture.js.map +1 -1
- package/dist/facade/simulate-display-view.d.ts +25 -2
- package/dist/facade/simulate-display-view.js +55 -22
- package/dist/facade/simulate-display-view.js.map +1 -1
- package/dist/gpu/image-kernel-execution.d.ts +5 -0
- package/dist/gpu/image-kernel-execution.js +2 -2
- package/dist/gpu/image-kernel-execution.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/optics/irradiance-convolution.d.ts +11 -0
- package/dist/optics/irradiance-convolution.js +64 -24
- package/dist/optics/irradiance-convolution.js.map +1 -1
- package/dist/optics/scene-to-sensor-irradiance.d.ts +13 -0
- package/dist/optics/scene-to-sensor-irradiance.js +58 -24
- package/dist/optics/scene-to-sensor-irradiance.js.map +1 -1
- package/dist/optics/sensor-aperture-rays.js +2 -1
- package/dist/optics/sensor-aperture-rays.js.map +1 -1
- package/dist/optics/sensor-environment-query.js +4 -3
- package/dist/optics/sensor-environment-query.js.map +1 -1
- package/dist/optics/site-diffraction-kernel.d.ts +16 -0
- package/dist/optics/site-diffraction-kernel.js +60 -8
- package/dist/optics/site-diffraction-kernel.js.map +1 -1
- package/dist/processing/demosaic.js +114 -37
- package/dist/processing/demosaic.js.map +1 -1
- package/dist/schema/scene-radiance.d.ts +8 -0
- package/dist/schema/scene-radiance.js +28 -17
- package/dist/schema/scene-radiance.js.map +1 -1
- package/dist/sensor/environment-photo-signal.d.ts +21 -0
- package/dist/sensor/environment-photo-signal.js +68 -2
- package/dist/sensor/environment-photo-signal.js.map +1 -1
- package/docs/API_REFERENCE.md +16 -1
- package/docs/QUICK_START.md +18 -8
- package/docs/USAGE.md +30 -0
- package/docs/api/core-version.md +1 -1
- package/docs/api/exports.json +42 -2
- package/docs/api/facade-display-view.md +50 -0
- package/docs/api/facade-simulate-capture.md +60 -8
- package/docs/api/facade-simulate-display-view.md +23 -1
- package/docs/api/gpu-image-kernel-execution.md +5 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-photo-signal.js","sourceRoot":"","sources":["../../src/sensor/environment-photo-signal.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,mBAAmB,EAA0B,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAA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AAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,EAAE,0BAA0B,CAAC,CAAC,CAAC;IACzQ,MAAM,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACtE,OAAO,mCAAmC,CAAC,gCAAgC,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,wBAAwB,CAAC,CAAC;AACjI,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Photo signal for one sensor site from a scene-radiance provider (the \"environment\"): asks the\n * provider for radiance along each sampled direction, then applies optics and the sensor response.\n *\n * Work is split into a plan and an execution step. Planning checks spatial, spectral and temporal\n * coverage and builds an internal plan before any provider code runs. Each query gives an explicit\n * scene direction, a wavelength (air or vacuum) and a time in seconds from the shutter's opening\n * reference. Optical throughput, an optional local PSF (point-spread function) and the EQE (external\n * quantum efficiency) response then give the expected photo signal. Calling the provider does not\n * verify its light transport, visibility or calibration.\n * @see docs/ENVIRONMENT_RAW_CAPTURE.md for equations, coordinate/unit conventions, blockers and\n * support limits.\n */\n\nimport { approximationResult, type CalculationResult } from \"../core/calculation-result.js\";\nimport { freezeOwnedData } from \"../core/owned-data.js\";\nimport { requirePublicOpaqueId, requireInputKeys } from \"../core/record-validation.js\";\nimport { parseEvidenceList, type EvidenceProvenance } from \"../core/evidence-provenance.js\";\nimport { InvalidScientificInputError } from \"../core/validation.js\";\nimport { parseSceneIlluminationProfile } from \"../schema/illumination.js\";\nimport { parseSceneIlluminationTemporalProfile } from \"../schema/illumination-temporal.js\";\nimport { parseSceneMaterialResponseProfile, parseSceneRadianceProviderProfile, parseSceneRadianceEvaluationResult,\n validateSceneRadianceEvaluationBindings, type SceneRadianceEvaluationRequest,\n type SceneRadianceEvaluationResult } from \"../schema/scene-radiance.js\";\nimport { calculateMappedSensorEnvironmentRadianceQuery, calculateSensorEnvironmentRadianceQuery, prepareEnvironmentLensFieldMapping,\n type CalculateSensorEnvironmentRadianceQueryInput, type EnvironmentLensFieldMapping } from \"../optics/sensor-environment-query.js\";\nimport { calculateSceneRadianceToSensorIrradiance, type CalculateSceneRadianceToSensorIrradianceInput } from \"../optics/scene-to-sensor-irradiance.js\";\nimport { calculateSensorPsfIrradianceQuadrature, type CalculateSensorPsfIrradianceQuadratureInput } from \"../optics/sensor-psf-quadrature.js\";\nimport { calculateIlluminationVignetting, type IlluminationVignettingProfile } from \"../optics/illumination-vignetting.js\";\nimport { calculateSensorApertureRays, type IdealCircularPupil, type SensorApertureRay } from \"../optics/sensor-aperture-rays.js\";\nimport { sensorPsfSourcePoint } from \"../optics/sensor-psf-support.js\";\nimport { markEngineOwnedLensSampledPsfProfile, resolveLensSampledPsf } from \"../optics/lens-psf-profile.js\";\nimport { calculateSensorSpatialSamplingQuadrature } from \"./spatial-sampling-quadrature.js\";\nimport { calculateSensorSpectralQuadrature } from \"./spectral-quadrature.js\";\nimport { resolveNativeEffectiveRasterColorSamplingBinding } from \"./capture-color-sampling-binding.js\";\nimport { calculateCaptureExposureWindows } from \"./exposure-window.js\";\nimport { createSensorEqeTemporalPhotoSignal } from \"./temporal-photo-signal.js\";\nimport type { CalculateSensorEqeTemporalExposureInput } from \"./eqe-temporal-exposure.js\";\nimport type { CalculateSceneToSensorIrradianceQuadratureInput } from \"../optics/scene-to-sensor-quadrature.js\";\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\n\n/** Caller-supplied synchronous radiance function, run locally. Calling it does not prove its light transport is physical. */\nexport type EnvironmentRadianceEvaluator = (request: Readonly<SceneRadianceEvaluationRequest>) => SceneRadianceEvaluationResult;\nexport type EnvironmentApertureRadianceEvaluator = (request: Readonly<SceneRadianceEvaluationRequest>, apertureRay: Readonly<SensorApertureRay>) => SceneRadianceEvaluationResult;\nexport interface CalculateEnvironmentSensorPhotoSignalInput {\n temporalIntegrationId: string;\n sensor: Omit<CalculateSensorEqeTemporalExposureInput, \"samples\">;\n sceneBindings: CalculateSceneToSensorIrradianceQuadratureInput[\"sceneBindings\"];\n optics: Omit<CalculateSceneRadianceToSensorIrradianceInput,\n \"sceneRadianceRequest\" | \"sceneRadianceResult\" | \"imagePointMm\" | \"fieldThroughput\">;\n motion: Pick<CalculateSensorEnvironmentRadianceQueryInput,\n \"angularVelocityRadPerSec\" | \"timeReference\" | \"environmentDirectionConvention\">;\n temporalSampleCount: number;\n /** Optional ideal circular pupil, for geometric depth of field (DOF) and visibility. Cannot be combined with a sampled PSF. */\n pupil?: IdealCircularPupil;\n /**\n * Optional lens field mapping (added in 2.0): a projection model and radial or Brown-Conrady\n * distortion for the scene-ray query. Its distortion area factor is applied to irradiance exactly\n * once. If omitted, the ideal rectilinear, distortion-free path is unchanged. Cannot be combined\n * with `pupil`.\n */\n lensFieldMapping?: EnvironmentLensFieldMapping;\n /** Explicit attenuation across the field (such as vignetting), applied once before the PSF spreads the light. */\n fieldThroughput: { kind: \"unity\"; evidence: readonly EvidenceProvenance[]; limitation: string } | {\n kind: \"radial-illumination-vignetting\"; profile: IlluminationVignettingProfile;\n evidence: readonly EvidenceProvenance[]; limitation: string;\n };\n psf: { kind: \"not-applied\"; evidence: readonly EvidenceProvenance[]; limitation: string } | {\n kind: \"sampled-local\";\n configuration: Pick<CalculateSensorPsfIrradianceQuadratureInput, \"psf\" | \"psfWavelengthBasis\" | \"spatialModel\">;\n };\n evaluateRadiance: EnvironmentRadianceEvaluator;\n /** Required with `pupil`: rays start at different points on the aperture, so a direction-only function cannot be used. */\n evaluateApertureRadiance?: EnvironmentApertureRadianceEvaluator;\n}\nexport interface EnvironmentSensorPhotoSignal {\n sourceTargetProjectionCalculated: true;\n providerCallbackExecuted: true;\n providerTransportVerified: false;\n sceneVisibilityCalculated: false;\n productionPlanActivated: false;\n providerEvaluationCount: number;\n sourcePlane: \"sensor-package-incident\";\n fieldThroughputEvidence: readonly EvidenceProvenance[];\n fieldThroughputLimitation: string;\n psfOmission: { evidence: readonly EvidenceProvenance[]; limitation: string } | null;\n psfRedistributionApplied: boolean;\n pupilIntegrationApplied: boolean;\n pupilIntegrationProfile: IdealCircularPupil | null;\n photo: ReturnType<typeof createSensorEqeTemporalPhotoSignal>;\n instants: readonly {\n temporalSampleIndex: number;\n timeSecondsFromOpeningReference: number;\n psf: ReturnType<typeof calculateSensorPsfIrradianceQuadrature> | null;\n evaluations: readonly {\n query: ReturnType<typeof calculateSensorEnvironmentRadianceQuery>;\n result: SceneRadianceEvaluationResult;\n bindings: ReturnType<typeof validateSceneRadianceEvaluationBindings>;\n optics: ReturnType<typeof calculateSceneRadianceToSensorIrradiance>;\n apertureRay?: SensorApertureRay;\n apertureRequest?: SceneRadianceEvaluationRequest;\n }[];\n }[];\n}\n\n/** Internal plan, shared with the full-frame composer, so all work is bounded before any callback runs. */\ninterface EnvironmentPhotoPlan {\n owned: Omit<CalculateEnvironmentSensorPhotoSignalInput, \"evaluateRadiance\" | \"evaluateApertureRadiance\">;\n sceneBindings: CalculateSceneToSensorIrradianceQuadratureInput[\"sceneBindings\"];\n fieldThroughputEvidence: readonly EvidenceProvenance[];\n spatialQuadrature: ReturnType<typeof calculateSensorSpatialSamplingQuadrature>[\"value\"];\n spectralQuadrature: ReturnType<typeof calculateSensorSpectralQuadrature>[\"value\"];\n count: number;\n focus: CalculateSensorEnvironmentRadianceQueryInput[\"focus\"];\n instants: { temporalSampleIndex: number; time: number; groups: {\n node: CalculateSensorPsfIrradianceQuadratureInput[\"samples\"][number][\"node\"];\n taps: { kernelSampleX: number; kernelSampleY: number; point: { x: number; y: number };\n /** Deep-frozen provider request of the planned query (the same object as query.value.request). */\n request: SceneRadianceEvaluationRequest;\n /** The planned query's image-plane source point (the same object as query.value.sourcePointImagePlaneMm). */\n sourcePointImagePlaneMm: { x: number; y: number };\n /** The complete query result. Kept only by \"full\" plans, whose per-evaluation records include it. */\n query?: ReturnType<typeof calculateSensorEnvironmentRadianceQuery>;\n apertureRays?: readonly SensorApertureRay[];\n /** 1 / det(d distorted / d ideal), the change in area from distortion. Present only with a lens field mapping. */\n distortionAreaFactor?: number;\n fieldThroughput: CalculateSceneRadianceToSensorIrradianceInput[\"fieldThroughput\"] }[];\n }[] }[];\n}\n/**\n * Builds an internal execution plan covering all optical, spatial, spectral and temporal sampling,\n * without calling any provider code.\n *\n * Coverage is checked completely before any supplied radiance function runs. Each query gives an\n * explicit scene direction, a wavelength (air or vacuum) and seconds from the opening reference.\n * @param input - The photo-signal input without its radiance functions; see\n * `CalculateEnvironmentSensorPhotoSignalInput`.\n * @param ownership - Internal. \"copy\" (default) makes a structured clone of the input. \"engine-owned\"\n * uses the input as the plan's own data without cloning again. Only engine callers that already hold a\n * private structured clone, never shown to supplied code and never changed afterwards, may pass it.\n * @param retention - Internal. \"full\" (default) keeps every planned query result for \"full\" execution\n * records. \"photo-only\" keeps only each query's frozen request and image-plane point, which is all that\n * photo-only execution reads. Every query is still computed and validated at plan time, so limit checks\n * and errors are unchanged.\n * @returns The result. Success does not imply calibration.\n *\n * @see docs/API_REFERENCE.md for the package export and its full type definitions.\n */\nexport function planEnvironmentSensorPhotoSignal(input: Omit<CalculateEnvironmentSensorPhotoSignalInput, \"evaluateRadiance\" | \"evaluateApertureRadiance\">,\n ownership: \"copy\" | \"engine-owned\" = \"copy\", retention: \"full\" | \"photo-only\" = \"full\"): EnvironmentPhotoPlan {\n const owned = ownership === \"engine-owned\" ? input : structuredClone(input);\n requirePublicOpaqueId(owned.temporalIntegrationId, \"Environment integration requires a public identity.\");\n if (!Number.isSafeInteger(owned.temporalSampleCount) || owned.temporalSampleCount < 1 || owned.temporalSampleCount > 256 ||\n owned.sensor.responseApplication.sourcePlane.value !== \"sensor-package-incident\" ||\n (owned.fieldThroughput?.kind !== \"unity\" && owned.fieldThroughput?.kind !== \"radial-illumination-vignetting\") || typeof owned.fieldThroughput.limitation !== \"string\" || !owned.fieldThroughput.limitation.trim()) {\n throw new InvalidScientificInputError(\"Environment exposure requires package-incident response, 1..256 midpoints and explicit supported field throughput.\");\n }\n if (owned.fieldThroughput.kind === \"radial-illumination-vignetting\" &&\n (typeof owned.fieldThroughput.profile !== \"object\" || owned.fieldThroughput.profile === null ||\n typeof owned.fieldThroughput.profile.coefficients !== \"object\" || owned.fieldThroughput.profile.coefficients === null)) {\n throw new InvalidScientificInputError(\"Radial throughput requires a declared profile and coefficients.\");\n }\n const fieldThroughputEvidence = parseEvidenceList(owned.fieldThroughput.evidence, \"environmentFieldThroughput.evidence\");\n const sceneBindings = { providerProfile: parseSceneRadianceProviderProfile(owned.sceneBindings.providerProfile),\n illuminationProfile: parseSceneIlluminationProfile(owned.sceneBindings.illuminationProfile),\n materialResponseProfile: parseSceneMaterialResponseProfile(owned.sceneBindings.materialResponseProfile),\n ...(owned.sceneBindings.illuminationTemporalProfile === undefined ? {} : {\n illuminationTemporalProfile: parseSceneIlluminationTemporalProfile(owned.sceneBindings.illuminationTemporalProfile) }) };\n if (sceneBindings.providerProfile.fidelity.spectral !== \"wavelength-resolved\") throw new InvalidScientificInputError(\"Environment exposure requires wavelength-resolved provider fidelity.\");\n const sensor = owned.sensor;\n const nativeRaster = sensor.localExposure.exposureWindowInput.nativeRaster;\n const binding = resolveNativeEffectiveRasterColorSamplingBinding({ nativeRaster, colorSamplingProfile: sensor.colorSamplingProfile,\n bindingProfile: sensor.localExposure.bindingProfile });\n if (binding.relationshipMeaning !== \"one-native-effective-sample-to-one-color-site\") throw new InvalidScientificInputError(\"Environment exposure requires explicit one-to-one native/color timing.\");\n const spatialQuadrature = calculateSensorSpatialSamplingQuadrature({ ...sensor.spatialSampling, nativeRaster,\n colorSamplingProfile: sensor.colorSamplingProfile, colorSamplingBindingProfile: sensor.localExposure.bindingProfile }).value;\n const spectralQuadrature = calculateSensorSpectralQuadrature({ ...sensor.spectralSampling,\n colorSamplingProfile: sensor.colorSamplingProfile, spectralResponseProfile: sensor.spectralResponseProfile }).value;\n if (spectralQuadrature.wavelengthBasis === \"unspecified\") throw new InvalidScientificInputError(\"Environment spectral basis must be explicit.\");\n const wavelengthBasis = spectralQuadrature.wavelengthBasis;\n const site = sensor.spatialSampling.site;\n const window = calculateCaptureExposureWindows({ ...sensor.localExposure.exposureWindowInput,\n samplePointsNative: [{ x: site.x+.5, y: site.y+.5 }] }).value.samples[0]!;\n const focus = owned.optics.focus.kind === \"infinity-focus\" ? { kind: \"infinity\" as const } :\n owned.optics.focus.kind === \"ideal-symmetric-thin-lens\" ? { kind: \"finite\" as const, distanceM: owned.optics.focus.objectDistanceM } :\n owned.optics.focus.focus.kind === \"infinity\" ? { kind: \"infinity\" as const } : { kind: \"finite\" as const, distanceM: owned.optics.focus.focus.objectDistanceM };\n if (owned.psf.kind === \"not-applied\") {\n parseEvidenceList(owned.psf.evidence, \"environmentPsfOmission.evidence\");\n if (typeof owned.psf.limitation !== \"string\" || !owned.psf.limitation.trim()) throw new InvalidScientificInputError(\"PSF omission needs an explicit limitation.\");\n } else if (owned.psf.kind !== \"sampled-local\") throw new InvalidConfigurationError(\"Unknown environment PSF selection.\");\n if (owned.psf.kind === \"sampled-local\") {\n const p = owned.psf.configuration.psf;\n // The profile belongs only to this plan, so its parse can be cached across nodes and time instants.\n markEngineOwnedLensSampledPsfProfile(p.profile);\n if (p.focalLengthMm !== owned.optics.focalLengthMm || p.apertureFNumber !== owned.optics.nominalFNumber ||\n p.focus.kind !== focus.kind || (p.focus.kind === \"finite\" && focus.kind === \"finite\" && p.focus.distanceM !== focus.distanceM)) {\n throw new InvalidScientificInputError(\"PSF and optical focal/aperture/focus state must match exactly.\");\n }\n }\n if (owned.pupil !== undefined && owned.psf.kind !== \"not-applied\") throw new InvalidScientificInputError(\"Ideal pupil integration cannot mix with a sampled PSF; geometric defocus would be ambiguous.\");\n const lensMapping = owned.lensFieldMapping === undefined ? undefined : prepareEnvironmentLensFieldMapping(owned.lensFieldMapping);\n if (lensMapping !== undefined && owned.pupil !== undefined) {\n throw new InvalidScientificInputError(\"Ideal pupil rays use the rectilinear distortion-free projection and cannot combine with a lens field mapping.\");\n }\n const pupilCount = owned.pupil === undefined ? 1 : calculateSensorApertureRays({sourcePointNativeSensorMm:{x:0,y:0},\n focalLengthMm:owned.optics.focalLengthMm,nominalFNumber:owned.optics.nominalFNumber,focus,pupil:owned.pupil,\n angularVelocityRadPerSec:owned.motion.angularVelocityRadPerSec,timeSecondsFromOpeningReference:window.startOffsetSecondsFromOpeningReference}).value.rays.length;\n let count = 0;\n const nodes = spectralQuadrature.nodes.flatMap(spectral => spatialQuadrature.nodes.map(spatial => {\n const node = { spatialNode: { antiAliasingComponentIndex: spatial.antiAliasingComponentIndex,\n apertureSampleXIndex: spatial.apertureSampleXIndex, apertureSampleYIndex: spatial.apertureSampleYIndex },\n spectralSampleIndex: spectral.spectralSampleIndex, wavelengthNanometers: spectral.wavelengthNanometers };\n const destination = spatial.preAntiAliasingSourcePointMm;\n const resolved = owned.psf.kind === \"sampled-local\" ? resolveLensSampledPsf({ ...owned.psf.configuration.psf,\n wavelengthNm: spectral.wavelengthNanometers, fieldPointMm: { x: destination.x, y: -destination.y } }) : null;\n const kernel = resolved?.value.kernel;\n const taps = kernel ? kernel.widthSamples*kernel.heightSamples : 1;\n count += taps*owned.temporalSampleCount*pupilCount;\n if (count > 100000) throw new InvalidScientificInputError(\"Environment exposure exceeds the 100000-provider-evaluation budget.\");\n const points = Array.from({ length: taps }, (_, i) => ({ kernelSampleX: kernel ? i%kernel.widthSamples : 0,\n kernelSampleY: kernel ? Math.floor(i/kernel.widthSamples) : 0,\n point: kernel ? sensorPsfSourcePoint(destination, kernel, i%kernel.widthSamples, Math.floor(i/kernel.widthSamples)) : { ...destination } }));\n return { node, points: points.map(p => ({ ...p, fieldThroughput: owned.fieldThroughput.kind === \"unity\"\n ? { kind: \"unity\" as const }\n : { kind: \"illumination-vignetting-result\" as const, result: calculateIlluminationVignetting({\n imagePointMm: { x: p.point.x, y: -p.point.y }, profile: owned.fieldThroughput.profile }).value } })) };\n }));\n const measure = window.localExposureDurationSeconds/owned.temporalSampleCount;\n let previous = -Infinity;\n const instants = Array.from({ length: owned.temporalSampleCount }, (_, temporalSampleIndex) => {\n const time = window.startOffsetSecondsFromOpeningReference+(temporalSampleIndex+.5)*measure;\n if (!(time > window.startOffsetSecondsFromOpeningReference && time > previous && time < window.endOffsetSecondsFromOpeningReference)) throw new InvalidScientificInputError(\"Local midpoints must be representable and strictly ordered.\");\n previous = time;\n const groups = nodes.map((n, ni) => ({ node: n.node, taps: n.points.map((p, pi) => {\n const apertureRays = owned.pupil === undefined ? undefined : calculateSensorApertureRays({sourcePointNativeSensorMm:p.point,\n focalLengthMm:owned.optics.focalLengthMm,nominalFNumber:owned.optics.nominalFNumber,focus,pupil:owned.pupil,\n angularVelocityRadPerSec:owned.motion.angularVelocityRadPerSec,timeSecondsFromOpeningReference:time}).value.rays;\n const queryInput: CalculateSensorEnvironmentRadianceQueryInput = { ...owned.motion, sourcePointNativeSensorMm: p.point,\n focalLengthMm: owned.optics.focalLengthMm, focus, timeSecondsFromOpeningReference: time,\n request: { schemaVersion: \"0.1.0\", sampleId: `${owned.temporalIntegrationId}-t${temporalSampleIndex}-n${ni}-p${pi}`,\n providerProfileId: sceneBindings.providerProfile.profileId, sceneId: sceneBindings.providerProfile.sceneId,\n illuminationProfileId: sceneBindings.illuminationProfile.profileId, materialResponseProfileId: sceneBindings.materialResponseProfile.profileId,\n wavelengthNanometers: n.node.wavelengthNanometers, wavelengthBasis } };\n const query = freezePlannedRequest(lensMapping === undefined ? calculateSensorEnvironmentRadianceQuery(queryInput)\n : calculateMappedSensorEnvironmentRadianceQuery(queryInput, lensMapping));\n const areaFactor = query.value.lensFieldMapping?.distortionAreaFactor;\n // Photo-only plans drop the query result (projection, diagnostics) once it is validated (a 2.0 memory saving).\n return { ...p, ...(apertureRays === undefined ? {} : { apertureRays }),\n ...(areaFactor === undefined ? {} : { distortionAreaFactor: areaFactor }), request: query.value.request,\n sourcePointImagePlaneMm: query.value.sourcePointImagePlaneMm, ...(retention === \"full\" ? { query } : {}) };\n }) }));\n // Validate PSF evidence/basis/support before supplied code is invoked.\n if (owned.psf.kind === \"sampled-local\") calculateSensorPsfIrradianceQuadrature({ ...owned.psf.configuration,\n spatialQuadrature, spectralQuadrature, timeSecondsFromOpeningReference: time,\n inputMeaning: \"pre-psf-pre-sensor-stack-pre-aa-spectral-irradiance\", samples: groups.map(g => ({ node: g.node,\n sourceSamples: g.taps.map(t => ({ kernelSampleX: t.kernelSampleX, kernelSampleY: t.kernelSampleY,\n sourcePointNativeSensorMm: t.point, timeSecondsFromOpeningReference: time, spectralIrradianceWattsPerSquareMeterPerNanometer: 0 })) })) });\n return { temporalSampleIndex, time, groups };\n });\n return { owned, sceneBindings, fieldThroughputEvidence, spatialQuadrature, spectralQuadrature, instants, count, focus };\n}\n\n/** Aperture queries already built for a batched provider, keyed by the planned ray; each is used once. */\nconst PREBUILT_APERTURE_QUERIES = new WeakMap<object, { base: object; request: SceneRadianceEvaluationRequest; apertureRay: SensorApertureRay }>();\n\n/**\n * Internal: the frozen provider request and frozen private ray copy of one ideal-pupil query (sample ID suffix \"-a\"\n * and the pupil index, reversed ray direction). If prebuildApertureRadianceQuery already built this query for a batch,\n * the same objects are returned once, so the batch and the executor share them; otherwise new ones are built.\n */\nexport function apertureRadianceQuery(base: SceneRadianceEvaluationRequest, ray: SensorApertureRay):\n { request: SceneRadianceEvaluationRequest; apertureRay: SensorApertureRay } {\n const prebuilt = PREBUILT_APERTURE_QUERIES.get(ray);\n if (prebuilt !== undefined && prebuilt.base === base) {\n PREBUILT_APERTURE_QUERIES.delete(ray);\n return { request: prebuilt.request, apertureRay: prebuilt.apertureRay };\n }\n return { request: freezeOwnedData({ ...base, sampleId: base.sampleId+\"-a\"+ray.pupilSampleIndex,\n target: { kind: \"environment-direction\" as const, outgoingDirectionUnitVector: {\n x: -ray.directionUnitVector.x, y: -ray.directionUnitVector.y, z: -ray.directionUnitVector.z } } }),\n apertureRay: freezeOwnedData(copyRay(ray)) };\n}\n/**\n * A private copy of an engine-computed ray: plain records of numbers, copied key by key in the same order, so it\n * equals what structuredClone returns for this data (a 2.0 performance change: structuredClone dominated pupil runs).\n */\nfunction copyRay(ray: SensorApertureRay): SensorApertureRay {\n const copy = (value: unknown): unknown => {\n if (typeof value !== \"object\" || value === null) return value;\n if (Array.isArray(value)) return value.map(copy);\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(value)) out[key] = copy((value as Record<string, unknown>)[key]);\n return out;\n };\n return copy(ray) as SensorApertureRay;\n}\n/** Internal: builds a pupil query for a batched provider and keeps it for the executor's apertureRadianceQuery call. */\nexport function prebuildApertureRadianceQuery(base: SceneRadianceEvaluationRequest, ray: SensorApertureRay):\n { request: SceneRadianceEvaluationRequest; apertureRay: SensorApertureRay } {\n PREBUILT_APERTURE_QUERIES.delete(ray);\n const query = apertureRadianceQuery(base, ray);\n PREBUILT_APERTURE_QUERIES.set(ray, { base, ...query });\n return query;\n}\n\n/** Deep-freezes a planned provider request once, so execution can hand the same immutable request to supplied code. */\nfunction freezePlannedRequest<T extends { value: { request: object } }>(query: T): T {\n freezeOwnedData(query.value.request);\n return query;\n}\n\n/**\n * Internal: runs a completed, bounded plan. On failure nothing partial is returned.\n * With retention \"full\" (default), every per-evaluation record is kept in value.instants[].evaluations.\n * With \"photo-only\", those lists are empty, for engine callers that read only value.photo. Photo values\n * are identical either way.\n */\nexport function executeEnvironmentSensorPhotoSignal(plan: ReturnType<typeof planEnvironmentSensorPhotoSignal>, evaluate: EnvironmentRadianceEvaluator, evaluateAperture?: EnvironmentApertureRadianceEvaluator,\n retention: \"full\" | \"photo-only\" = \"full\"): CalculationResult<EnvironmentSensorPhotoSignal> {\n if (typeof evaluate !== \"function\") throw new InvalidScientificInputError(\"Environment radiance evaluator must be synchronous callable code.\");\n const { owned } = plan;\n if (owned.pupil !== undefined && typeof evaluateAperture !== \"function\") throw new InvalidScientificInputError(\"Pupil integration requires an origin-aware aperture evaluator.\");\n if (retention === \"full\" && plan.instants.some(instant => instant.groups.some(group => group.taps.some(tap => tap.query === undefined)))) {\n throw new InvalidScientificInputError(\"Full environment execution records require a full plan.\");\n }\n const irradiance = [];\n const instants: EnvironmentSensorPhotoSignal[\"instants\"][number][] = [];\n for (const instant of plan.instants) {\n const evaluations: EnvironmentSensorPhotoSignal[\"instants\"][number][\"evaluations\"][number][] = [];\n const samples = instant.groups.map(group => ({ node: group.node, sourceSamples: group.taps.map(tap => {\n let integratedIrradiance = 0;\n const support: readonly (SensorApertureRay | undefined)[] = tap.apertureRays ?? [undefined];\n for (const ray of support) {\n // Planned requests are deep-frozen once at plan time (freezePlannedRequest); no per-evaluation clone.\n const query = ray === undefined ? undefined : apertureRadianceQuery(tap.request, ray);\n const request = query === undefined ? tap.request : query.request, apertureRay = query?.apertureRay;\n const result = parseSceneRadianceEvaluationResult(apertureRay === undefined ? evaluate(request) : evaluateAperture!(request,apertureRay));\n const bindings = validateSceneRadianceEvaluationBindings({ ...plan.sceneBindings, request, result });\n const optics = calculateSceneRadianceToSensorIrradiance({ ...owned.optics, sceneRadianceRequest: request,\n sceneRadianceResult: result, imagePointMm: tap.sourcePointImagePlaneMm, fieldThroughput: tap.fieldThroughput });\n if (retention === \"full\") evaluations.push({ query: tap.query!, result, bindings, optics,\n ...(apertureRay === undefined ? {} : {apertureRay,apertureRequest:request}) });\n integratedIrradiance += optics.value.sensorPlaneSpectralIrradianceWattsPerSquareMeterNanometer*(ray?.weight ?? 1);\n }\n if (tap.distortionAreaFactor !== undefined) {\n // Distortion squeezes or stretches the ideal image. Flux is conserved, so irradiance scales by 1/det, once.\n integratedIrradiance *= tap.distortionAreaFactor;\n }\n return { kernelSampleX: tap.kernelSampleX, kernelSampleY: tap.kernelSampleY, sourcePointNativeSensorMm: tap.point,\n timeSecondsFromOpeningReference: instant.time, spectralIrradianceWattsPerSquareMeterPerNanometer: integratedIrradiance };\n }) }));\n const psf = owned.psf.kind === \"sampled-local\" ? calculateSensorPsfIrradianceQuadrature({ ...owned.psf.configuration,\n spatialQuadrature: plan.spatialQuadrature, spectralQuadrature: plan.spectralQuadrature,\n timeSecondsFromOpeningReference: instant.time, inputMeaning: \"pre-psf-pre-sensor-stack-pre-aa-spectral-irradiance\", samples }) : null;\n irradiance.push({ temporalSampleIndex: instant.temporalSampleIndex, timeSecondsFromOpeningReference: instant.time,\n irradianceSamples: psf ? psf.value.irradianceSamples : samples.map(s => ({ node: s.node,\n spectralIrradianceWattsPerSquareMeterPerNanometer: s.sourceSamples[0]!.spectralIrradianceWattsPerSquareMeterPerNanometer })) });\n instants.push({ temporalSampleIndex: instant.temporalSampleIndex, timeSecondsFromOpeningReference: instant.time, psf, evaluations });\n }\n const photo = createSensorEqeTemporalPhotoSignal({ temporalIntegrationId: owned.temporalIntegrationId,\n exposure: { ...owned.sensor, samples: irradiance } });\n return approximationResult({ sourceTargetProjectionCalculated: true, providerCallbackExecuted: true,\n providerTransportVerified: false, sceneVisibilityCalculated: false, productionPlanActivated: false,\n providerEvaluationCount: plan.count, sourcePlane: \"sensor-package-incident\", fieldThroughputEvidence: plan.fieldThroughputEvidence,\n fieldThroughputLimitation: owned.fieldThroughput.limitation,\n psfOmission: owned.psf.kind === \"not-applied\" ? { evidence: parseEvidenceList(owned.psf.evidence, \"psfOmission.evidence\"), limitation: owned.psf.limitation } : null,\n psfRedistributionApplied: owned.psf.kind === \"sampled-local\", pupilIntegrationApplied: owned.pupil !== undefined, pupilIntegrationProfile: owned.pupil ?? null, photo, instants\n }, \"environment-sensor-photo-signal\", owned.lensFieldMapping === undefined ? \"0.3.0\" : \"0.4.0\", [\n \"Supplied synchronous provider code was invoked at each generated environment query; physical transport and visibility are not verified.\",\n \"Ideal focus-aware rotation/projection, explicit evidence-bound field throughput and optional destination-local sampled PSF are bounded approximations.\",\n \"Optional ideal pupil rays use normalized radiance averaging; source intersections remain provider-owned and convergence is unverified.\",\n \"PSF pupil throughput is not applied; child uncertainty, finite-support and quadrature convergence are not combined or established.\",\n ...(owned.lensFieldMapping === undefined ? [] : [\n \"Lens field mapping: rays use the declared projection after inverse distortion; irradiance is multiplied once by the distortion area factor 1/det(d distorted/d ideal); field throughput and sampled PSFs remain evaluated at the physical sensor point.\"\n ])\n ]);\n}\n\n/** Plans, queries the provider and integrates the photo signal for one site, at the site's own midpoint sample positions. */\nexport function calculateEnvironmentSensorPhotoSignal(input: CalculateEnvironmentSensorPhotoSignalInput): CalculationResult<EnvironmentSensorPhotoSignal> {\n requireInputKeys(input, \"calculateEnvironmentSensorPhotoSignal\", [\"temporalIntegrationId\", \"sensor\", \"sceneBindings\", \"optics\", \"motion\", \"temporalSampleCount\", \"pupil\", \"lensFieldMapping\", \"fieldThroughput\", \"psf\", \"evaluateRadiance\", \"evaluateApertureRadiance\"]);\n const { evaluateRadiance, evaluateApertureRadiance, ...data } = input;\n return executeEnvironmentSensorPhotoSignal(planEnvironmentSensorPhotoSignal(data), evaluateRadiance, evaluateApertureRadiance);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"environment-photo-signal.js","sourceRoot":"","sources":["../../src/sensor/environment-photo-signal.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,mBAAmB,EAA0B,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAA2B,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,iCAAiC,EAAE,iCAAiC,EAAE,kCAAkC,EAC/G,sDAAsD,EAAE,uCAAuC,EAAE,0CAA0C,EAC9B,MAAM,6BAA6B,CAAC;A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,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI;gBACjD,iDAAiD,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAE,CAAC,iDAAiD,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACtI,CAAC;IACD,OAAO,kCAAkC,CAAC,EAAE,qBAAqB,EAAE,KAAK,CAAC,qBAAqB;QAC5F,QAAQ,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,6HAA6H;AAC7H,MAAM,UAAU,qCAAqC,CAAC,KAAiD;IACrG,gBAAgB,CAAC,KAAK,EAAE,uCAAuC,EAAE,CAAC,uBAAuB,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAE,kBAAkB,EAAE,0BAA0B,CAAC,CAAC,CAAC;IACzQ,MAAM,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACtE,OAAO,mCAAmC,CAAC,gCAAgC,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,wBAAwB,CAAC,CAAC;AACjI,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Photo signal for one sensor site from a scene-radiance provider (the \"environment\"): asks the\n * provider for radiance along each sampled direction, then applies optics and the sensor response.\n *\n * Work is split into a plan and an execution step. Planning checks spatial, spectral and temporal\n * coverage and builds an internal plan before any provider code runs. Each query gives an explicit\n * scene direction, a wavelength (air or vacuum) and a time in seconds from the shutter's opening\n * reference. Optical throughput, an optional local PSF (point-spread function) and the EQE (external\n * quantum efficiency) response then give the expected photo signal. Calling the provider does not\n * verify its light transport, visibility or calibration.\n * @see docs/ENVIRONMENT_RAW_CAPTURE.md for equations, coordinate/unit conventions, blockers and\n * support limits.\n */\n\nimport { approximationResult, type CalculationResult } from \"../core/calculation-result.js\";\nimport { freezeOwnedData } from \"../core/owned-data.js\";\nimport { requirePublicOpaqueId, requireInputKeys } from \"../core/record-validation.js\";\nimport { parseEvidenceList, type EvidenceProvenance } from \"../core/evidence-provenance.js\";\nimport { InvalidScientificInputError } from \"../core/validation.js\";\nimport { parseSceneIlluminationProfile } from \"../schema/illumination.js\";\nimport { parseSceneIlluminationTemporalProfile } from \"../schema/illumination-temporal.js\";\nimport { parseSceneMaterialResponseProfile, parseSceneRadianceProviderProfile, parseSceneRadianceEvaluationResult,\n parseSceneRadianceEvaluationResultWithValidatedRecords, validateSceneRadianceEvaluationBindings, validateSceneRadianceRequestResultBindings,\n type SceneRadianceEvaluationRequest, type SceneRadianceEvaluationResult, type ValidatedSceneRadianceRecords } from \"../schema/scene-radiance.js\";\nimport { calculateMappedSensorEnvironmentRadianceQuery, calculateSensorEnvironmentRadianceQuery, prepareEnvironmentLensFieldMapping,\n type CalculateSensorEnvironmentRadianceQueryInput, type EnvironmentLensFieldMapping } from \"../optics/sensor-environment-query.js\";\nimport { calculateSceneRadianceToSensorIrradiance, prepareSceneRadianceToSensorIrradianceValue,\n type CalculateSceneRadianceToSensorIrradianceInput } from \"../optics/scene-to-sensor-irradiance.js\";\nimport { isDeeplyFrozen } from \"../core/internal-radiance-evaluator.js\";\nimport { calculateSensorPsfIrradianceQuadrature, type CalculateSensorPsfIrradianceQuadratureInput } from \"../optics/sensor-psf-quadrature.js\";\nimport { calculateIlluminationVignetting, type IlluminationVignettingProfile } from \"../optics/illumination-vignetting.js\";\nimport { calculateSensorApertureRays, type IdealCircularPupil, type SensorApertureRay } from \"../optics/sensor-aperture-rays.js\";\nimport { sensorPsfSourcePoint } from \"../optics/sensor-psf-support.js\";\nimport { markEngineOwnedLensSampledPsfProfile, resolveLensSampledPsf } from \"../optics/lens-psf-profile.js\";\nimport { calculateSensorSpatialSamplingQuadrature } from \"./spatial-sampling-quadrature.js\";\nimport { calculateSensorSpectralQuadrature } from \"./spectral-quadrature.js\";\nimport { resolveNativeEffectiveRasterColorSamplingBinding } from \"./capture-color-sampling-binding.js\";\nimport { calculateCaptureExposureWindows } from \"./exposure-window.js\";\nimport { createSensorEqeTemporalPhotoSignal } from \"./temporal-photo-signal.js\";\nimport type { CalculateSensorEqeTemporalExposureInput } from \"./eqe-temporal-exposure.js\";\nimport type { CalculateSceneToSensorIrradianceQuadratureInput } from \"../optics/scene-to-sensor-quadrature.js\";\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\n\n/** Caller-supplied synchronous radiance function, run locally. Calling it does not prove its light transport is physical. */\nexport type EnvironmentRadianceEvaluator = (request: Readonly<SceneRadianceEvaluationRequest>) => SceneRadianceEvaluationResult;\nexport type EnvironmentApertureRadianceEvaluator = (request: Readonly<SceneRadianceEvaluationRequest>, apertureRay: Readonly<SensorApertureRay>) => SceneRadianceEvaluationResult;\nexport interface CalculateEnvironmentSensorPhotoSignalInput {\n temporalIntegrationId: string;\n sensor: Omit<CalculateSensorEqeTemporalExposureInput, \"samples\">;\n sceneBindings: CalculateSceneToSensorIrradianceQuadratureInput[\"sceneBindings\"];\n optics: Omit<CalculateSceneRadianceToSensorIrradianceInput,\n \"sceneRadianceRequest\" | \"sceneRadianceResult\" | \"imagePointMm\" | \"fieldThroughput\">;\n motion: Pick<CalculateSensorEnvironmentRadianceQueryInput,\n \"angularVelocityRadPerSec\" | \"timeReference\" | \"environmentDirectionConvention\">;\n temporalSampleCount: number;\n /** Optional ideal circular pupil, for geometric depth of field (DOF) and visibility. Cannot be combined with a sampled PSF. */\n pupil?: IdealCircularPupil;\n /**\n * Optional lens field mapping (added in 2.0): a projection model and radial or Brown-Conrady\n * distortion for the scene-ray query. Its distortion area factor is applied to irradiance exactly\n * once. If omitted, the ideal rectilinear, distortion-free path is unchanged. Cannot be combined\n * with `pupil`.\n */\n lensFieldMapping?: EnvironmentLensFieldMapping;\n /** Explicit attenuation across the field (such as vignetting), applied once before the PSF spreads the light. */\n fieldThroughput: { kind: \"unity\"; evidence: readonly EvidenceProvenance[]; limitation: string } | {\n kind: \"radial-illumination-vignetting\"; profile: IlluminationVignettingProfile;\n evidence: readonly EvidenceProvenance[]; limitation: string;\n };\n psf: { kind: \"not-applied\"; evidence: readonly EvidenceProvenance[]; limitation: string } | {\n kind: \"sampled-local\";\n configuration: Pick<CalculateSensorPsfIrradianceQuadratureInput, \"psf\" | \"psfWavelengthBasis\" | \"spatialModel\">;\n };\n evaluateRadiance: EnvironmentRadianceEvaluator;\n /** Required with `pupil`: rays start at different points on the aperture, so a direction-only function cannot be used. */\n evaluateApertureRadiance?: EnvironmentApertureRadianceEvaluator;\n}\nexport interface EnvironmentSensorPhotoSignal {\n sourceTargetProjectionCalculated: true;\n providerCallbackExecuted: true;\n providerTransportVerified: false;\n sceneVisibilityCalculated: false;\n productionPlanActivated: false;\n providerEvaluationCount: number;\n sourcePlane: \"sensor-package-incident\";\n fieldThroughputEvidence: readonly EvidenceProvenance[];\n fieldThroughputLimitation: string;\n psfOmission: { evidence: readonly EvidenceProvenance[]; limitation: string } | null;\n psfRedistributionApplied: boolean;\n pupilIntegrationApplied: boolean;\n pupilIntegrationProfile: IdealCircularPupil | null;\n photo: ReturnType<typeof createSensorEqeTemporalPhotoSignal>;\n instants: readonly {\n temporalSampleIndex: number;\n timeSecondsFromOpeningReference: number;\n psf: ReturnType<typeof calculateSensorPsfIrradianceQuadrature> | null;\n evaluations: readonly {\n query: ReturnType<typeof calculateSensorEnvironmentRadianceQuery>;\n result: SceneRadianceEvaluationResult;\n bindings: ReturnType<typeof validateSceneRadianceEvaluationBindings>;\n optics: ReturnType<typeof calculateSceneRadianceToSensorIrradiance>;\n apertureRay?: SensorApertureRay;\n apertureRequest?: SceneRadianceEvaluationRequest;\n }[];\n }[];\n}\n\n/** Internal plan, shared with the full-frame composer, so all work is bounded before any callback runs. */\ninterface EnvironmentPhotoPlan {\n owned: Omit<CalculateEnvironmentSensorPhotoSignalInput, \"evaluateRadiance\" | \"evaluateApertureRadiance\">;\n sceneBindings: CalculateSceneToSensorIrradianceQuadratureInput[\"sceneBindings\"];\n fieldThroughputEvidence: readonly EvidenceProvenance[];\n spatialQuadrature: ReturnType<typeof calculateSensorSpatialSamplingQuadrature>[\"value\"];\n spectralQuadrature: ReturnType<typeof calculateSensorSpectralQuadrature>[\"value\"];\n count: number;\n focus: CalculateSensorEnvironmentRadianceQueryInput[\"focus\"];\n instants: { temporalSampleIndex: number; time: number; groups: {\n node: CalculateSensorPsfIrradianceQuadratureInput[\"samples\"][number][\"node\"];\n taps: { kernelSampleX: number; kernelSampleY: number; point: { x: number; y: number };\n /** Deep-frozen provider request of the planned query (the same object as query.value.request). */\n request: SceneRadianceEvaluationRequest;\n /** The planned query's image-plane source point (the same object as query.value.sourcePointImagePlaneMm). */\n sourcePointImagePlaneMm: { x: number; y: number };\n /** The complete query result. Kept only by \"full\" plans, whose per-evaluation records include it. */\n query?: ReturnType<typeof calculateSensorEnvironmentRadianceQuery>;\n apertureRays?: readonly SensorApertureRay[];\n /** 1 / det(d distorted / d ideal), the change in area from distortion. Present only with a lens field mapping. */\n distortionAreaFactor?: number;\n fieldThroughput: CalculateSceneRadianceToSensorIrradianceInput[\"fieldThroughput\"] }[];\n }[] }[];\n}\n/**\n * Builds an internal execution plan covering all optical, spatial, spectral and temporal sampling,\n * without calling any provider code.\n *\n * Coverage is checked completely before any supplied radiance function runs. Each query gives an\n * explicit scene direction, a wavelength (air or vacuum) and seconds from the opening reference.\n * @param input - The photo-signal input without its radiance functions; see\n * `CalculateEnvironmentSensorPhotoSignalInput`.\n * @param ownership - Internal. \"copy\" (default) makes a structured clone of the input. \"engine-owned\"\n * uses the input as the plan's own data without cloning again. Only engine callers that already hold a\n * private structured clone, never shown to supplied code and never changed afterwards, may pass it.\n * @param retention - Internal. \"full\" (default) keeps every planned query result for \"full\" execution\n * records. \"photo-only\" keeps only each query's frozen request and image-plane point, which is all that\n * photo-only execution reads. Every query is still computed and validated at plan time, so limit checks\n * and errors are unchanged.\n * @returns The result. Success does not imply calibration.\n *\n * @see docs/API_REFERENCE.md for the package export and its full type definitions.\n */\nexport function planEnvironmentSensorPhotoSignal(input: Omit<CalculateEnvironmentSensorPhotoSignalInput, \"evaluateRadiance\" | \"evaluateApertureRadiance\">,\n ownership: \"copy\" | \"engine-owned\" = \"copy\", retention: \"full\" | \"photo-only\" = \"full\"): EnvironmentPhotoPlan {\n const owned = ownership === \"engine-owned\" ? input : structuredClone(input);\n requirePublicOpaqueId(owned.temporalIntegrationId, \"Environment integration requires a public identity.\");\n if (!Number.isSafeInteger(owned.temporalSampleCount) || owned.temporalSampleCount < 1 || owned.temporalSampleCount > 256 ||\n owned.sensor.responseApplication.sourcePlane.value !== \"sensor-package-incident\" ||\n (owned.fieldThroughput?.kind !== \"unity\" && owned.fieldThroughput?.kind !== \"radial-illumination-vignetting\") || typeof owned.fieldThroughput.limitation !== \"string\" || !owned.fieldThroughput.limitation.trim()) {\n throw new InvalidScientificInputError(\"Environment exposure requires package-incident response, 1..256 midpoints and explicit supported field throughput.\");\n }\n if (owned.fieldThroughput.kind === \"radial-illumination-vignetting\" &&\n (typeof owned.fieldThroughput.profile !== \"object\" || owned.fieldThroughput.profile === null ||\n typeof owned.fieldThroughput.profile.coefficients !== \"object\" || owned.fieldThroughput.profile.coefficients === null)) {\n throw new InvalidScientificInputError(\"Radial throughput requires a declared profile and coefficients.\");\n }\n const fieldThroughputEvidence = parseEvidenceList(owned.fieldThroughput.evidence, \"environmentFieldThroughput.evidence\");\n const sceneBindings = { providerProfile: parseSceneRadianceProviderProfile(owned.sceneBindings.providerProfile),\n illuminationProfile: parseSceneIlluminationProfile(owned.sceneBindings.illuminationProfile),\n materialResponseProfile: parseSceneMaterialResponseProfile(owned.sceneBindings.materialResponseProfile),\n ...(owned.sceneBindings.illuminationTemporalProfile === undefined ? {} : {\n illuminationTemporalProfile: parseSceneIlluminationTemporalProfile(owned.sceneBindings.illuminationTemporalProfile) }) };\n if (sceneBindings.providerProfile.fidelity.spectral !== \"wavelength-resolved\") throw new InvalidScientificInputError(\"Environment exposure requires wavelength-resolved provider fidelity.\");\n const sensor = owned.sensor;\n const nativeRaster = sensor.localExposure.exposureWindowInput.nativeRaster;\n const binding = resolveNativeEffectiveRasterColorSamplingBinding({ nativeRaster, colorSamplingProfile: sensor.colorSamplingProfile,\n bindingProfile: sensor.localExposure.bindingProfile });\n if (binding.relationshipMeaning !== \"one-native-effective-sample-to-one-color-site\") throw new InvalidScientificInputError(\"Environment exposure requires explicit one-to-one native/color timing.\");\n const spatialQuadrature = calculateSensorSpatialSamplingQuadrature({ ...sensor.spatialSampling, nativeRaster,\n colorSamplingProfile: sensor.colorSamplingProfile, colorSamplingBindingProfile: sensor.localExposure.bindingProfile }).value;\n const spectralQuadrature = calculateSensorSpectralQuadrature({ ...sensor.spectralSampling,\n colorSamplingProfile: sensor.colorSamplingProfile, spectralResponseProfile: sensor.spectralResponseProfile }).value;\n if (spectralQuadrature.wavelengthBasis === \"unspecified\") throw new InvalidScientificInputError(\"Environment spectral basis must be explicit.\");\n const wavelengthBasis = spectralQuadrature.wavelengthBasis;\n const site = sensor.spatialSampling.site;\n const window = calculateCaptureExposureWindows({ ...sensor.localExposure.exposureWindowInput,\n samplePointsNative: [{ x: site.x+.5, y: site.y+.5 }] }).value.samples[0]!;\n const focus = owned.optics.focus.kind === \"infinity-focus\" ? { kind: \"infinity\" as const } :\n owned.optics.focus.kind === \"ideal-symmetric-thin-lens\" ? { kind: \"finite\" as const, distanceM: owned.optics.focus.objectDistanceM } :\n owned.optics.focus.focus.kind === \"infinity\" ? { kind: \"infinity\" as const } : { kind: \"finite\" as const, distanceM: owned.optics.focus.focus.objectDistanceM };\n if (owned.psf.kind === \"not-applied\") {\n parseEvidenceList(owned.psf.evidence, \"environmentPsfOmission.evidence\");\n if (typeof owned.psf.limitation !== \"string\" || !owned.psf.limitation.trim()) throw new InvalidScientificInputError(\"PSF omission needs an explicit limitation.\");\n } else if (owned.psf.kind !== \"sampled-local\") throw new InvalidConfigurationError(\"Unknown environment PSF selection.\");\n if (owned.psf.kind === \"sampled-local\") {\n const p = owned.psf.configuration.psf;\n // The profile belongs only to this plan, so its parse can be cached across nodes and time instants.\n markEngineOwnedLensSampledPsfProfile(p.profile);\n if (p.focalLengthMm !== owned.optics.focalLengthMm || p.apertureFNumber !== owned.optics.nominalFNumber ||\n p.focus.kind !== focus.kind || (p.focus.kind === \"finite\" && focus.kind === \"finite\" && p.focus.distanceM !== focus.distanceM)) {\n throw new InvalidScientificInputError(\"PSF and optical focal/aperture/focus state must match exactly.\");\n }\n }\n if (owned.pupil !== undefined && owned.psf.kind !== \"not-applied\") throw new InvalidScientificInputError(\"Ideal pupil integration cannot mix with a sampled PSF; geometric defocus would be ambiguous.\");\n const lensMapping = owned.lensFieldMapping === undefined ? undefined : prepareEnvironmentLensFieldMapping(owned.lensFieldMapping);\n if (lensMapping !== undefined && owned.pupil !== undefined) {\n throw new InvalidScientificInputError(\"Ideal pupil rays use the rectilinear distortion-free projection and cannot combine with a lens field mapping.\");\n }\n const pupilCount = owned.pupil === undefined ? 1 : calculateSensorApertureRays({sourcePointNativeSensorMm:{x:0,y:0},\n focalLengthMm:owned.optics.focalLengthMm,nominalFNumber:owned.optics.nominalFNumber,focus,pupil:owned.pupil,\n angularVelocityRadPerSec:owned.motion.angularVelocityRadPerSec,timeSecondsFromOpeningReference:window.startOffsetSecondsFromOpeningReference}).value.rays.length;\n let count = 0;\n const nodes = spectralQuadrature.nodes.flatMap(spectral => spatialQuadrature.nodes.map(spatial => {\n const node = { spatialNode: { antiAliasingComponentIndex: spatial.antiAliasingComponentIndex,\n apertureSampleXIndex: spatial.apertureSampleXIndex, apertureSampleYIndex: spatial.apertureSampleYIndex },\n spectralSampleIndex: spectral.spectralSampleIndex, wavelengthNanometers: spectral.wavelengthNanometers };\n const destination = spatial.preAntiAliasingSourcePointMm;\n const resolved = owned.psf.kind === \"sampled-local\" ? resolveLensSampledPsf({ ...owned.psf.configuration.psf,\n wavelengthNm: spectral.wavelengthNanometers, fieldPointMm: { x: destination.x, y: -destination.y } }) : null;\n const kernel = resolved?.value.kernel;\n const taps = kernel ? kernel.widthSamples*kernel.heightSamples : 1;\n count += taps*owned.temporalSampleCount*pupilCount;\n if (count > 100000) throw new InvalidScientificInputError(\"Environment exposure exceeds the 100000-provider-evaluation budget.\");\n const points = Array.from({ length: taps }, (_, i) => ({ kernelSampleX: kernel ? i%kernel.widthSamples : 0,\n kernelSampleY: kernel ? Math.floor(i/kernel.widthSamples) : 0,\n point: kernel ? sensorPsfSourcePoint(destination, kernel, i%kernel.widthSamples, Math.floor(i/kernel.widthSamples)) : { ...destination } }));\n return { node, points: points.map(p => ({ ...p, fieldThroughput: owned.fieldThroughput.kind === \"unity\"\n ? { kind: \"unity\" as const }\n : { kind: \"illumination-vignetting-result\" as const, result: calculateIlluminationVignetting({\n imagePointMm: { x: p.point.x, y: -p.point.y }, profile: owned.fieldThroughput.profile }).value } })) };\n }));\n const measure = window.localExposureDurationSeconds/owned.temporalSampleCount;\n let previous = -Infinity;\n const instants = Array.from({ length: owned.temporalSampleCount }, (_, temporalSampleIndex) => {\n const time = window.startOffsetSecondsFromOpeningReference+(temporalSampleIndex+.5)*measure;\n if (!(time > window.startOffsetSecondsFromOpeningReference && time > previous && time < window.endOffsetSecondsFromOpeningReference)) throw new InvalidScientificInputError(\"Local midpoints must be representable and strictly ordered.\");\n previous = time;\n const groups = nodes.map((n, ni) => ({ node: n.node, taps: n.points.map((p, pi) => {\n const apertureRays = owned.pupil === undefined ? undefined : calculateSensorApertureRays({sourcePointNativeSensorMm:p.point,\n focalLengthMm:owned.optics.focalLengthMm,nominalFNumber:owned.optics.nominalFNumber,focus,pupil:owned.pupil,\n angularVelocityRadPerSec:owned.motion.angularVelocityRadPerSec,timeSecondsFromOpeningReference:time}).value.rays;\n const queryInput: CalculateSensorEnvironmentRadianceQueryInput = { ...owned.motion, sourcePointNativeSensorMm: p.point,\n focalLengthMm: owned.optics.focalLengthMm, focus, timeSecondsFromOpeningReference: time,\n request: { schemaVersion: \"0.1.0\", sampleId: `${owned.temporalIntegrationId}-t${temporalSampleIndex}-n${ni}-p${pi}`,\n providerProfileId: sceneBindings.providerProfile.profileId, sceneId: sceneBindings.providerProfile.sceneId,\n illuminationProfileId: sceneBindings.illuminationProfile.profileId, materialResponseProfileId: sceneBindings.materialResponseProfile.profileId,\n wavelengthNanometers: n.node.wavelengthNanometers, wavelengthBasis } };\n const query = freezePlannedRequest(lensMapping === undefined ? calculateSensorEnvironmentRadianceQuery(queryInput)\n : calculateMappedSensorEnvironmentRadianceQuery(queryInput, lensMapping));\n const areaFactor = query.value.lensFieldMapping?.distortionAreaFactor;\n // Photo-only plans drop the query result (projection, diagnostics) once it is validated (a 2.0 memory saving).\n return { ...p, ...(apertureRays === undefined ? {} : { apertureRays }),\n ...(areaFactor === undefined ? {} : { distortionAreaFactor: areaFactor }), request: query.value.request,\n sourcePointImagePlaneMm: query.value.sourcePointImagePlaneMm, ...(retention === \"full\" ? { query } : {}) };\n }) }));\n // Validate PSF evidence/basis/support before supplied code is invoked.\n if (owned.psf.kind === \"sampled-local\") calculateSensorPsfIrradianceQuadrature({ ...owned.psf.configuration,\n spatialQuadrature, spectralQuadrature, timeSecondsFromOpeningReference: time,\n inputMeaning: \"pre-psf-pre-sensor-stack-pre-aa-spectral-irradiance\", samples: groups.map(g => ({ node: g.node,\n sourceSamples: g.taps.map(t => ({ kernelSampleX: t.kernelSampleX, kernelSampleY: t.kernelSampleY,\n sourcePointNativeSensorMm: t.point, timeSecondsFromOpeningReference: time, spectralIrradianceWattsPerSquareMeterPerNanometer: 0 })) })) });\n return { temporalSampleIndex, time, groups };\n });\n return { owned, sceneBindings, fieldThroughputEvidence, spatialQuadrature, spectralQuadrature, instants, count, focus };\n}\n\n/** Aperture queries already built for a batched provider, keyed by the planned ray; each is used once. */\nconst PREBUILT_APERTURE_QUERIES = new WeakMap<object, { base: object; request: SceneRadianceEvaluationRequest; apertureRay: SensorApertureRay }>();\n\n/**\n * Internal: the frozen provider request and frozen private ray copy of one ideal-pupil query (sample ID suffix \"-a\"\n * and the pupil index, reversed ray direction). If prebuildApertureRadianceQuery already built this query for a batch,\n * the same objects are returned once, so the batch and the executor share them; otherwise new ones are built.\n */\nexport function apertureRadianceQuery(base: SceneRadianceEvaluationRequest, ray: SensorApertureRay):\n { request: SceneRadianceEvaluationRequest; apertureRay: SensorApertureRay } {\n const prebuilt = PREBUILT_APERTURE_QUERIES.get(ray);\n if (prebuilt !== undefined && prebuilt.base === base) {\n PREBUILT_APERTURE_QUERIES.delete(ray);\n return { request: prebuilt.request, apertureRay: prebuilt.apertureRay };\n }\n return { request: freezeOwnedData({ ...base, sampleId: base.sampleId+\"-a\"+ray.pupilSampleIndex,\n target: { kind: \"environment-direction\" as const, outgoingDirectionUnitVector: {\n x: -ray.directionUnitVector.x, y: -ray.directionUnitVector.y, z: -ray.directionUnitVector.z } } }),\n apertureRay: freezeOwnedData(copyRay(ray)) };\n}\n/**\n * A private copy of an engine-computed ray: plain records of numbers, copied key by key in the same order, so it\n * equals what structuredClone returns for this data (a 2.0 performance change: structuredClone dominated pupil runs).\n */\nfunction copyRay(ray: SensorApertureRay): SensorApertureRay {\n const copy = (value: unknown): unknown => {\n if (typeof value !== \"object\" || value === null) return value;\n if (Array.isArray(value)) return value.map(copy);\n const out: Record<string, unknown> = {};\n for (const key of Object.keys(value)) out[key] = copy((value as Record<string, unknown>)[key]);\n return out;\n };\n return copy(ray) as SensorApertureRay;\n}\n/** Internal: builds a pupil query for a batched provider and keeps it for the executor's apertureRadianceQuery call. */\nexport function prebuildApertureRadianceQuery(base: SceneRadianceEvaluationRequest, ray: SensorApertureRay):\n { request: SceneRadianceEvaluationRequest; apertureRay: SensorApertureRay } {\n PREBUILT_APERTURE_QUERIES.delete(ray);\n const query = apertureRadianceQuery(base, ray);\n PREBUILT_APERTURE_QUERIES.set(ray, { base, ...query });\n return query;\n}\n\n/** Deep-freezes a planned provider request once, so execution can hand the same immutable request to supplied code. */\nfunction freezePlannedRequest<T extends { value: { request: object } }>(query: T): T {\n freezeOwnedData(query.value.request);\n return query;\n}\n\n/**\n * Internal: runs a completed, bounded plan. On failure nothing partial is returned.\n * With retention \"full\" (default), every per-evaluation record is kept in value.instants[].evaluations.\n * With \"photo-only\", those lists are empty, for engine callers that read only value.photo. Photo values\n * are identical either way.\n */\nexport function executeEnvironmentSensorPhotoSignal(plan: ReturnType<typeof planEnvironmentSensorPhotoSignal>, evaluate: EnvironmentRadianceEvaluator, evaluateAperture?: EnvironmentApertureRadianceEvaluator,\n retention: \"full\" | \"photo-only\" = \"full\"): CalculationResult<EnvironmentSensorPhotoSignal> {\n if (typeof evaluate !== \"function\") throw new InvalidScientificInputError(\"Environment radiance evaluator must be synchronous callable code.\");\n const { owned } = plan;\n if (owned.pupil !== undefined && typeof evaluateAperture !== \"function\") throw new InvalidScientificInputError(\"Pupil integration requires an origin-aware aperture evaluator.\");\n if (retention === \"full\" && plan.instants.some(instant => instant.groups.some(group => group.taps.some(tap => tap.query === undefined)))) {\n throw new InvalidScientificInputError(\"Full environment execution records require a full plan.\");\n }\n const irradiance = [];\n const instants: EnvironmentSensorPhotoSignal[\"instants\"][number][] = [];\n for (const instant of plan.instants) {\n const evaluations: EnvironmentSensorPhotoSignal[\"instants\"][number][\"evaluations\"][number][] = [];\n const samples = instant.groups.map(group => ({ node: group.node, sourceSamples: group.taps.map(tap => {\n let integratedIrradiance = 0;\n const support: readonly (SensorApertureRay | undefined)[] = tap.apertureRays ?? [undefined];\n for (const ray of support) {\n // Planned requests are deep-frozen once at plan time (freezePlannedRequest); no per-evaluation clone.\n const query = ray === undefined ? undefined : apertureRadianceQuery(tap.request, ray);\n const request = query === undefined ? tap.request : query.request, apertureRay = query?.apertureRay;\n const result = parseSceneRadianceEvaluationResult(apertureRay === undefined ? evaluate(request) : evaluateAperture!(request,apertureRay));\n const bindings = validateSceneRadianceEvaluationBindings({ ...plan.sceneBindings, request, result });\n const optics = calculateSceneRadianceToSensorIrradiance({ ...owned.optics, sceneRadianceRequest: request,\n sceneRadianceResult: result, imagePointMm: tap.sourcePointImagePlaneMm, fieldThroughput: tap.fieldThroughput });\n if (retention === \"full\") evaluations.push({ query: tap.query!, result, bindings, optics,\n ...(apertureRay === undefined ? {} : {apertureRay,apertureRequest:request}) });\n integratedIrradiance += optics.value.sensorPlaneSpectralIrradianceWattsPerSquareMeterNanometer*(ray?.weight ?? 1);\n }\n if (tap.distortionAreaFactor !== undefined) {\n // Distortion squeezes or stretches the ideal image. Flux is conserved, so irradiance scales by 1/det, once.\n integratedIrradiance *= tap.distortionAreaFactor;\n }\n return { kernelSampleX: tap.kernelSampleX, kernelSampleY: tap.kernelSampleY, sourcePointNativeSensorMm: tap.point,\n timeSecondsFromOpeningReference: instant.time, spectralIrradianceWattsPerSquareMeterPerNanometer: integratedIrradiance };\n }) }));\n const psf = owned.psf.kind === \"sampled-local\" ? calculateSensorPsfIrradianceQuadrature({ ...owned.psf.configuration,\n spatialQuadrature: plan.spatialQuadrature, spectralQuadrature: plan.spectralQuadrature,\n timeSecondsFromOpeningReference: instant.time, inputMeaning: \"pre-psf-pre-sensor-stack-pre-aa-spectral-irradiance\", samples }) : null;\n irradiance.push({ temporalSampleIndex: instant.temporalSampleIndex, timeSecondsFromOpeningReference: instant.time,\n irradianceSamples: psf ? psf.value.irradianceSamples : samples.map(s => ({ node: s.node,\n spectralIrradianceWattsPerSquareMeterPerNanometer: s.sourceSamples[0]!.spectralIrradianceWattsPerSquareMeterPerNanometer })) });\n instants.push({ temporalSampleIndex: instant.temporalSampleIndex, timeSecondsFromOpeningReference: instant.time, psf, evaluations });\n }\n const photo = createSensorEqeTemporalPhotoSignal({ temporalIntegrationId: owned.temporalIntegrationId,\n exposure: { ...owned.sensor, samples: irradiance } });\n return approximationResult({ sourceTargetProjectionCalculated: true, providerCallbackExecuted: true,\n providerTransportVerified: false, sceneVisibilityCalculated: false, productionPlanActivated: false,\n providerEvaluationCount: plan.count, sourcePlane: \"sensor-package-incident\", fieldThroughputEvidence: plan.fieldThroughputEvidence,\n fieldThroughputLimitation: owned.fieldThroughput.limitation,\n psfOmission: owned.psf.kind === \"not-applied\" ? { evidence: parseEvidenceList(owned.psf.evidence, \"psfOmission.evidence\"), limitation: owned.psf.limitation } : null,\n psfRedistributionApplied: owned.psf.kind === \"sampled-local\", pupilIntegrationApplied: owned.pupil !== undefined, pupilIntegrationProfile: owned.pupil ?? null, photo, instants\n }, \"environment-sensor-photo-signal\", owned.lensFieldMapping === undefined ? \"0.3.0\" : \"0.4.0\", [\n \"Supplied synchronous provider code was invoked at each generated environment query; physical transport and visibility are not verified.\",\n \"Ideal focus-aware rotation/projection, explicit evidence-bound field throughput and optional destination-local sampled PSF are bounded approximations.\",\n \"Optional ideal pupil rays use normalized radiance averaging; source intersections remain provider-owned and convergence is unverified.\",\n \"PSF pupil throughput is not applied; child uncertainty, finite-support and quadrature convergence are not combined or established.\",\n ...(owned.lensFieldMapping === undefined ? [] : [\n \"Lens field mapping: rays use the declared projection after inverse distortion; irradiance is multiplied once by the distortion area factor 1/det(d distorted/d ideal); field throughput and sampled PSFs remain evaluated at the physical sensor point.\"\n ])\n ]);\n}\n\n/**\n * Internal (#453; not exported from the package): the photo signal of {@link executeEnvironmentSensorPhotoSignal} with\n * retention \"photo-only\" (its `value.photo`), for a plan of engine-built records (planned as \"engine-owned\" from a record the\n * engine built, never shown to supplied code and never changed). It is the same chain with the same operations: every query of\n * the plan calls `evaluate` once with the same frozen request, in the same order; each result is parsed and its bindings and\n * identity checked; the optical bridge forms each irradiance with its own code; the taps, nodes and instants are assembled as\n * the full executor does; and `createSensorEqeTemporalPhotoSignal` forms the photo signal from the same input. So the photo\n * signal is the full executor's, value for value.\n *\n * What it skips is only re-validation of records that cannot have changed since they passed it, and records nobody reads:\n * - the first query runs the full per-query steps (full result parse, `validateSceneRadianceEvaluationBindings`,\n * `calculateSceneRadianceToSensorIrradiance`); later queries skip the profile-to-profile binding checks and the optical\n * bridge's re-parse of its unchanged optical inputs, request and result, keeping every per-query check\n * (`validateSceneRadianceRequestResultBindings`, `prepareSceneRadianceToSensorIrradianceValue`), with the same messages;\n * - with `engineBuiltResults` (an evaluator marked by `markInternalSceneRadianceEvaluator`, or one returning such an\n * evaluator's results), later results reuse the first result's parsed uncertainty, evidence and limitations when they are\n * the same deep-frozen objects (`parseSceneRadianceEvaluationResultWithValidatedRecords`, as the lean executor does);\n * - no per-query optical result envelopes and no outer execution envelope are built.\n * Plans with ideal-pupil rays or a sampled PSF run the full executor.\n */\nexport function executeEngineOwnedEnvironmentPhotoSignal(plan: ReturnType<typeof planEnvironmentSensorPhotoSignal>, evaluate: EnvironmentRadianceEvaluator,\n engineBuiltResults: boolean): EnvironmentSensorPhotoSignal[\"photo\"] {\n const { owned } = plan;\n if (owned.pupil !== undefined || owned.psf.kind !== \"not-applied\") return executeEnvironmentSensorPhotoSignal(plan, evaluate, undefined, \"photo-only\").value.photo;\n if (typeof evaluate !== \"function\") throw new InvalidScientificInputError(\"Environment radiance evaluator must be synchronous callable code.\");\n const { providerProfile, illuminationProfile, materialResponseProfile } = plan.sceneBindings;\n let validated: ValidatedSceneRadianceRecords | undefined;\n let irradianceOf: ReturnType<typeof prepareSceneRadianceToSensorIrradianceValue> | undefined;\n const irradiance = [];\n for (const instant of plan.instants) {\n const samples = instant.groups.map(group => ({ node: group.node, sourceSamples: group.taps.map(tap => {\n let integratedIrradiance = 0;\n const request = tap.request, value = evaluate(request);\n let sensorPlane: number;\n if (irradianceOf === undefined) {\n const result = parseSceneRadianceEvaluationResult(value);\n validateSceneRadianceEvaluationBindings({ ...plan.sceneBindings, request, result });\n sensorPlane = calculateSceneRadianceToSensorIrradiance({ ...owned.optics, sceneRadianceRequest: request,\n sceneRadianceResult: result, imagePointMm: tap.sourcePointImagePlaneMm, fieldThroughput: tap.fieldThroughput }).value.sensorPlaneSpectralIrradianceWattsPerSquareMeterNanometer;\n const record = value as unknown as Record<string, unknown>;\n if (engineBuiltResults && isDeeplyFrozen(record.uncertainty) && isDeeplyFrozen(record.evidence) && isDeeplyFrozen(record.limitations)) {\n validated = { uncertainty: record.uncertainty, evidence: record.evidence, limitations: record.limitations, parsed: result };\n }\n irradianceOf = prepareSceneRadianceToSensorIrradianceValue(owned.optics);\n } else {\n const result = validated ? parseSceneRadianceEvaluationResultWithValidatedRecords(value, validated) : parseSceneRadianceEvaluationResult(value);\n validateSceneRadianceRequestResultBindings(providerProfile, illuminationProfile, materialResponseProfile, request, result);\n sensorPlane = irradianceOf(request, result, tap.sourcePointImagePlaneMm, tap.fieldThroughput);\n }\n // The full executor's sum over the tap's support (one direction, weight 1 without pupil rays).\n integratedIrradiance += sensorPlane*1;\n if (tap.distortionAreaFactor !== undefined) integratedIrradiance *= tap.distortionAreaFactor;\n return { kernelSampleX: tap.kernelSampleX, kernelSampleY: tap.kernelSampleY, sourcePointNativeSensorMm: tap.point,\n timeSecondsFromOpeningReference: instant.time, spectralIrradianceWattsPerSquareMeterPerNanometer: integratedIrradiance };\n }) }));\n irradiance.push({ temporalSampleIndex: instant.temporalSampleIndex, timeSecondsFromOpeningReference: instant.time,\n irradianceSamples: samples.map(s => ({ node: s.node,\n spectralIrradianceWattsPerSquareMeterPerNanometer: s.sourceSamples[0]!.spectralIrradianceWattsPerSquareMeterPerNanometer })) });\n }\n return createSensorEqeTemporalPhotoSignal({ temporalIntegrationId: owned.temporalIntegrationId,\n exposure: { ...owned.sensor, samples: irradiance } });\n}\n\n/** Plans, queries the provider and integrates the photo signal for one site, at the site's own midpoint sample positions. */\nexport function calculateEnvironmentSensorPhotoSignal(input: CalculateEnvironmentSensorPhotoSignalInput): CalculationResult<EnvironmentSensorPhotoSignal> {\n requireInputKeys(input, \"calculateEnvironmentSensorPhotoSignal\", [\"temporalIntegrationId\", \"sensor\", \"sceneBindings\", \"optics\", \"motion\", \"temporalSampleCount\", \"pupil\", \"lensFieldMapping\", \"fieldThroughput\", \"psf\", \"evaluateRadiance\", \"evaluateApertureRadiance\"]);\n const { evaluateRadiance, evaluateApertureRadiance, ...data } = input;\n return executeEnvironmentSensorPhotoSignal(planEnvironmentSensorPhotoSignal(data), evaluateRadiance, evaluateApertureRadiance);\n}\n"]}
|
package/docs/API_REFERENCE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Public API reference
|
|
2
2
|
|
|
3
|
-
Generated from the exact root exports for **@photivra/engine 2.
|
|
3
|
+
Generated from the exact root exports for **@photivra/engine 2.10.0 / root contract 2.10.0** by `node scripts/generate-api-reference.mjs`. No module deep import is supported.
|
|
4
4
|
|
|
5
5
|
Use [the developer guide](https://github.com/Photivra/photivra/blob/main/docs/DEVELOPERS.md) for executable paths and scientific boundaries. Types are contracts, not runtime validation: parse untrusted data, preserve units/reference frames, read assessment blockers, and retain evidence/limitations. Optional properties do not imply a universal default. Model/schema IDs remain independent of the distribution.
|
|
6
6
|
|
|
@@ -1157,6 +1157,17 @@ Start here to find a function by task. [Using Photivra from an agent](AGENT_GUID
|
|
|
1157
1157
|
| [`UniformChartScene`](api/facade-chart-scenes.md#uniformchartscene) | Type |
|
|
1158
1158
|
| [`ZonePlateChartScene`](api/facade-chart-scenes.md#zoneplatechartscene) | Type |
|
|
1159
1159
|
|
|
1160
|
+
## facade/display-view.ts
|
|
1161
|
+
|
|
1162
|
+
[Detailed contracts](api/facade-display-view.md) · [Source](https://github.com/Photivra/photivra/blob/main/src/facade/display-view.ts)
|
|
1163
|
+
|
|
1164
|
+
| Export | Kind |
|
|
1165
|
+
| --- | --- |
|
|
1166
|
+
| [`bindDisplayViewCorrectionStates`](api/facade-display-view.md#binddisplayviewcorrectionstates) | Runtime |
|
|
1167
|
+
| [`DisplayViewCorrectionStateKeys`](api/facade-display-view.md#displayviewcorrectionstatekeys) | Type |
|
|
1168
|
+
| [`DisplayViewCorrectionStateSet`](api/facade-display-view.md#displayviewcorrectionstateset) | Type |
|
|
1169
|
+
| [`serializeDisplayViewCorrectionStates`](api/facade-display-view.md#serializedisplayviewcorrectionstates) | Runtime |
|
|
1170
|
+
|
|
1160
1171
|
## facade/scene-radiance.ts
|
|
1161
1172
|
|
|
1162
1173
|
[Detailed contracts](api/facade-scene-radiance.md) · [Source](https://github.com/Photivra/photivra/blob/main/src/facade/scene-radiance.ts)
|
|
@@ -1191,6 +1202,7 @@ Start here to find a function by task. [Using Photivra from an agent](AGENT_GUID
|
|
|
1191
1202
|
| [`SIMULATE_CAPTURE_COST_OPTIONS`](api/facade-simulate-capture.md#simulate_capture_cost_options) | Runtime |
|
|
1192
1203
|
| [`SIMULATE_CAPTURE_DEFAULT_ILLUMINANCE_LUX`](api/facade-simulate-capture.md#simulate_capture_default_illuminance_lux) | Runtime |
|
|
1193
1204
|
| [`SIMULATE_CAPTURE_FACADE_VERSION`](api/facade-simulate-capture.md#simulate_capture_facade_version) | Runtime |
|
|
1205
|
+
| [`SIMULATE_CAPTURE_FAST_OPTIONS`](api/facade-simulate-capture.md#simulate_capture_fast_options) | Runtime |
|
|
1194
1206
|
| [`SIMULATE_DISPLAY_VIEW_DEFAULT_SAMPLES_PER_AXIS`](api/facade-simulate-capture.md#simulate_display_view_default_samples_per_axis) | Runtime |
|
|
1195
1207
|
| [`simulateCapture`](api/facade-simulate-capture.md#simulatecapture) | Runtime |
|
|
1196
1208
|
| [`SimulateCaptureAssumption`](api/facade-simulate-capture.md#simulatecaptureassumption) | Type |
|
|
@@ -1198,8 +1210,11 @@ Start here to find a function by task. [Using Photivra from an agent](AGENT_GUID
|
|
|
1198
1210
|
| [`SimulateCaptureColorEncoding`](api/facade-simulate-capture.md#simulatecapturecolorencoding) | Type |
|
|
1199
1211
|
| [`SimulateCaptureCostOption`](api/facade-simulate-capture.md#simulatecapturecostoption) | Type |
|
|
1200
1212
|
| [`SimulateCaptureDemosaic`](api/facade-simulate-capture.md#simulatecapturedemosaic) | Type |
|
|
1213
|
+
| [`SimulateCaptureDemosaicRecord`](api/facade-simulate-capture.md#simulatecapturedemosaicrecord) | Type |
|
|
1201
1214
|
| [`SimulateCaptureDngPart`](api/facade-simulate-capture.md#simulatecapturedngpart) | Type |
|
|
1202
1215
|
| [`SimulateCaptureExposureMode`](api/facade-simulate-capture.md#simulatecaptureexposuremode) | Type |
|
|
1216
|
+
| [`SimulateCaptureFastOption`](api/facade-simulate-capture.md#simulatecapturefastoption) | Type |
|
|
1217
|
+
| [`SimulateCaptureFastReport`](api/facade-simulate-capture.md#simulatecapturefastreport) | Type |
|
|
1203
1218
|
| [`SimulateCaptureLensDistortion`](api/facade-simulate-capture.md#simulatecapturelensdistortion) | Type |
|
|
1204
1219
|
| [`SimulateCaptureMotion`](api/facade-simulate-capture.md#simulatecapturemotion) | Type |
|
|
1205
1220
|
| [`SimulateCaptureOptions`](api/facade-simulate-capture.md#simulatecaptureoptions) | Type |
|
package/docs/QUICK_START.md
CHANGED
|
@@ -72,7 +72,7 @@ modelling choices (such as "no lens PSF") as `kind: "model"`.
|
|
|
72
72
|
| `lens.distortion` | none | `{ kind: "radial", profile }` or `{ kind: "brown-conrady", profile }`. |
|
|
73
73
|
| `lens.vignetting` | none | An `IlluminationVignettingProfile` (radial relative illumination). |
|
|
74
74
|
| `lens.psf` | none | A `{ kind: "sampled-local", configuration }` sampled lens PSF, passed to the environment contract unchanged. |
|
|
75
|
-
| `lens.diffraction` | off | 2.1: `"circular-aperture"` or `{
|
|
75
|
+
| `lens.diffraction` | off | 2.1: `"circular-aperture"` or `{ kind: "circular-aperture", kernelRadiusSamples, fast }`: diffraction blur of an ideal lens at the resolved f-number (see [Optics](#optics)). `aperture` is accepted as a deprecated alias of `kind` until 3.0.0. |
|
|
76
76
|
| `exposure.mode` | `"manual"` | Also `"aperture-priority"`, `"shutter-priority"`, `"program"`. |
|
|
77
77
|
| `exposure.iso` | 100 | Selects the body's ISO readout regime (gain and read noise). |
|
|
78
78
|
| `exposure.shutterSeconds` | 1/125 | Used in `manual` and `shutter-priority`. |
|
|
@@ -91,7 +91,7 @@ modelling choices (such as "no lens PSF") as `kind: "model"`.
|
|
|
91
91
|
| `output.gamutMapping` | `"clip"` | PNG only: or `"perceptual"`. |
|
|
92
92
|
| `output.dng.capturedAtUtc` | none | DNG only: capture time for the date tags. |
|
|
93
93
|
| `output.metadata` | none | 2.4: `{ description?, software?, copyright?, comment? }` written into JPEG, PNG and DNG files unchanged (see [Text metadata](#text-metadata-24)). |
|
|
94
|
-
| `output.demosaic` | the 1.0 bilinear kernels | `"bilinear"` or, from 2.1, `"ahd"` (see [Demosaic](#demosaic))
|
|
94
|
+
| `output.demosaic` | the 1.0 bilinear kernels | `"bilinear"` or, from 2.1, `"ahd"` (see [Demosaic](#demosaic)); or the record `{ kind, fast }`. |
|
|
95
95
|
| `output.borderHandling` | `"margin"` | Or `"mirror"`. |
|
|
96
96
|
| `output.toneCurve` | `"identity"` | Any `SdrToneCurve`, for example `"positive-reinhard-per-channel"`. |
|
|
97
97
|
| `output.toneCurveParameters` | none | Required by the luminance curves (`extended-reinhard-luminance`, `naka-rushton-luminance`); the facade invents no curve parameters. |
|
|
@@ -102,8 +102,9 @@ modelling choices (such as "no lens PSF") as `kind: "model"`.
|
|
|
102
102
|
| `sensor.spectralStepNanometers` | 20 | Spectral quadrature over 380–780 nm. |
|
|
103
103
|
| `sensor.temporalSampleCount` | 1, or 8 when the camera rotates | Midpoints across each site's exposure window. |
|
|
104
104
|
| `sensor.noiseSeed` | 1 | Output is deterministic for a given seed. |
|
|
105
|
-
| `sensor.antiAliasing` | off | 2.1: an optical low-pass (anti-aliasing) filter: `{ kind: "four-spot", separationSites? }`, `{ kind: "two-spot", axis, separationSites? }` or `{ kind: "point-splitting", components }` (see [Anti-aliasing filter](#anti-aliasing-filter)). |
|
|
106
|
-
| `sensor.pixelAperture` | `"point"` | 2.3: `"box"` or `{ kind: "box", samplesPerAxis }` integrates each square photosite (see [Pixel aperture](#pixel-aperture-23)). |
|
|
105
|
+
| `sensor.antiAliasing` | off | 2.1: an optical low-pass (anti-aliasing) filter: `{ kind: "four-spot", separationSites? }`, `{ kind: "two-spot", axis, separationSites? }` or `{ kind: "point-splitting", components }` (see [Anti-aliasing filter](#anti-aliasing-filter)). Each record also takes `fast`. |
|
|
106
|
+
| `sensor.pixelAperture` | `"point"` | 2.3: `"box"` or `{ kind: "box", samplesPerAxis, fast }` integrates each square photosite (see [Pixel aperture](#pixel-aperture-23)). |
|
|
107
|
+
| `fast` | `false` | Exact or fast for every option in `SIMULATE_CAPTURE_FAST_OPTIONS`; an option's record `fast` overrides it. No option has a fast method yet, so results are exact; `diagnostics.fast` reports what was requested and what ran (see [Exact and fast modes](https://github.com/Photivra/photivra/blob/main/docs/API_STYLE.md#exact-and-fast-modes)). |
|
|
107
108
|
| `motion.angularVelocityRadPerSec` | still | `{ pitch?, yaw?, roll? }` in rad/s (see [Motion](#motion)). |
|
|
108
109
|
| `motion.shutter` | `"global"` | Or `"rolling"`. |
|
|
109
110
|
| `motion.rollingShutterSkewSeconds` | the body's readout skew | Rolling only. |
|
|
@@ -1293,9 +1294,14 @@ Validated against real full-resolution captures resized in linear light: three s
|
|
|
1293
1294
|
100 MP medium format), five charts, f/2.8–f/16, ISO 100–6400, 96–800 display pixels wide, Speed and Quality options (see
|
|
1294
1295
|
[Validation results](https://github.com/Photivra/photivra/blob/main/docs/DISPLAY_VIEW.md#validation-results)).
|
|
1295
1296
|
|
|
1296
|
-
**Cost.**
|
|
1297
|
-
|
|
1298
|
-
|
|
1297
|
+
**Cost.** Where a display pixel covers more than 25 real pixels, the cost follows the detailed display pixels ×
|
|
1298
|
+
`samplesPerAxis`², not the real pixel count; at 25 or fewer (the exact area mean) it follows the real pixels the region
|
|
1299
|
+
touches. A device-pixel view of a 24 MP frame, 2028 × 1352 in 96 × 96 parts from one prepared view, takes about 0.09 s
|
|
1300
|
+
per part with the engine defaults and about 0.18 s with the Quality options (2.9.0, Node 24.21.0, one thread on a
|
|
1301
|
+
4-vCPU 2.80 GHz Xeon; [the table](https://github.com/Photivra/photivra/blob/main/docs/DISPLAY_VIEW.md#a-device-pixel-view-rendered-in-parts),
|
|
1302
|
+
`node scripts/benchmark-display-view.mjs --app`). The table below is the 2.6.0 record of whole views against the
|
|
1303
|
+
whole-frame view of the same request (Siemens star, f/8, ISO 100, one run, same host; every row, and the times before
|
|
1304
|
+
the exact speed-ups, in [DISPLAY_VIEW.md](https://github.com/Photivra/photivra/blob/main/docs/DISPLAY_VIEW.md#cost)):
|
|
1299
1305
|
|
|
1300
1306
|
| Sensor | Options | 96 wide | 384 wide | 800 wide |
|
|
1301
1307
|
| --- | --- | --- | --- | --- |
|
|
@@ -1321,7 +1327,11 @@ view allocates nothing at full resolution).
|
|
|
1321
1327
|
|
|
1322
1328
|
**Many regions of one view (2.7).** Each `simulateDisplayView` call repeats the request's setup: the camera, lens,
|
|
1323
1329
|
scene and illuminant, the channel responses, the diffraction kernels and the colour tables. That is about 0.25 s with
|
|
1324
|
-
the engine defaults and 0.7 s with the Quality options on a 24 MP request
|
|
1330
|
+
the engine defaults and 0.7 s with the Quality options on a 24 MP request (measured before #443). The channel responses
|
|
1331
|
+
do not depend on the scene and are kept across calls, so a call after a chart, illuminant or illuminance change costs
|
|
1332
|
+
less than one after an aperture or shutter change: with the Quality options, about 30–50 ms after a chart, illuminant or
|
|
1333
|
+
illuminance change and about 55–70 ms after an aperture or shutter change, against about 0.4 s for each before #443
|
|
1334
|
+
(Node 24.21.0, one thread, prepares in one process after a warm-up). To render one view in many regions, prepare
|
|
1325
1335
|
the request once and render each region from it; each region then costs only its own pixels:
|
|
1326
1336
|
|
|
1327
1337
|
```ts
|
package/docs/USAGE.md
CHANGED
|
@@ -7516,6 +7516,36 @@ const view = await simulateDisplayView({ scene: { preset: "slanted-edge" }, sens
|
|
|
7516
7516
|
console.log(view.kind, view.view.scaleX, view.assumptions.find((a) => a.id === "view.definition")?.value);
|
|
7517
7517
|
```
|
|
7518
7518
|
|
|
7519
|
+
#### Sharing AHD correction states between workers
|
|
7520
|
+
|
|
7521
|
+
With `output.demosaic: "ahd"`, low-signal display pixels read correction states that each realm (a page, a Web Worker)
|
|
7522
|
+
computes and keeps for itself. Two workers can split a part's states and exchange them instead of both computing all
|
|
7523
|
+
of them; the renders have the same bytes either way (see "AHD at low signal" in
|
|
7524
|
+
[DISPLAY_VIEW.md](https://github.com/Photivra/photivra/blob/main/docs/DISPLAY_VIEW.md#ahd-at-low-signal)). Import only
|
|
7525
|
+
states whose key a prepared view reported. The two handles below run in one script for the example; in an app each
|
|
7526
|
+
runs in its own worker, and the arrays travel with `postMessage(set, [set.gridKeys.buffer, set.values.buffer])`.
|
|
7527
|
+
|
|
7528
|
+
```ts
|
|
7529
|
+
import { serializeDisplayViewCorrectionStates, bindDisplayViewCorrectionStates, prepareDisplayView, type SimulateCaptureOptions } from "@photivra/engine";
|
|
7530
|
+
|
|
7531
|
+
const request: SimulateCaptureOptions = { scene: { preset: "uniform", reflectance: 0.18 }, exposure: { iso: 1600, shutterSeconds: 1 / 2000 },
|
|
7532
|
+
sensor: { pixelPitchMicrometers: 1.4 }, output: { width: 200, height: 150, demosaic: "ahd" } };
|
|
7533
|
+
const part = { width: 20, height: 15, region: { x: 0, y: 0, width: 10, height: 8 } };
|
|
7534
|
+
// Each worker prepares the same request; the key says which states it reads.
|
|
7535
|
+
const workerA = await prepareDisplayView(request), workerB = await prepareDisplayView(request);
|
|
7536
|
+
console.log(workerA.correctionKey() === workerB.correctionKey());
|
|
7537
|
+
// Worker A finds the states the part needs (no image, no state computed) and gives half to each worker.
|
|
7538
|
+
const { gridKeys } = await workerA.collectCorrectionStates(part);
|
|
7539
|
+
const half = Math.ceil(gridKeys.length / 2);
|
|
7540
|
+
const fromA = await workerA.computeCorrectionStates(gridKeys.slice(0, half));
|
|
7541
|
+
const fromB = await workerB.computeCorrectionStates(gridKeys.slice(half));
|
|
7542
|
+
// Each worker imports the other's share (in one realm, as here, the second import adds nothing new).
|
|
7543
|
+
console.log(bindDisplayViewCorrectionStates([fromB]), bindDisplayViewCorrectionStates([fromA]));
|
|
7544
|
+
// Either worker now renders the part without computing a state; a new worker can start from an export.
|
|
7545
|
+
const view = await workerA.render(part);
|
|
7546
|
+
console.log(view.diagnostics.ahdCorrectedPixelCount, serializeDisplayViewCorrectionStates().map((set) => set.gridKeys.length));
|
|
7547
|
+
```
|
|
7548
|
+
|
|
7519
7549
|
### Facade 2.0 options: output, demosaic, optics and motion
|
|
7520
7550
|
|
|
7521
7551
|
Each 2.0 option is opt-in and uses an existing public contract. Without them, the facade's output is
|
package/docs/api/core-version.md
CHANGED
|
@@ -11,5 +11,5 @@ version they were made with. Proof-of-concept (POC), schema and model contracts
|
|
|
11
11
|
own versions. Release checks confirm it matches package.json and the packed package.
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
ENGINE_API_VERSION = "2.
|
|
14
|
+
ENGINE_API_VERSION = "2.10.0" as const
|
|
15
15
|
```
|
package/docs/api/exports.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"packageVersion": "2.
|
|
3
|
-
"engineApiVersion": "2.
|
|
2
|
+
"packageVersion": "2.10.0",
|
|
3
|
+
"engineApiVersion": "2.10.0",
|
|
4
4
|
"exports": [
|
|
5
5
|
{
|
|
6
6
|
"name": "AbsoluteUncertaintyEstimate",
|
|
@@ -212,6 +212,11 @@
|
|
|
212
212
|
"source": "src/processing/denoise.ts",
|
|
213
213
|
"kind": "type"
|
|
214
214
|
},
|
|
215
|
+
{
|
|
216
|
+
"name": "bindDisplayViewCorrectionStates",
|
|
217
|
+
"source": "src/facade/display-view.ts",
|
|
218
|
+
"kind": "runtime"
|
|
219
|
+
},
|
|
215
220
|
{
|
|
216
221
|
"name": "bindIsoCapabilityToExposureCapabilities",
|
|
217
222
|
"source": "src/equipment/iso-capabilities.ts",
|
|
@@ -2602,6 +2607,16 @@
|
|
|
2602
2607
|
"source": "src/core/spectral-composition.ts",
|
|
2603
2608
|
"kind": "type"
|
|
2604
2609
|
},
|
|
2610
|
+
{
|
|
2611
|
+
"name": "DisplayViewCorrectionStateKeys",
|
|
2612
|
+
"source": "src/facade/display-view.ts",
|
|
2613
|
+
"kind": "type"
|
|
2614
|
+
},
|
|
2615
|
+
{
|
|
2616
|
+
"name": "DisplayViewCorrectionStateSet",
|
|
2617
|
+
"source": "src/facade/display-view.ts",
|
|
2618
|
+
"kind": "type"
|
|
2619
|
+
},
|
|
2605
2620
|
{
|
|
2606
2621
|
"name": "DisplayViewResult",
|
|
2607
2622
|
"source": "src/facade/simulate-capture.ts",
|
|
@@ -7867,6 +7882,11 @@
|
|
|
7867
7882
|
"source": "src/sensor/dark-current.ts",
|
|
7868
7883
|
"kind": "type"
|
|
7869
7884
|
},
|
|
7885
|
+
{
|
|
7886
|
+
"name": "serializeDisplayViewCorrectionStates",
|
|
7887
|
+
"source": "src/facade/display-view.ts",
|
|
7888
|
+
"kind": "runtime"
|
|
7889
|
+
},
|
|
7870
7890
|
{
|
|
7871
7891
|
"name": "serializeNativeRawDng",
|
|
7872
7892
|
"source": "src/capture/native-raw-dng.ts",
|
|
@@ -7972,6 +7992,11 @@
|
|
|
7972
7992
|
"source": "src/facade/simulate-capture.ts",
|
|
7973
7993
|
"kind": "runtime"
|
|
7974
7994
|
},
|
|
7995
|
+
{
|
|
7996
|
+
"name": "SIMULATE_CAPTURE_FAST_OPTIONS",
|
|
7997
|
+
"source": "src/facade/simulate-capture.ts",
|
|
7998
|
+
"kind": "runtime"
|
|
7999
|
+
},
|
|
7975
8000
|
{
|
|
7976
8001
|
"name": "SIMULATE_DISPLAY_VIEW_DEFAULT_SAMPLES_PER_AXIS",
|
|
7977
8002
|
"source": "src/facade/simulate-capture.ts",
|
|
@@ -8007,6 +8032,11 @@
|
|
|
8007
8032
|
"source": "src/facade/simulate-capture.ts",
|
|
8008
8033
|
"kind": "type"
|
|
8009
8034
|
},
|
|
8035
|
+
{
|
|
8036
|
+
"name": "SimulateCaptureDemosaicRecord",
|
|
8037
|
+
"source": "src/facade/simulate-capture.ts",
|
|
8038
|
+
"kind": "type"
|
|
8039
|
+
},
|
|
8010
8040
|
{
|
|
8011
8041
|
"name": "SimulateCaptureDngPart",
|
|
8012
8042
|
"source": "src/facade/simulate-capture.ts",
|
|
@@ -8017,6 +8047,16 @@
|
|
|
8017
8047
|
"source": "src/facade/simulate-capture.ts",
|
|
8018
8048
|
"kind": "type"
|
|
8019
8049
|
},
|
|
8050
|
+
{
|
|
8051
|
+
"name": "SimulateCaptureFastOption",
|
|
8052
|
+
"source": "src/facade/simulate-capture.ts",
|
|
8053
|
+
"kind": "type"
|
|
8054
|
+
},
|
|
8055
|
+
{
|
|
8056
|
+
"name": "SimulateCaptureFastReport",
|
|
8057
|
+
"source": "src/facade/simulate-capture.ts",
|
|
8058
|
+
"kind": "type"
|
|
8059
|
+
},
|
|
8020
8060
|
{
|
|
8021
8061
|
"name": "SimulateCaptureLensDistortion",
|
|
8022
8062
|
"source": "src/facade/simulate-capture.ts",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# facade/display-view.ts public contracts
|
|
2
|
+
|
|
3
|
+
The package and root API versions are recorded once in [Navigation](../API_REFERENCE.md) · [Developer guide](https://github.com/Photivra/photivra/blob/main/docs/DEVELOPERS.md). Generated signatures retain independent schema/model versions. Only the exports listed here are root-package contracts; module-local helpers are not supported deep imports.
|
|
4
|
+
|
|
5
|
+
## bindDisplayViewCorrectionStates
|
|
6
|
+
|
|
7
|
+
2.10 (#447): adds states another realm computed (an export, or `computeCorrectionStates` results) to this realm's cache and
|
|
8
|
+
returns the number of states added. For each entry, the grid keys its setup does not hold yet are appended; known ones are
|
|
9
|
+
left as they are (a state's values follow from its key, so they are equal). Every entry is checked before the cache is
|
|
10
|
+
touched: `key` a non-empty string, `gridKeys` an Int32Array of grid keys, `values` a Float64Array of 3 × `gridKeys.length`
|
|
11
|
+
finite numbers; otherwise it fails with an InvalidConfigurationError and the cache is unchanged. The cache's bounds apply as
|
|
12
|
+
in a render: an unknown key creates a setup and can evict the least recently used of the four kept, and a setup that
|
|
13
|
+
reaches 65 536 states is cleared before the next one is added. Import only keys a prepared view reported
|
|
14
|
+
(`correctionKey()`), so states a render here will read.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
export function bindDisplayViewCorrectionStates(entries: readonly DisplayViewCorrectionStateSet[]): number;
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This call is synchronous; any supplied provider must follow its explicit synchronous contract.
|
|
21
|
+
|
|
22
|
+
## DisplayViewCorrectionStateKeys
|
|
23
|
+
|
|
24
|
+
2.10 (#447): the grid keys of the states a region needs (`PreparedDisplayView.collectCorrectionStates`), ascending.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
export interface DisplayViewCorrectionStateKeys { key: string; gridKeys: Int32Array }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## DisplayViewCorrectionStateSet
|
|
31
|
+
|
|
32
|
+
2.10 (#447): the AHD low-signal correction states of one setup, as a realm sends them to another. `key` is the setup's
|
|
33
|
+
correction key (`PreparedDisplayView.correctionKey()`), `gridKeys[i]` a state's grid key and `values[3·i …]` its three
|
|
34
|
+
values (28 bytes per state). Both arrays are transferable.
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
export interface DisplayViewCorrectionStateSet { key: string; gridKeys: Int32Array; values: Float64Array }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## serializeDisplayViewCorrectionStates
|
|
41
|
+
|
|
42
|
+
2.10 (#447): the AHD low-signal correction states this JavaScript realm holds (a Web Worker, a page), one entry per cached
|
|
43
|
+
setup, least recently used first, each state's grid key and three values copied out. Another realm adds them with
|
|
44
|
+
{@link bindDisplayViewCorrectionStates}; a render there then reads them instead of computing them, with the same bytes.
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
export function serializeDisplayViewCorrectionStates(): DisplayViewCorrectionStateSet[];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This call is synchronous; any supplied provider must follow its explicit synchronous contract.
|