Skip to content

Commit

Permalink
Merge branch 'master' into fix_energy_integral
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Oct 1, 2020
2 parents 12119c8 + 1224aca commit 5bb9e0d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pyirf/io/eventdisplay.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from astropy.table import QTable
import logging

from astropy.table import QTable, unique
import astropy.units as u

from ..simulations import SimulatedEventsInfo

import logging
import numpy as np


log = logging.getLogger(__name__)

Expand Down Expand Up @@ -45,16 +44,17 @@ def read_eventdisplay_fits(infile):
"""
log.debug(f"Reading {infile}")
events_table = QTable.read(infile, hdu="EVENTS")
events = QTable.read(infile, hdu="EVENTS")
sim_events = QTable.read(infile, hdu="SIMULATED EVENTS")
run_header = QTable.read(infile, hdu="RUNHEADER")[0]

events = QTable({new: events_table[old] for new, old in COLUMN_MAP.items()})
for new, old in COLUMN_MAP.items():
events.rename_column(old, new)

n_runs = len(np.unique(events["obs_id"]))
log.info(f"Estimated number of runs from obs ids: {n_runs}")
n_runs = len(unique(events[['obs_id', 'pointing_az', 'pointing_alt']]))
log.info(f"Estimated number of runs from obs ids and pointing position: {n_runs}")

n_showers = run_header["num_showers"] * run_header["num_use"] * n_runs
n_showers = n_runs * run_header["num_use"] * run_header["num_showers"]
log.debug(f"Number of events from n_runs and run header: {n_showers}")
log.debug(f'Number of events histogram: {sim_events["EVENTS"].sum()}')

Expand Down

0 comments on commit 5bb9e0d

Please sign in to comment.