def make_total_event_list(): """Make total event list. TODO: move this function to the datastore class and the sky box selection to the `make_counts_image` function. """ data_store = DataStore(dir=HESSFITS_MPP) observation_selection = dict(type='sky_box', frame='galactic', lon=Quantity([-120, 70], 'deg'), lat=Quantity([-5, 5], 'deg'), border=Quantity(2, 'deg') ) observation_table = data_store.make_observation_table(observation_selection) # For testing, only process a small subset of observations # observation_table = observation_table.select_linspace_subset(num=1000) event_list_files = data_store.make_table_of_files(observation_table, filetypes=['events']) ds = EventListDataset.vstack_from_files(event_list_files['filename']) print('Total number of events: {}'.format(len(ds.event_list))) print('Total number of GTIs: {}'.format(len(ds.good_time_intervals))) print('Converting EventListDataset to HDUList ...') hdu_list = ds.to_fits() print('Writing {}'.format(TOTAL_EVENTS_FILE)) hdu_list.writeto(TOTAL_EVENTS_FILE, clobber=True)