[closes #157] filter defaults are now read from text file like the sample filter.in coming with this commit simply copy to .pylot folder in your home directory (this is preliminary because the filter parameters should be settable project wide by one responsible person)
This commit is contained in:
parent
0b02e8c213
commit
0e3576d193
@ -6,12 +6,37 @@ Created on Wed Feb 26 12:31:25 2014
|
|||||||
@author: sebastianw
|
@author: sebastianw
|
||||||
"""
|
"""
|
||||||
|
|
||||||
FILTERDEFAULTS = {'P': {'filtertype': None,
|
import os
|
||||||
'order': None,
|
|
||||||
'freq': None},
|
def readFilterInformation(fname):
|
||||||
'S': {'filtertype': 'bandpass',
|
def convert2FreqRange(*args):
|
||||||
'order': 4,
|
if len(args) > 1:
|
||||||
'freq': [.5, 5]}}
|
return [float(arg) for arg in args]
|
||||||
|
elif len(args) == 1:
|
||||||
|
return float(args[0])
|
||||||
|
return None
|
||||||
|
filter_file = open(fname, 'r')
|
||||||
|
filter_information = dict()
|
||||||
|
for filter_line in filter_file.readlines():
|
||||||
|
filter_line = filter_line.split(' ')
|
||||||
|
for n, pos in enumerate(filter_line):
|
||||||
|
if pos == '\n':
|
||||||
|
filter_line[n] = ''
|
||||||
|
filter_information[filter_line[0]] = {'filtertype': filter_line[1]
|
||||||
|
if filter_line[1]
|
||||||
|
else None,
|
||||||
|
'order': int(filter_line[2])
|
||||||
|
if filter_line[1]
|
||||||
|
else None,
|
||||||
|
'freq': convert2FreqRange(*filter_line[3:])
|
||||||
|
if filter_line[1]
|
||||||
|
else None}
|
||||||
|
return filter_information
|
||||||
|
|
||||||
|
|
||||||
|
FILTERDEFAULTS = readFilterInformation(os.path.join(os.path.expanduser('~'),
|
||||||
|
'.pylot',
|
||||||
|
'filter.in'))
|
||||||
|
|
||||||
OUTPUTFORMATS = {'.xml':'QUAKEML',
|
OUTPUTFORMATS = {'.xml':'QUAKEML',
|
||||||
'.cnv':'CNV',
|
'.cnv':'CNV',
|
||||||
|
Loading…
Reference in New Issue
Block a user