PlasmaCalcs.tools.fft_tools.fft_dimnames.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.- __init__(name, *, rad=None)
Methods
__init__(name, *[, rad])from_post(post, *[, rad])implied_from(s, array_dims, *[, rad, post_fft])is_valid_post(post, *[, rad])Attributes
- 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: str
- the 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 str
- result will be appropriate for taking an fft of array with these dims.(Can also contain non-dimension coordinates of array.)
- rad: None or bool
- rad 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 False
- True –> 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.