solprop.backends.numba_cpu.dispersive_spatial#

SEP 6’s frequency-dependent electronic response on the Cartesian and planar routes.

The fused node path’s workspace (solprop.backends.numba_cpu.dispersive) moves the response’s spectral multipliers onto the modal columns of a whole stage. On the Cartesian free-space and line routes the columns are the nodes, and on the hybrid planar route a block of (p, y) rows goes to time together and its (x, y) nodes are synthesised from them by a real matrix in x that does not depend on frequency. Either way each chunk of columns – a node chunk, or a block of rows – is transformed to time and back on its own, so the response runs per chunk, with the same five steps:

  1. the input multipliers act on the chunk’s padded spectrum, which the stage packed for its own inverse transform, and one batched inverse transform gives every filtered field of the chunk (none of the node field: the stage’s own transform gives it);

  2. on the planar route the filtered fields are synthesised at the block’s nodes by the slab rule, as the bare field is; the products are formed at the nodes in the leaf’s sector, and on the planar route projected back to the block’s rows;

  3. the collar multiplies the products in time, G[w (G E)^3];

  4. one batched forward transform takes them to frequency;

  5. after the stage’s forward transform of the chunk’s polarisation – which a lone response with buffers of its own replaces – their output multipliers and the channels’ eps0 gamma0 rho land them in the chunk’s polarisation spectrum, which the stage crops back to its coarse columns.

A lone symmetric response – of one species, or of a mixture under its mixture filter – whose product has the polarisation’s dtype holds no buffer of its own: it filters the chunk’s spectrum in place (on the planar route only when no in-stage absorber reads the bare rows afterwards), its product is the stage’s polarisation, and g finishes it in the stage’s spectrum. The polynomial groups species of equal leg bound as on the fused path (DispersiveTerms).

Neither route has an embedded quadrature rule, so there is nothing to finish when a step is accepted.

Classes

SpatialDispersive(problem, plans, layout, *, ...)

Preallocate the response's buffers and plans, and run it chunk by chunk.

SpatialLayout(*, rows, node_rows, ...)

How the backend runs a Cartesian or planar stage, as the response needs it.

class solprop.backends.numba_cpu.dispersive_spatial.SpatialDispersive(problem, plans, layout, *, flag, fftw_threads)[source]#

Bases: object

Preallocate the response’s buffers and plans, and run it chunk by chunk.

Per chunk the backend calls prepare() on the packed spectrum before its own inverse transform, respond() with the chunk’s bare field in time (and, on the planar route, the slab synthesis and projection), finish() before its forward transform – which it skips when replaces_transform – and combine() after. begin() weighs the channels once per stage.

Parameters:
problemsolprop.translate.problem.KernelProblem

The problem, carrying responses.dispersive_kerr on a Cartesian or planar transform.

planssolprop.backends.numba_cpu.fft.TransformPlans

The backend’s per-chunk plans, whose packed spectrum, field, polarisation and polarisation spectrum the response reads, borrows or adds into.

layoutSpatialLayout

How the backend runs the route.

flagstr

The FFTW planning flag, a key of solprop.backends.numba_cpu.fft.PLAN_FLAGS.

fftw_threadsint or None

The FFTW pool override; None sizes each batched plan by the backend’s rule.

begin(bundle)[source]#

Weigh the channels at the stage, once for all its chunks.

Parameters:
bundlesolprop.translate.stage.StageScalars

The stage’s scalars, whose channel densities weight the terms and build a symmetric mixture’s filter.

combine()[source]#

Land the products’ weighted spectra in the chunk’s polarisation spectrum.

finish()[source]#

Apply the collar to the chunk’s products and transform them.

Before the stage’s forward transform: a borrowed product is the stage’s own polarisation buffer, which that transform takes.

memory_ledger()[source]#

Return the bytes of every buffer the response owns, by name.

Returns:
dict

Every row of DISPERSIVE_LEDGER_ROWS of solprop.backends.numba_cpu.dispersive.

prepare(spectrum)[source]#

Filter the chunk’s packed spectrum and transform every filtered field.

Called after the stage has packed the chunk and before its inverse transform, which destroys the spectrum. In place, the stage’s transform gives the filtered field.

Parameters:
spectrumnumpy.ndarray

The packed spectrum (doubled positive bins on the analytic family).

property replaces_transform: bool[source]#

Return whether the response writes the chunk’s polarisation spectrum itself.

Returns:
bool

True when the response is alone with products of its own, so that the stage skips its forward transform of an unused polarisation buffer.

respond(bare, count=0)[source]#

Form the chunk’s products, at its nodes, onto its rows.

Parameters:
barenumpy.ndarray

The bare field at the chunk’s nodes: the stage’s own field of the chunk in free space, (rows, n_to); the backend’s synthesised node buffer on the planar route. Read, and overwritten only by the lone symmetric response, whose filtered field it holds.

countint, optional

The planar block’s y rows, which a partial last block has fewer of; zero in free space, where the transforms take whole chunks.

class solprop.backends.numba_cpu.dispersive_spatial.SpatialLayout(*, rows, node_rows, n_pol_node, block, slab, alone, bare_time_free, parallel)[source]#

Bases: object

How the backend runs a Cartesian or planar stage, as the response needs it.

Parameters:
rowsint

Rows one temporal transform of the stage takes: a node chunk’s columns in free space, a block’s (p, y) rows on the planar route.

node_rowsint

Rows of the backend’s node buffer for one chunk: the columns again in free space, the block’s (x, y) nodes times their components on the planar route.

n_pol_nodeint

Components at one node.

blockint

The planar route’s y rows per full block, of which rows and node_rows are multiples; one in free space.

slabbool

Whether the route is the hybrid planar one, whose nodes are synthesised from the rows.

alonebool

Whether the dispersive response is the only one.

bare_time_freebool

Whether nothing reads the chunk’s bare field in time after the response, so that a lone symmetric response may filter the chunk’s spectrum in place.

parallelbool

Whether the node loops are prange.