Ejemplo n.º 1
0
def plotZoneFMD(cls,
                feature_data,
                normalize=FMD_COMPUTE_ANNUAL_RATE,
                title=''):

    window = plots.createPlotWindow(cls)

    fits = []

    fmd = feature_data['fmd']
    parameters = feature_data['parameters']

    if fmd is None:
        return None

    if fmd.GR['fit'] is not None:
        activity_ml_arr = numpy.vstack((fmd.GR['mag_fit'], fmd.GR['fit']))
        fits.append({'data': activity_ml_arr, 'label': "Activity (ML)"})

    central_A = utils.centralValueOfList(parameters['activity_a'])
    central_b = utils.centralValueOfList(parameters['activity_b'])

    a_value = atticivy.activity2aValue(central_A, central_b,
                                       parameters['activity_mmin'])
    activity_rm_arr = computeFMDArray(a_value,
                                      central_b,
                                      fmd.fmd[0, :],
                                      timespan=cls.catalog_time_span[0])

    fits.append({'data': activity_rm_arr, 'label': "Activity (RM)"})

    # new FMD plot
    figure = fmd.plot(imgfile=None,
                      fits=fits,
                      fmdtype='cumulative',
                      normalize=normalize)

    if title == '':
        title = parameters['plot_title_fmd']

    canvas = plots.PlotCanvas(figure, title=title)
    canvas.draw()

    # FMD plot window, re-populate layout
    window.layoutPlot.addWidget(canvas)
    toolbar = plots.createToolbar(canvas, window)
    window.layoutPlot.addWidget(toolbar)

    return figure
Ejemplo n.º 2
0
def plotRecurrence(cls, feature, feature_data=None, title=''):

    window = plots.createPlotWindow(cls)

    pr = cls.fault_source_layer.dataProvider()
    
    activity_min_name = features.FAULT_SOURCE_ATTR_ACTIVITYRATE_MIN ['name']
    activity_max_name = features.FAULT_SOURCE_ATTR_ACTIVITYRATE_MAX ['name']
    
    activity_min_idx = pr.fieldNameIndex(activity_min_name)
    activity_max_idx = pr.fieldNameIndex(activity_max_name)

    distrostring_min = str(feature[activity_min_idx].toString())
    distrostring_max = str(feature[activity_max_idx].toString())
    distrodata_min = utils.distrostring2plotdata(distrostring_min)
    distrodata_max = utils.distrostring2plotdata(distrostring_max)

    distrodata = numpy.vstack((distrodata_min, distrodata_max[1, :]))

    fits = []
    if feature_data['fmd'].GR['fit'] is not None:
        activity_ml_arr = numpy.vstack((
            feature_data['fmd'].GR['mag_fit'], 
            feature_data['fmd'].GR['fit'] / cls.catalog_time_span[0]))
        fits.append({'data': activity_ml_arr, 'label': "FBZ (ML)"})
        
    # scale EQ rates per year
    fmd = numpy.vstack((
            feature_data['fmd'].fmd[0, :], 
            feature_data['fmd'].fmd[1, :] / cls.catalog_time_span[0],
            feature_data['fmd'].fmd[2, :] / cls.catalog_time_span[0]))
    
    # new recurrence FMD plot (returns figure)
    plot = qpplot.FMDPlotRecurrence()
    figure = plot.plot(imgfile=None, occurrence=distrodata, fmd=fmd, 
        fits=fits)

    if title == '':
        title = feature_data['parameters']['plot_title_recurrence']
        
    canvas = plots.PlotCanvas(figure, title=title)
    canvas.draw()

    # FMD plot window, re-populate layout
    window.layoutPlot.addWidget(canvas)
    toolbar = plots.createToolbar(canvas, window)
    window.layoutPlot.addWidget(toolbar)
    
    return figure
