Signal Filtering (1-D signals)

This processing applies a low-pass or high-pass filter to a time signal.


Input Parameters

The following keys can be set:

  • base – (type = antares.Base ) – a base that contains many zones (independent to each others, typically many probes). Each zone contains one instant object. Each instant contains at least two 1-D arrays that represent a time signal

  • type – (type = string in (‘low’, ‘high’) ) – Type of filtering

  • cutoff_frequency – (type = float ) – Cutoff frequency for the filter

Warning

The variable representing time must be the first variable in the Instant. The second variable is the variable to filter. Other variables are ignored. To ensure that, use base slicing if needed (see https://cerfacs.fr/antares/tutorial/api/api3.html for more information).

Main functions

class antares.treatment.TreatmentFilter.TreatmentFilter
execute()

Execute the treatment.

Returns

a base that contains many zones. Each zone contains one instant. Each instant contains two 1-D arrays:

  1. The variable representing time

  2. The filtered signal (real valued)

Return type

antares.Base

Example

"""
This example how to generate a geometrical cut (of type plane).
To be able to use this functionnality you must have vtk installed.
"""
import os
if not os.path.isdir('OUTPUT'):
    os.makedirs('OUTPUT')

from antares import Reader, Treatment, Writer

# ------------------
# Reading the files
# ------------------
reader = Reader('column')
reader['filename'] = os.path.join('..', 'data', '1D', 'massflow.dat')
base = reader.read()

# -----------
# Filterring
# -----------
treatment = Treatment('filter')
treatment['base'] = base
treatment['cutoff_frequency'] = 2.0E-3
treatment['type'] = 'low'
result = treatment.execute()

# -------------------
# Writing the result
# -------------------
writer = Writer('column')
writer['filename'] = os.path.join('OUTPUT', 'ex_filter.dat')
writer['base'] = result
writer.dump()