TimeFreqSupport

class ansys.dpf.core.time_freq_support.TimeFreqSupport(time_freq_support=None, server=None)

A class used to represent a TimeFreqSupport which is a description of the temporal/frequency analysis.

It stores values such as the frequencies (time/complex), the RPMs and the hamonic indices. The rpm_value is step (or load_step) based value. The time_freqencies/complex_frequencies/harmonic_indices are set based values. There is one set value for each step/substep combination.

Parameters
  • time_freq_support (ansys.grpc.dpf.time_freq_support_pb2.TimeFreqSupport message) –

  • server (server.DPFServer, optional) – Server with channel connected to the remote or local instance. When None, attempts to use the the global server.

Examples

Create a TimeFreqSupport from a model.

>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> transient = examples.download_transient_result()
>>> model = Model(transient)
>>> time_freq_support = model.metadata.time_freq_support # printable
property time_frequencies

Field of time frequencies or time values for the active result Frequencies field can have one value by set.

Examples

>>> freq = time_freq_support.time_frequencies
>>> freq.data
array([0.        , 0.019975  , 0.039975  , 0.059975  , 0.079975  ,
       0.099975  , 0.119975  , 0.139975  , 0.159975  , 0.179975  ,
       0.199975  , 0.218975  , 0.238975  , 0.258975  , 0.278975  ,
       0.298975  , 0.318975  , 0.338975  , 0.358975  , 0.378975  ,
       0.398975  , 0.417975  , 0.437975  , 0.457975  , 0.477975  ,
       0.497975  , 0.517975  , 0.53754972, 0.55725277, 0.57711786,
       0.59702054, 0.61694639, 0.63683347, 0.65673452, 0.67662783])
property complex_frequencies

Field of complex frequencies for the active result. Complex frequencies field can have one value by set.

Examples

>>> freq = time_freq_support.complex_frequencies
property rpms

Field of RPMs for the active result. RPM field has one value by load step.

Returns None if result has no RPMs.

get_harmonic_indices(stage_num=0)

Field of harmonic indices for the active result.

Returns

  • field (dpf.core.Field) – Field of all the harmonic indices in the model (complex or real). None if result is not cyclic and contains no harmonic indices.

  • stage_num (int, default: 0, optional) – Targeted stage number.

set_harmonic_indices(harmonic_indices, stage_num=0)

Set the harmonic indices values of the time_freq_support.

Parameters
  • harmonic_indices (Field) – Field of harmonic_indices that must be set.

  • stage_num (int, default: 0, optional) – Stage number that is defined by those harmonic indices.

property n_sets

Number of result sets

Examples

>>> time_freq_support.n_sets
35
get_frequency(step=0, substep=0, cumulative_index=None, cplx=False)

Returns the frequence corresponding to step/substep or cumulative index requested.

Parameters
  • step (int, optional) – Step index (one based).

  • substep (int, optional) – Substep index (one based).

  • cumulative_index (int, optional) – Cumulative index (one based).

  • cplx (bool) – Return a complex frequency, default False.

Returns

frequency – Frequency of the step or substep.

Return type

double

get_cumulative_index(step=0, substep=0, freq=None, cplx=False)

Returns the cumulative index corresponding to step/substep or frequency requested.

Parameters
  • step (int, optional) – Analysis step.

  • substep (int, optional) – Analysis substep

  • freq (double, optional) – Frequency in Hz.

  • cplx (False, optional) – Return a complex frequency. Default False

Returns

index – Cumulative index based on either the step, substep or frequency.

Return type

int

append_step(step_id, step_time_frequencies, step_complex_frequencies=None, rpm_value=None, step_harmonic_indices=None)

Append a step with all its field values in the time frequencies support. The rpm_value is step (or load_step) based value. The time_freqencies/complex_frequencies/harmonic_indices are set based values. There is one set value for each step/substep combination.

It is necessary that each call of my_time_freq_support.append_step(kwargs**) contains the same arguments.

It is necessary that time_frequencies/complex_frequencies/harmonic_indices lists have the same size if specified in the same my_time_freq_support.append_step(kwargs**) call.

Parameters
  • step_id (int) – Id of the step to add.

  • step_time_frequencies (list of int/float) – Time frequencies values related to the specified step

  • step_complex_frequencies (list of int/float, optional) – Complex frequencies values related to the specified step

  • rpm_value (int/float, optional) – RPM value for the specified step

  • step_harmonic_indices (optional, dictionary or list) – Can be dictionary of { int : list of int/float } = { stage_num : harmonic_indices } or a list of int/float. In this case, stage_num default value is 0. harmonic_indices are values related to the specified step.

Example

>>> from ansys.dpf.core import TimeFreqSupport
>>> tfq = TimeFreqSupport()
>>> tfq.append_step(1, [0.1, 0.21, 1.0], rpm_value = 2.0)
>>> tfq.append_step(2, [1.1, 2.0], rpm_value = 2.3)
>>> tfq2 = TimeFreqSupport()
>>> tfq2.append_step(1, [0.1, 0.21, 1.0], rpm_value = 2.0, step_harmonic_indices = [1.0, 2.0, 3.0])
>>> tfq2.append_step(2, [1.1, 2.0], rpm_value = 2.3, step_harmonic_indices = [1.0, 2.0])
>>> tfq2.append_step(3, [0.23, 0.25], rpm_value = 3.0, step_harmonic_indices = [1.0, 2.0])
>>> tfq3 = TimeFreqSupport()
>>> tfq3.append_step(1, [0.1, 0.21, 1.0], rpm_value = 2.0, step_harmonic_indices = { 1 : [1.0, 2.0, 3.0], 2 : [1.0, 2.0, 2.5] } )
deep_copy(server=None)

Creates a deep copy of the time_freq_support’s data on a given server. This can be useful to pass data from one server instance to another.

Parameters
  • server (DPFServer, optional) –

  • with channel connected to the remote or local instance. When (Server) –

  • None

  • to use the the global server. (attempts) –

Returns

tf_copy

Return type

TimeFreqSupport