def plot_completeness_slices(catalogue, slice_key, slice_ids, mag_bin=0.5, time_bin=1., deduplicate=True, mag_range=(4., None), year_range=None): """ Stepp (1971) analysis on sub-catalogues, where `slice_key` and `slice_ids` determine how the sub-catalouges are formed. """ comp_config = { 'magnitude_bin': mag_bin, 'time_bin': time_bin, 'increment_lock': True } fig, axes = plt.subplots(len(slice_ids), 1, figsize=(6, 2 * len(slice_ids)), sharex=True) fig.subplots_adjust(hspace=0) slice_completeness_tables = [] for ax, slice_id in zip(axes, slice_ids): catalogue_slice = deepcopy(catalogue) in_slice = catalogue_slice.data[slice_key] == slice_id catalogue_slice.select_catalogue_events(in_slice) model = Stepp1971() model.completeness(catalogue_slice, comp_config) model.simplify(deduplicate, mag_range, year_range) slice_completeness_tables.append(model.completeness_table.tolist()) annotate('%s %d' % (slice_key, slice_id), loc='upper left', ax=ax) plot_stepp_1972.create_stepp_plot(model, ax=ax) return fig, slice_completeness_tables
def setUp(self): '''Set up the test class''' self.catalogue = None self.process = Stepp1971() self.config = {'time_bin': None}