DigitalFilter#

class empymod.filters.DigitalFilter(name, savename=None, filter_coeff=None)[source]#

Bases: object

Simple Class for Digital Linear Filters.

Parameters:
namestr

Name of the DFL.

savename = str

Name with which the filter is saved. If None (default) it is set to the same value as name.

filter_coeff = list of str

By default, the following filter coefficients are checked:

filter_coeff = ['j0', 'j1', 'sin', 'cos']

This accounts for the standard Hankel and Fourier DLF in CSEM modelling. However, additional coefficient names can be provided via this parameter (in list format).

Methods Summary

fromfile([path])

Load filter values from ASCII-files.

tofile([path])

Save filter values to ASCII-files.

Methods Documentation

fromfile(path='filters')[source]#

Load filter values from ASCII-files.

Load filter base and filter coefficients from ASCII files in the directory path; path can be a relative or absolute path.

Examples

>>> import empymod
>>> # Create an empty filter;
>>> # Name has to be the base of the text files
>>> filt = empymod.filters.DigitalFilter('my-filter')
>>> # Load the ASCII-files
>>> filt.fromfile()
>>> # This will load the following three files:
>>> #    ./filters/my-filter_base.txt
>>> #    ./filters/my-filter_j0.txt
>>> #    ./filters/my-filter_j1.txt
>>> # and store them in filt.base, filt.j0, and filt.j1.
tofile(path='filters')[source]#

Save filter values to ASCII-files.

Store the filter base and the filter coefficients in separate files in the directory path; path can be a relative or absolute path.

Examples

>>> import empymod
>>> # Load a filter
>>> filt = empymod.filters.Hankel().wer_201_2018
>>> # Save it to pure ASCII-files
>>> filt.tofile()
>>> # This will save the following three files:
>>> #    ./filters/wer_201_2018_base.txt
>>> #    ./filters/wer_201_2018_j0.txt
>>> #    ./filters/wer_201_2018_j1.txt