def plot_trunc_gr_model(
        aval, bval, min_mag, max_mag, dmag,
        catalogue=None, completeness=None, filename=None,
        figure_size=(8, 6), filetype='png', dpi=300, ax=None):
    """
    Plots a Gutenberg-Richter model
    """
    input_model = TruncatedGRMFD(min_mag, max_mag, dmag, aval, bval)
    if not catalogue:
        # Plot only the modelled recurrence
        annual_rates, cumulative_rates = _get_recurrence_model(input_model)

        if ax is None:
            fig, ax = plt.subplots(figsize=figure_size)
        else:
            fig = ax.get_figure()

        ax.semilogy(annual_rates[:, 0], annual_rates[:, 1], 'b-')
        ax.semilogy(annual_rates[:, 0], cumulative_rates, 'r-')
        ax.xlabel('Magnitude')
        ax.set_ylabel('Annual Rate')
        ax.set_legend(['Incremental Rate', 'Cumulative Rate'])
        _save_image(fig, filename, filetype, dpi)

    else:
        completeness = _check_completeness_table(completeness, catalogue)
        plot_recurrence_model(
            input_model, catalogue, completeness, dmag, filename=filename,
            figure_size=figure_size, filetype=filetype, dpi=dpi, ax=ax)
def plot_trunc_gr_model ( aval , bval , min_mag , max_mag , dmag , catalogue = None , completeness = None , filename = None , figure_size = ( 8 , 6 ) , filetype = 'png' , dpi = 300 , ax = None ) : input_model = TruncatedGRMFD ( min_mag , max_mag , dmag , aval , bval ) if not catalogue : annual_rates , cumulative_rates = _get_recurrence_model ( input_model ) if ax is None : fig , ax = plt . subplots ( figsize = figure_size ) else : fig = ax . get_figure ( ) ax . semilogy ( annual_rates [ : , 0 ] , annual_rates [ : , 1 ] , 'b-' ) ax . semilogy ( annual_rates [ : , 0 ] , cumulative_rates , 'r-' ) ax . xlabel ( 'Magnitude' ) ax . set_ylabel ( 'Annual Rate' ) ax . set_legend ( [ 'Incremental Rate' , 'Cumulative Rate' ] ) _save_image ( fig , filename , filetype , dpi ) else : completeness = _check_completeness_table ( completeness , catalogue ) plot_recurrence_model ( input_model , catalogue , completeness , dmag , filename = filename , figure_size = figure_size , filetype = filetype , dpi = dpi , ax = ax )
Plots a Gutenberg-Richter model