solprop.backends.numba_cpu.spatial#

Execute separable spatial coefficients and bounded Cartesian column transfers.

Functions

absorber_columns(samples, rates, first, ...)

Apply spatial and temporal rates without a broadcast-sized allocation.

accumulate_stage(stage, weights, solution, error)

Accumulate a complete Cartesian stage into solution and embedded error.

crop_columns(fine, crop, target)

Return one transformed physical chunk to its coarse spectral scratch.

far_field_sum(partials, totals)

Stage two of the far-field pass: sum the bands serially, in ascending order.

finish_material(data, spectrum, window, ...)

Apply the separable prefactor and interaction factor directly to a stage.

flux_measure(plane, grid, weights, field, *, ...)

Return a spectrum's axial-flux energy and, when asked, its closure (SEP 34).

make_far_field(*, parallel)

Compile stage one of the far-field pass: every band's partial sums.

make_flux_columns(*, parallel)

Compile the per-column pass of the plane measure: energy and the closure.

make_kernels(*, parallel[, parallel_transfers])

Compile spatial passes with independent stage and copy scheduling.

pack_columns(source, crop, fine, scale, analytic)

Pad one physical-space chunk for an unnormalised temporal inverse.

rotate_noise(noise, phase, output)

Rotate a fixed noise realization into a persistent stage buffer.

write_exponent(data, distance, exponent)

Evaluate the exponent D distance that write_propagator() takes.

write_phase(data, z, phase)

Evaluate the unitary noise phase without a coefficient volume.

write_propagator(data, distance, forward, ...)

Evaluate both propagation signs without constructing a coefficient table.

Classes

FarFieldPass(problem, *, parallel)

Form the far-field statistics and the on-axis amplitude in one banded pass.

SpatialKernels(write_propagator, ...)

Group the independently specialised Cartesian stage operations.

class solprop.backends.numba_cpu.spatial.FarFieldPass(problem, *, parallel)[source]#

Bases: object

Form the far-field statistics and the on-axis amplitude in one banded pass.

SEP 23 section 6 on numba_cpu: stage one (make_far_field()) writes one row of partials per band of columns, in a prange when parallel; stage two (far_field_sum()) adds the bands in ascending order; a finishing step on the host applies epsilon_0 c/2, the spectral-density factor, the energy weights of absorbed_power and the pairing Re(A conj(G)) of each on-axis amplitude with its magnetic closure (SEP 34). The partials are sized from the problem’s own request at construction (solprop.backends.spatial.far_field_partials()) and reused by every call, the periodic channel’s included; a call that needs more slots than were sized for (a spec handed to the run loop with other tables) uses buffers of its own.

Parameters:
problemsolprop.translate.problem.KernelProblem

A Cartesian or line problem, whose separable operator and columns the pass reads.

parallelbool

Whether stage one runs its bands in a prange.

Raises:
BackendError

If the problem is not a Cartesian or line problem with a separable operator that is its own plane measure.

property nbytes: int[source]#

Return the bytes of the partials and their band sum held for the run.

Returns:
int

The statistics_partials row of the memory ledger.

class solprop.backends.numba_cpu.spatial.SpatialKernels(write_propagator, write_exponent, finish_material, accumulate_stage, pack_columns, crop_columns)[source]#

Bases: NamedTuple

Group the independently specialised Cartesian stage operations.

Attributes:
write_propagator, write_exponent, finish_material, accumulate_stagecallable

Wide stage traversals, serial or parallel across independent columns.

pack_columns, crop_columnscallable

Temporal-buffer transfers, with their own parallelism choice.

accumulate_stage: Any#

Alias for field number 3

crop_columns: Any#

Alias for field number 5

finish_material: Any#

Alias for field number 2

pack_columns: Any#

Alias for field number 4

write_exponent: Any#

Alias for field number 1

write_propagator: Any#

Alias for field number 0

solprop.backends.numba_cpu.spatial.absorber_columns(samples, rates, first, n_pol, output)[source]#

Apply spatial and temporal rates without a broadcast-sized allocation.

Parameters:
samplesnumpy.ndarray

Physical time samples, real for a field grid.

ratestuple of numpy.ndarray

Spatial and temporal power rates in m^-1.

firstint

First physical node of this chunk.

n_polint

State polarisation count.

outputnumpy.ndarray

Planned forward-FFT input, overwritten for the active chunk.

solprop.backends.numba_cpu.spatial.accumulate_stage(stage, weights, solution, error)#

Accumulate a complete Cartesian stage into solution and embedded error.

Parameters:
stagenumpy.ndarray

Complete interaction-picture derivative.

weightstuple of float

Solution and embedded-error tableau weights.

solution, errornumpy.ndarray

Persistent accumulators, updated in the existing stage order.

solprop.backends.numba_cpu.spatial.crop_columns(fine, crop, target)#

Return one transformed physical chunk to its coarse spectral scratch.

Parameters:
finenumpy.ndarray

Planned temporal forward output, complex128.

cropnumpy.ndarray

Coarse-to-fine frequency indices.

targetnumpy.ndarray

Coarse scratch rows, overwritten in place.

solprop.backends.numba_cpu.spatial.far_field_sum(partials, totals)[source]#

