FFTDimname
- class PlasmaCalcs.tools.fft_tools.fft_dimnames.FFTDimname(name, *, rad=None)
Bases:
objectfft dimension name, along with methods to get post-fft name.
name: the pre-fft name.rad: whether rad==True. Default None.self.pre is the pre-fft name.self.post is the post-fft name. Alternatively, use str(self) to see the post-fft name.Methods
__eq__(other)self == other.
__repr__()repr(self).
__str__()str(self).
from_post(post, *[, rad])create FFTDimname from post-fft name.
implied_from(s, array_dims, *[, rad, post_fft])returns FFTDimname from s corresponding to one of the array_dims.
is_valid_post(post, *[, rad])returns whether post is a valid post-fft name, given rad.
Attributes
the post-fft name.
the pre-fft name.
- __eq__(other)
self == other. True when self.name == other.name and self.rad == other.rad.
if other not an instance of type(self), return False.
- __repr__()
repr(self).
- __str__()
str(self). Equivalent to str(self.post).
- classmethod from_post(post, *, rad=None)
create FFTDimname from post-fft name.
rad: None or bool
if incompatible with inferred rad, raise DimensionKeyError.None –> compatible with any inferred rad; doesn’t cause DimensionKeyError.post: strthe post-fft name, used to infer the pre-fft name and possibly also rad.if rad is False, post MUST look like ‘freq_{dim}’.Otherwise:if post looks like any DEFAULTS.FFT_FREQ_RAD_DIMNAMES.values(),use name = the associated key (and infer rad=True).elif post looks like ‘freqrad_{dim}’, use name = dim (and infer rad=True).elif post looks like ‘freq_{dim}’, use name = dim (and infer rad=False).else, raise DimensionKeyError.
- classmethod implied_from(s, array_dims, *, rad=None, post_fft=False)
returns FFTDimname from s corresponding to one of the array_dims.
s: str
the pre-fft or post-fft name, corresponding to one of the array_dims.Might match an array_dim exactly, or might match array_dim pre or post fft.array_dims: iterable of strresult will be appropriate for taking an fft of array with these dims.(Can also contain non-dimension coordinates of array.)rad: None or boolrad to use when creating FFTDimname from s.If None, use rad inferred from s & array_dims.Otherwise, ensure rad is compatible with inferred rad (else raise DimensionKeyError).post_fft: bool, default FalseTrue –> array_dims tell the post-fft dimensions.False –> array_dims tell the pre-fft dimensions.Use True when taking an ifft of an array with array.dims == array_dims.Examples:(‘x’, [‘x’, ‘y’]) –> cls(‘x’, rad=rad) # by default, rad=None)(‘k_x’, [‘x’, ‘y’]) –> cls(‘x’, rad=True)(‘freq_x’, [‘x’, ‘y’]) –> cls(‘x’, rad=False)(‘x’, [‘k_x’, ‘k_y’], post_fft=True) –> cls(‘x’, rad=True)(‘k_x’, [‘k_x’, ‘k_y’], post_fft=True) –> cls(‘x’, rad=True)(‘freq_x’, [‘k_x’, ‘k_y’], post_fft=True) –> raise DimensionKeyError(‘x’, [‘k_y’, ‘t’]) –> raise DimensionKeyError
- classmethod is_valid_post(post, *, rad=None)
returns whether post is a valid post-fft name, given rad.
valid if can create FFTDimname from post & rad without raising DimensionKeyError.
- property post
the post-fft name.
- property pre
the pre-fft name.