Beispiel #1
0
    def setUp(self):
        """
        This generates a catalogue to be used for the regression.
        """
        # Generates a data set assuming b=1
        self.dmag = 0.1
        mext = np.arange(4.0, 7.01, 0.1)
        self.mval = mext[0:-1] + self.dmag / 2.0
        self.bval = 1.0
        numobs = np.flipud(np.diff(np.flipud(10.0**(-self.bval * mext + 7.0))))

        # Define completeness window
        numobs[0:6] *= 10
        numobs[6:13] *= 20
        numobs[13:22] *= 50
        numobs[22:] *= 100

        compl = np.array([[1900, 1950, 1980, 1990], [6.34, 5.44, 4.74, 3.0]])
        self.compl = np.flipud(compl.transpose())
        numobs = np.around(numobs)

        magnitude = np.zeros((np.sum(numobs)))
        year = np.zeros((np.sum(numobs))) * 1999

        lidx = 0
        for mag, nobs in zip(self.mval, numobs):
            uidx = int(lidx + nobs)
            magnitude[lidx:uidx] = mag + 0.01
            year_low = compl[0, np.min(np.nonzero(compl[1, :] < mag)[0])]
            year[lidx:uidx] = (year_low + np.random.rand(uidx - lidx) *
                               (2000 - year_low))
            lidx = uidx

        self.catalogue = Catalogue.make_from_dict({
            'magnitude': magnitude,
            'year': year
        })
        self.ks_ml = KijkoSmit()
        self.config = {'Average Type': 'Weighted'}
Beispiel #2
0
bml_recurrence = BMaxLikelihood()

bval, sigmab, seismicity_rate, sigma_rate = bml_recurrence.calculate(
    catalogue, recurrence_config, completeness_table)

print 'B-value = %9.4f +/- %9.4f' % (bval, sigmab)
print 'Rate = %9.4f +/- %9.4f' % (seismicity_rate, sigma_rate)

# In[ ]:

# Set up the configuration parameters
bwc_recurrence = Weichert()

bval, sigmab, seismicity_rate, sigma_rate = bwc_recurrence.calculate(
    catalogue, recurrence_config, completeness_table)

print 'B-value = %9.4f +/- %9.4f' % (bval, sigmab)
print 'Rate = %9.4f +/- %9.4f' % (seismicity_rate, sigma_rate)

# In[ ]:
# In[ ]:

# Set up the configuration parameters
bks_recurrence = KijkoSmit()

bval, sigmab, seismicity_rate, sigma_rate = bks_recurrence.calculate(
    catalogue, recurrence_config, completeness_table)

print 'B-value = %9.4f +/- %9.4f' % (bval, sigmab)
print 'Rate (M >= 4.0) = %9.4f +/- %9.4f' % (seismicity_rate, sigma_rate)