pod module

class IMTreatment.pod.pod.ModalFields(decomp_type, mean_field, modes, modes_numbers, temporal_evolutions, eigvals=None, eigvects=None, ritz_vals=None, mode_norms=None, growth_rate=None, pulsation=None)[source]

Bases: IMTreatment.core.field.Field

Class representing the result of a modal decomposition.

augment_temporal_resolution(fact=2, interp='linear', inplace=True, verbose=False)[source]

Augment the temporal resolution (to augmente the temporal resolution of the reconstructed fields).

Parameters:
  • fact (integer) – Resolution augmentation needed (default is ‘2’, for a result profile with twice more points)
  • interp (string in ['linear', 'nearest', 'slinear', 'quadratic',) – ‘cubic’] Specifies the kind of interpolation as a string (Default is ‘linear’). slinear’, ‘quadratic’ and ‘cubic’ refer to a spline interpolation of first, second or third order.
  • inplace (bool) –

    .

  • verbose (bool) –

    .

crop(intervx=None, intervy=None, intervt=None, ind=False, inplace=False)[source]

Crop the POD modes and/or temporal evolutions, according to the given intervals.

Parameters:
  • intervx (2x1 array of numbers) – Interval of x to keep.
  • intervy (2x1 array of numbers) – Interval of y to keep.
  • intervt (2x1 array of numbers) – Interval of time to keep.
  • ind (boolean, optional) – If ‘True’, intervals are understood as indices along axis. If ‘False’ (default), intervals are understood in axis units.
  • inplace (boolean, optional) – If ‘True’, the field is croped in place.
crop_modal_base(modes_to_keep=None, modes_to_remove=None, inplace=True)[source]

Remove some modes from the modal base.

Parameters:
  • modes_to_keep (array of integers or integer) – If an integer, the first N modes are kept, if an array of indices, all the associated modes are conserved.
  • modes_to_remove (array of integers or integer) – If an integer, the last N modes are removed, if an array of indices, all the associated modes are removed.
display()[source]
display_recap(figsize=(15, 10))[source]

Display some important diagram for the decomposition.

get_critical_kappa(Nx, Ny=None)[source]

Return the critical value of kappa. A mode with a kappa value superior to the critical value have only .3% chance to be a random mode.

get_modes_energy(cum=False, raw=False)[source]

Return a profile whith the modes mean energy.

Parameters:
  • cum (boolean, optional) – If ‘False’ (default), return the modes energy If ‘True’, return the cumulative modes energy
  • raw (bool, optional) – If ‘False’ (default), a Profile object is returned If ‘True’, an array is returned
Returns:

modes_nrj – Energy for each modes.

Return type:

array or Profile object

get_spatial_coherence(raw=False)[source]

Return a profile where each value represent the probability for a mode to be spatialy non-random (values from 0 to 1). Can be used to determine the modes to take to filter the turbulence (and so perform a tri-decomposition (mean + coherent + turbulent))

Parameters:raw (bool, optional) – If ‘False’ (default), a Profile object is returned If ‘True’, an array is returned
Returns:var_spec – Probability estimation for each mode of being coherent in space.
Return type:array or Profile object

Notes

Returned values are, for each modes, the variance of the normalized two-dimensional spectrum of Vx and Vy. Variance is high when spectrum show predominant frequencies (coherent behavior), inversely, variance is low when spectrum is nearly uniform (random behavior).

get_temporal_coherence(raw=False)[source]

Return a profile where each value represent the probability for a mode to be temporaly non-random (values above 0 have only 5% chance to be associated with random modes). Can be used to determine the modes to take to filter the turbulence (and so perform a tri-decomposition (mean + coherent + turbulent))

Parameters:raw (bool, optional) – If ‘False’ (default), a Profile object is returned If ‘True’, an array is returned
Returns:var_spec – Probability estimation for each mode of being coherent in time.
Return type:array or Profile object

Notes

Returned values are, for each modes, the variance of the normalized spectrum of the temporal evolution. Variance is high when spectrum show predominant frequencies (coherent behavior), inversely, variance is low when spectrum is nearly uniform (random behavior).

modes_as_tf
reconstruct(wanted_modes='all', times=None)[source]

Recontruct fields resolved in time from modes.

Parameters:
  • wanted_modes (string or number or array of numbers, optional) – wanted modes for reconstruction : If ‘all’ (default), all modes are used If an array of integers, the wanted modes are used If an integer, the wanted first modes are used.
  • times (tuple of numbers) – If specified, reconstruction is computed on the wanted times, else, times used for decomposition are used.
Returns:

TF – Reconstructed fields.

Return type:

TemporalFields (TemporalScalarFields or TemporalVectorFields)

scale(scalex=1.0, scaley=1.0, scalet=1.0, scalev=1.0, inplace=False)[source]
smooth_spatial_evolutions(tos='uniform', size=None, inplace=True)[source]

Smooth the spatial evolutions (to do before reconstructing)

Parameters:
  • tos (string, optional) – Type of smoothing, can be ‘uniform’ (default) or ‘gaussian’ (See ndimage module documentation for more details)
  • size (number, optional) – Size of the smoothing (is radius for ‘uniform’ and sigma for ‘gaussian’). Default is 3 for ‘uniform’ and 1 for ‘gaussian’.
smooth_temporal_evolutions(tos='uniform', size=None, inplace=True)[source]

Smooth the temporal evolutions (to do before reconstructing)

Parameters:
  • tos (string, optional) – Type of smoothing, can be ‘uniform’ (default) or ‘gaussian’ (See ndimage module documentation for more details)
  • size (number, optional) – Size of the smoothing (is radius for ‘uniform’ and sigma for ‘gaussian’). Default is 3 for ‘uniform’ and 1 for ‘gaussian’.
IMTreatment.pod.pod.modal_decomposition(obj, kind='pod', obj2=None, wanted_modes='all', max_vecs_per_node=1000, verbose=True)[source]

Compute POD modes of the given fields using the snapshot method.

Parameters:
  • obj (TemporalFields, Profile or Points object) – Fields to extract modes from
  • obj2 (same as obj) – Only used as second dataset for BPOD
  • kind (string, optional) – Kind of decomposition, can be ‘pod’ (default), ‘bpod’ or ‘dmd’.
  • wanted_modes (string or number or array of numbers) – If ‘all’, extract all modes, If a number, extract first modes, If an array, extract the associated modes.
  • max_vecs_per_node (integer, optional) – Number of fields that can be charged in memory. (More is faster but can lead to MemoryError)
  • verbose (boolean, optional) – If ‘True’, display information.
Returns:

modal_field – .

Return type:

ModalField object

Notes

You can use partially masked fields as input. If so, the asked values are lineary interpolated before doing the decomposition.