solprop.translate.modal_path#

Expand what a run reads of a moving guide’s sampled path, along z.

A moving guide is sampled in solprop.modes.path: a ModalPathTable of snapshots at each section’s Chebyshev-Lobatto points, in the provider’s own gauge. This module turns that path into what the seam carries. path_transform_tables() builds the flat ModalTransformTables record whose synthesis and projection maps are Chebyshev coefficients along z per section (section_coefficients()); a stage combines them with transform_weights() over the section transform_section() picks. path_connections() measures the moving-basis connection at every sampled position, and in_frequency() carries knot values onto a run’s frequency bins with the tables’ own cubic.

Functions

in_frequency(knots, values, omega, inside)

Return knot values interpolated onto a run's bins, zero outside the band.

path_connections(sampled, provider, *[, ...])

Measure the moving-basis connection at every sampled position of a path.

path_transform_tables(sampled, omega, *, ...)

Build the flat seam record of a moving guide, its maps expanded along z.

section_coefficients(values)

Return the Chebyshev coefficients along z of values sampled per section.

transform_section(tables, z)

Return the section of a record's maps a position lies in.

transform_weights(tables, z)

Return the weights that combine a record's moving maps at one position.

solprop.translate.modal_path.in_frequency(knots, values, omega, inside)[source]#

Return knot values interpolated onto a run’s bins, zero outside the band.

The same not-a-knot cubic in frequency the dense tables interpolate their fields with (solprop.modes.tables.DenseModalTable), so a connection and the maps it is propagated beside are carried onto the run’s grid alike.

Parameters:
knotsnumpy.ndarray

The knots in rad/s, increasing, shape (n_knots,).

valuesnumpy.ndarray

Values at the knots, knot axis first.

omeganumpy.ndarray

The run’s coarse bins in rad/s, shape (n_omega,).

insidenumpy.ndarray

Which bins lie inside the knots, bool, shape (n_omega,).

Returns:
numpy.ndarray

The values with the frequency axis last, zero outside inside.

solprop.translate.modal_path.path_connections(sampled, provider, *, sections=None, degenerate_blocks=(), basis=None, n_r=None, n_theta=None)[source]#

Measure the moving-basis connection at every sampled position of a path.

solprop.modes.connection.band_connection() at each position and every frequency knot, in the provider’s own gauge with the declared basis applied, which is the gauge the path’s snapshots are in (path_snapshot()). A position on a section’s end is measured one ulp inside it, so that its stencil is taken on that section’s own side of an edge: at a kink of the geometry the slope jumps and the connection with it, and the section that closes there must read its own one-sided limit (the rule of the coupled flow’s solprop.translate.coupled.flow_weights(), applied where it is sampled).

Parameters:
sampledsolprop.modes.path.ModalPathTable

The sampled path.

providersolprop.modes.vector.ModalProvider

The moving guide.

sectionsint or None, optional

How many of the path’s sections to measure, from the first; None measures them all.

degenerate_blockssequence of sequence of int, optional

The declared degenerate blocks.

basissolprop.modes.guide.ChannelBasis or None, optional

The declared constant unitary change of the channel coordinates.

n_r, n_thetaint or None, optional

The resolution each stencil position’s rule is asked for.

Returns:
tuple

Per position of the measured sections, section by section, one ModalConnection per frequency knot.

solprop.translate.modal_path.path_transform_tables(sampled, omega, *, z_end, profile_error, omega_fine=None, policy_id='dense-knots-cubic-frequency-chebyshev-z')[source]#

Build the flat seam record of a moving guide, its maps expanded along z.

The moving counterpart of solprop.translate.modal_tables.modal_transform_tables(). At every sampled position of every section the path covers up to z_end, the snapshot is evaluated on the run’s coarse grid exactly as a snapshot record’s is – S the stored electric profile, Q = W^-1 conj(e) w / 4 with that position’s area weights – and each section’s samples become Chebyshev coefficients along z (section_coefficients()), which is the (n_intervals, n_deg) layout the record’s maps have always had. The dense reference, its partners, the coordinate dual, the node positions and the weights are stored at the section edges, which are the record’s z_edges; the region index is the path’s one per node.

Outside the band the maps are explicitly zero, as a snapshot’s are.

Parameters:
sampledsolprop.modes.path.ModalPathTable

The sampled path.

omeganumpy.ndarray

Coarse angular frequencies in rad/s, shape (n_omega,), increasing.

z_endfloat

Where the run ends, m; the record keeps every section up to the one that contains it, so it covers the run and nothing is extrapolated.

profile_errorarray_like or float

Declared non-negative profile error per section and coarse frequency, or one value for all.

omega_finearray_like or None, optional

Fine angular frequencies in rad/s; None uses the coarse grid.

policy_idstr, optional

Identity of the numeric policy the record was built under.

Returns:
solprop.translate.modal_tables.ModalTransformTables

The record, with maps of n_intervals sections and degree + 1 coefficients each.

Raises:
solprop.exceptions.ModeError

If the path does not reach z_end, or the record does not validate.

solprop.translate.modal_path.section_coefficients(values)[source]#

Return the Chebyshev coefficients along z of values sampled per section.

Parameters:
valuesnumpy.ndarray

Samples at each section’s Chebyshev-Lobatto points, increasing, shape (n_intervals, degree + 1, *value_shape).

Returns:
numpy.ndarray

The coefficients numpy.polynomial.chebyshev.chebval() evaluates on x = (2 z - lo - hi)/(hi - lo), same shape.

Examples

>>> import numpy as np
>>> from solprop.translate.modal_path import section_coefficients
>>> section_coefficients(np.array([[[1.0 + 0j], [1.0 + 0j]]])).round(12).tolist()
[[[(1+0j)], [0j]]]
solprop.translate.modal_path.transform_section(tables, z)[source]#

Return the section of a record’s maps a position lies in.

The maps are continuous across a section edge – the fields at a node are, even at a kink of the geometry, where only their slope jumps – so which side a position on an edge reads changes the value by the representation error alone and no one-sided rule is needed, unlike the coupled flow’s (solprop.translate.coupled.flow_weights()). A position within 1e-10 of the span of an interior edge takes the section starting there, as solprop.translate.coupled.flow_section() does, and one a rounding outside the span the nearest end’s.

Parameters:
tablessolprop.translate.modal_tables.ModalTransformTables

The record.

zfloat

Position in m.

Returns:
int

The section index, in [0, n_intervals).

solprop.translate.modal_path.transform_weights(tables, z)[source]#

Return the weights that combine a record’s moving maps at one position.

The stage-bundle row of kernel schema 14 (solprop.translate.stage.StageScalars.transform_weights): a backend evaluates S(z) = sum_j w_j S_j and Q(z) = sum_j w_j Q_j over the maps’ (n_intervals, n_deg) coefficient axes flattened, exactly as it evaluates dPhi over its terms. Every weight outside the section containing z (transform_section()) is zero, so no section’s expansion is extrapolated.

None where there is nothing to combine: no record, a record carrying no maps, or maps of one coefficient – one interval of degree zero, a constant geometry – whose one term is the map itself. That keeps the stage bundle of every problem whose maps do not move unchanged.

Parameters:
tablessolprop.translate.modal_tables.ModalTransformTables or None

The record, or None.

zfloat

Position in m.

Returns:
numpy.ndarray or None

Float64, shape (n_intervals * n_deg,), or None.

Examples

>>> from solprop.translate.modal_path import transform_weights
>>> transform_weights(None, 0.5) is None
True