Ejemplo n.º 3
0
def plotRecurrence(cls, feature, feature_data=None, title=''):

    window = plots.createPlotWindow(cls)

    pr = cls.fault_source_layer.dataProvider()

    activity_min_name = features.FAULT_SOURCE_ATTR_ACTIVITYRATE_MIN['name']
    activity_max_name = features.FAULT_SOURCE_ATTR_ACTIVITYRATE_MAX['name']

    activity_min_idx = pr.fieldNameIndex(activity_min_name)
    activity_max_idx = pr.fieldNameIndex(activity_max_name)

    distrostring_min = str(feature[activity_min_idx].toString())
    distrostring_max = str(feature[activity_max_idx].toString())
    distrodata_min = utils.distrostring2plotdata(distrostring_min)
    distrodata_max = utils.distrostring2plotdata(distrostring_max)

    distrodata = numpy.vstack((distrodata_min, distrodata_max[1, :]))

    fits = []
    if feature_data['fmd'].GR['fit'] is not None:
        activity_ml_arr = numpy.vstack(
            (feature_data['fmd'].GR['mag_fit'],
             feature_data['fmd'].GR['fit'] / cls.catalog_time_span[0]))
        fits.append({'data': activity_ml_arr, 'label': "FBZ (ML)"})

    # scale EQ rates per year
    fmd = numpy.vstack(
        (feature_data['fmd'].fmd[0, :],
         feature_data['fmd'].fmd[1, :] / cls.catalog_time_span[0],
         feature_data['fmd'].fmd[2, :] / cls.catalog_time_span[0]))

    # new recurrence FMD plot (returns figure)
    plot = qpplot.FMDPlotRecurrence()
    figure = plot.plot(imgfile=None, occurrence=distrodata, fmd=fmd, fits=fits)

    if title == '':
        title = feature_data['parameters']['plot_title_recurrence']

    canvas = plots.PlotCanvas(figure, title=title)
    canvas.draw()

    # FMD plot window, re-populate layout
    window.layoutPlot.addWidget(canvas)
    toolbar = plots.createToolbar(canvas, window)
    window.layoutPlot.addWidget(toolbar)

    return figure
Ejemplo n.º 4
0
def updatePlotMomentRateArea(cls, parameters):

    window = plots.createPlotWindow(cls)

    # new moment rate plot
    plot = plots.MomentRateComparisonPlotArea()
    figure = plot.plot(imgfile=None, data=parameters)

    canvas = plots.PlotCanvas(figure, title=parameters['plot_title_fmd'])
    canvas.draw()

    # plot widget
    window.layoutPlot.addWidget(canvas)
    toolbar = plots.createToolbar(canvas, window)
    window.layoutPlot.addWidget(toolbar)

    return figure
Ejemplo n.º 5
0
def updatePlotMomentRateArea(cls, parameters):

    window = plots.createPlotWindow(cls)

    # new moment rate plot
    plot = plots.MomentRateComparisonPlotArea()
    figure = plot.plot(imgfile=None, data=parameters)

    canvas = plots.PlotCanvas(figure, title=parameters['plot_title_fmd'])
    canvas.draw()

    # plot widget
    window.layoutPlot.addWidget(canvas)
    toolbar = plots.createToolbar(canvas, window)
    window.layoutPlot.addWidget(toolbar)
    
    return figure
Ejemplo n.º 6
0
def plotZoneFMD(cls, feature_data, normalize=FMD_COMPUTE_ANNUAL_RATE, 
    title=''):

    window = plots.createPlotWindow(cls)

    fits = []
    
    fmd = feature_data['fmd']
    parameters = feature_data['parameters']
    
    if fmd is None:
        return None
        
    if fmd.GR['fit'] is not None:
        activity_ml_arr = numpy.vstack((fmd.GR['mag_fit'], fmd.GR['fit']))
        fits.append({'data': activity_ml_arr, 'label': "Activity (ML)"})
        
    central_A = utils.centralValueOfList(parameters['activity_a'])
    central_b = utils.centralValueOfList(parameters['activity_b'])
    
    a_value = atticivy.activity2aValue(central_A, central_b, 
        parameters['activity_mmin'])
    activity_rm_arr = computeFMDArray(a_value, central_b, fmd.fmd[0, :], 
        timespan=cls.catalog_time_span[0])
    
    fits.append({'data': activity_rm_arr, 'label': "Activity (RM)"})
    
    # new FMD plot 
    figure = fmd.plot(imgfile=None, fits=fits, fmdtype='cumulative', 
        normalize=normalize)

    if title == '':
        title = parameters['plot_title_fmd']
        
    canvas = plots.PlotCanvas(figure, title=title)
    canvas.draw()

    # FMD plot window, re-populate layout
    window.layoutPlot.addWidget(canvas)
    toolbar = plots.createToolbar(canvas, window)
    window.layoutPlot.addWidget(toolbar)
    
    return figure