[new] added data file and a function that evaluates the Gutenberg-Richter relation for a given distance

This commit is contained in:
2016-09-22 10:53:09 +02:00
parent 180cd25b51
commit f35559e7c0
2 changed files with 61 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ Created autumn/winter 2015.
:author: Ludger Küperkoch / MAGS2 EP3 working group
"""
import os
import matplotlib.pyplot as plt
import numpy as np
from obspy.core import Stream, UTCDateTime
@@ -15,8 +15,14 @@ from scipy.optimize import curve_fit
from scipy import integrate, signal
from pylot.core.io.data import Data
from pylot.core.util.dataprocessing import restitute_data, read_metadata
from pylot.core.util.utils import common_range
from pylot.core.util.utils import common_range, fit_curve
def gutenberg_richter_relation(delta):
relation = np.loadtxt(os.path.join(os.path.expanduser('~'),
'.pylot', 'gutenberg_richter.data'))
# prepare spline interpolation to calculate return value
func, params = fit_curve(relation[:,0], relation[:, 1])
return func(delta, params)
class Magnitude(object):
'''