Signal Filtering (1-D signals)

Description

Applies a low-pass or high-pass filter to a time signal.

Parameters

  • base: Base

    The input base that contains many zones (independent to each others, typically many probes).

  • type: str in [‘low’, ‘high’]

    Type of filtering.

  • cutoff_frequency: float

    Cutoff frequency for the filter.

Preconditions

Each zone contains one instant object. Each instant contains at least two 1-D arrays that represent a time signal.

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 change the ordering of variables, you may use base slicing.

Main functions

class antares.treatment.TreatmentFilter.TreatmentFilter
execute()

Filter the time signal.

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:

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()