solprop.backends.numba_cpu.spatial#
Execute separable spatial coefficients and bounded Cartesian column transfers.
Functions
|
Apply spatial and temporal rates without a broadcast-sized allocation. |
|
Accumulate a complete Cartesian stage into solution and embedded error. |
|
Return one transformed physical chunk to its coarse spectral scratch. |
|
Stage two of the far-field pass: sum the bands serially, in ascending order. |
|
Apply the separable prefactor and interaction factor directly to a stage. |
|
Return a spectrum's axial-flux energy and, when asked, its closure (SEP 34). |
|
Compile stage one of the far-field pass: every band's partial sums. |
|
Compile the per-column pass of the plane measure: energy and the closure. |
|
Compile spatial passes with independent stage and copy scheduling. |
|
Pad one physical-space chunk for an unnormalised temporal inverse. |
|
Rotate a fixed noise realization into a persistent stage buffer. |
|
Evaluate the exponent |
|
Evaluate the unitary noise phase without a coefficient volume. |
|
Evaluate both propagation signs without constructing a coefficient table. |
Classes
|
Form the far-field statistics and the on-axis amplitude in one banded pass. |
|
Group the independently specialised Cartesian stage operations. |
- class solprop.backends.numba_cpu.spatial.FarFieldPass(problem, *, parallel)[source]#
Bases:
objectForm 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 aprangewhen parallel; stage two (far_field_sum()) adds the bands in ascending order; a finishing step on the host appliesepsilon_0 c/2, the spectral-density factor, the energy weights ofabsorbed_powerand the pairingRe(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.
- class solprop.backends.numba_cpu.spatial.SpatialKernels(write_propagator, write_exponent, finish_material, accumulate_stage, pack_columns, crop_columns)[source]#
Bases:
NamedTupleGroup 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.
- 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’senergyand 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 distancethatwrite_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.