Stage two of the far-field pass: sum the bands serially, in ascending order.

Parameters:
partialsnumpy.ndarray

Stage one’s partials, shape (n_bands, n_slots, n_omega).

totalsnumpy.ndarray

Overwritten with their sum over bands, shape (n_slots, n_omega).

solprop.backends.numba_cpu.spatial.finish_material(data, spectrum, window, inverse, stage)#

Apply the separable prefactor and interaction factor directly to a stage.

Parameters:
datatuple

Shared schema-5 arrays, evanescent rate, polarisation count and the schema-31 transverse rate per column.

spectrumnumpy.ndarray

Transverse and temporal transform of the nonlinear polarisation.

windownumpy.ndarray

Spectral taper, dimensionless.

inversenumpy.ndarray

Inverse interaction factor.

stagenumpy.ndarray

Stage derivative overwritten in place.

solprop.backends.numba_cpu.spatial.flux_measure(plane, grid, weights, field, *, closure, parallel)[source]#

Return a spectrum’s axial-flux energy and, when asked, its closure (SEP 34).

The compiled form of collect_spatial’s energy and closure.

Parameters:
planesolprop.translate.spatial.SeparableOperator

The plane’s coefficients (FluxPlan.at).

gridsolprop.grid.TimeGrid

The temporal grid.

weightsnumpy.ndarray

The geometry’s spectral weights.

fieldnumpy.ndarray

One internal spectrum.

closurebool

Whether to form the closure conj(eta) E.

parallelbool

Whether the columns run in a prange.

Returns:
tuple

The energy in J and the closure, or None.

solprop.backends.numba_cpu.spatial.make_far_field(*, parallel)[source]#

Compile stage one of the far-field pass: every band’s partial sums.

Parameters:
parallelbool

Whether the bands run in a prange. The bands, and the order of every sum inside one, are fixed by the shapes (far_field_bands()), so the partials do not depend on the thread count.

Returns:
callable

far_field_bands(field, edges, columns, apertures, regions, operator, layout, partials), documented on the compiled function.

solprop.backends.numba_cpu.spatial.make_flux_columns(*, parallel)[source]#

Compile the per-column pass of the plane measure: energy and the closure.

Parameters:
parallelbool

Whether the columns run in a prange; each column’s sum is formed by one thread in ascending frequency order, so the partials do not depend on the thread count.

Returns:
callable

flux_columns(field, squares, kappa, active, omega, weights, energy, closure, partials), documented on the compiled function.

solprop.backends.numba_cpu.spatial.make_kernels(*, parallel, parallel_transfers=False)[source]#

Compile spatial passes with independent stage and copy scheduling.

Parameters:
parallelbool

Whether wide stage operations run across independent columns.

parallel_transfersbool, optional

Whether temporal-buffer copies run across independent columns. Efficient contiguous field copies remain serial; large strided envelope copies benefit.

Returns:
SpatialKernels

Compiled operations with unchanged within-column arithmetic.

solprop.backends.numba_cpu.spatial.pack_columns(source, crop, fine, scale, analytic)#

Pad one physical-space chunk for an unnormalised temporal inverse.

Parameters:
sourcenumpy.ndarray

Coarse physical spectra, complex128.

cropnumpy.ndarray

Coarse-to-fine frequency indices.

finenumpy.ndarray

Planned temporal inverse input, overwritten including unused rows.

scalefloat

Explicit temporal inverse scaling.

analyticbool

Whether to double the bins strictly between the zero frequency and the fine grid’s Nyquist bin, the analytic-signal rule of scipy.signal.hilbert() on the fine grid and of the modal path’s _double_positive_bins.

solprop.backends.numba_cpu.spatial.rotate_noise(noise, phase, output)[source]#

Rotate a fixed noise realization into a persistent stage buffer.

Parameters:
noisenumpy.ndarray

Unadvanced complex noise spectrum.

phasenumpy.ndarray

Unitary phase in radians.

outputnumpy.ndarray

Advanced spectrum, overwritten in place; may own the phase view.

solprop.backends.numba_cpu.spatial.write_exponent(data, distance, exponent)#

Evaluate the exponent D distance that write_propagator() takes.

Parameters:
datatuple

As for write_propagator().

distancefloat

Propagation increment in m.

exponentnumpy.ndarray

Preallocated exponent, complex128, (n_columns, n_omega); overwritten.

solprop.backends.numba_cpu.spatial.write_phase(data, z, phase)[source]#

Evaluate the unitary noise phase without a coefficient volume.

Parameters:
datatuple

Shared spatial coefficients, evanescent rate, polarisation count and the schema-31 transverse rate per column.

zfloat

Absolute propagation position in m.

phasenumpy.ndarray

Real phase buffer, overwritten in radians.

solprop.backends.numba_cpu.spatial.write_propagator(data, distance, forward, inverse)#

Evaluate both propagation signs without constructing a coefficient table.

Parameters:
datatuple

Shared schema-5 arrays, evanescent rate, polarisation count and the schema-31 transverse rate per column.

distancefloat

Propagation increment in m.

forward, inversenumpy.ndarray

Preallocated propagation-factor arrays, complex128.