Skip to content

torchsky.map.operators.continuous_response

Experimental surface

These APIs are under active development. Names, defaults, and result objects may change between minor releases; pin a version if you depend on them in production.

Source-quadrature transport into native, already integrated detector pixels.

Guides: likelihoods, psf-conventions


This reference is generated from the package source. Names are grouped by the module that defines them; import every name from the public namespace torchsky.map.operators.continuous_response unless the group text says otherwise.

Top-level namespace

NativeSpectralPixelResponse

<class 'torchsky.map.operators.continuous_response.NativeSpectralPixelResponse'>

Source-quadrature transport into native, already integrated detector pixels.

This is a finite linear quadrature operator, not a continuous-field precision certificate. Spatial/spectral quadrature accuracy, coordinate transforms and response calibration belong to the caller. No source raster or delta image is constructed. Responses may vary with source position and wavelength.

AchromaticPixelResponse dataclass

AchromaticPixelResponse(response: PixelIntegratedResponse)

Adapt an offset-only unit-square PixelIntegratedResponse.

Both position tensors must be in detector-pixel coordinates. Wavelength does not affect this reference response; no further pixel integral is applied. Arbitrary footprints require a different callable.

response instance-attribute

__call__

__call__(
    detector_xy: Tensor,
    source_xy: Tensor,
    wavelength_angstrom: Tensor,
    *,
    detector_footprint: Tensor | None,
) -> Tensor

NativeQuadratureResponseOp dataclass

NativeQuadratureResponseOp(
    response: NativeSpectralPixelResponse,
    source_xy: Tensor,
    detector_xy: Tensor,
    wavelength_angstrom: Tensor,
    source_measure: Tensor,
    wavelength_measure: Tensor,
    source_spectral_weight: Tensor | None = None,
    detector_footprint: Tensor | None = None,
    mask: Tensor | None = None,
    interaction_pairs: Tensor | None = None,
    interaction_support: str | None = None,
    source_chunk_size: int = 128,
    detector_chunk_size: int = 128,
    wavelength_chunk_size: int = 16,
    pair_chunk_size: int = 1024,
)

Transport sampled source measures into native detector intensities.

Forward accepts arbitrary prefix axes followed by [N,L] and returns the same prefix followed by [P]. Its discrete matrix is A[p,n,l] = R[p,n,l] * source_measure[n] * wavelength_measure[l] * source_spectral_weight[n,l]. The optional last factor defaults to one and accepts [L] or [N,L]. It weights each source spectrum before transport; it never mixes rendered output bands. Separate operators represent bands.

source_measure is explicit: use ones for point-source spectral flux density, or source-node solid-angle quadrature weights (sr) for spectral radiance per sr. These are source areas, never detector-pixel areas. Use wavelength_measure in Angstrom for densities per Angstrom, or ones for already bin-integrated spectral flux. The response already includes the detector footprint integral exactly once. Output units are input units times these two measures and the response's calibration units. Electron conversion (area, duration, QE) must be declared by the caller; no implicit conversion from energy density or photon density is made.

Source and detector positions, measures and response are fixed when taking the Euclidean adjoint. They and response parameters retain their gradients when differentiating forward/adjoint. mask=True keeps detector rows; removed rows are zero without renormalizing retained flux or PSF tails.

interaction_pairs[E,2] optionally gives detector/source index pairs. Response evaluation costs O(E*L), with edge and wavelength chunk limits. Every forward/adjoint call also validates tensor values and graph bounds and checks graph uniqueness with torch.unique; this validation is not restricted to the response chunk limits or a one-time construction cost. The required interaction_support string declares why omitted edges are zero in the represented response (e.g. exact compact support, or a calibrated core whose wings are transported separately). The declaration is provenance, not a support proof. Never truncate an infinite-tail response implicitly. Duplicate pairs are rejected. The graph can represent radiance mesh nodes and does not require a source catalogue.

Without a graph all pairs are evaluated: time is O(PNL), a bounded reference/fallback rather than a survey-scale algorithm. Three chunk limits bound each evaluated response block, avoiding a dense global matrix. Autograd may retain block graphs; this is not a bounded training memory claim. Quadrature refinement and support verification remain the caller's responsibility. This operator does not certify wavefront fidelity.

detector_chunk_size class-attribute instance-attribute

detector_chunk_size: int = 128

detector_footprint class-attribute instance-attribute

detector_footprint: Tensor | None = None

detector_xy instance-attribute

detector_xy: Tensor

interaction_pairs class-attribute instance-attribute

interaction_pairs: Tensor | None = None

interaction_support class-attribute instance-attribute

interaction_support: str | None = None

mask class-attribute instance-attribute

mask: Tensor | None = None

pair_chunk_size class-attribute instance-attribute

pair_chunk_size: int = 1024

response instance-attribute

source_chunk_size class-attribute instance-attribute

source_chunk_size: int = 128

source_measure instance-attribute

source_measure: Tensor

source_spectral_weight class-attribute instance-attribute

source_spectral_weight: Tensor | None = None

source_xy instance-attribute

source_xy: Tensor

wavelength_angstrom instance-attribute

wavelength_angstrom: Tensor

wavelength_chunk_size class-attribute instance-attribute

wavelength_chunk_size: int = 16

wavelength_measure instance-attribute

wavelength_measure: Tensor

__post_init__

__post_init__() -> None

_block

_block(
    pixels: slice, sources: slice, waves: slice
) -> Tensor

_pair_block

_pair_block(pairs: Tensor, waves: slice) -> Tensor

_validate

_validate() -> None

adjoint

adjoint(detector_values: Tensor) -> Tensor

Apply the exact discrete transpose to detector_values[...,P].

Nonfinite masked values are allowed and replaced with zero before the multiplication. This is the Euclidean transpose of the stated finite quadrature matrix, not an inverse or a continuous-density adjoint.

forward

forward(intensity: Tensor) -> Tensor

Apply the quadrature matrix to intensity[...,N,L].