Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic facilities for 3D background irfs #276

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Tobychev
Copy link
Contributor

Add functions for making a 3D background using square bins, this requires that the event tables have the two columns reco_fov_lat and reco_fov_lon.

Copy link

codecov bot commented Jan 16, 2024

Codecov Report

Attention: Patch coverage is 15.62500% with 27 lines in your changes missing coverage. Please review.

Project coverage is 94.83%. Comparing base (cb92eef) to head (7c6d158).
Report is 11 commits behind head on main.

Files Patch % Lines
pyirf/io/gadf.py 12.50% 14 Missing ⚠️
pyirf/irf/background.py 13.33% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #276      +/-   ##
==========================================
- Coverage   95.60%   94.83%   -0.78%     
==========================================
  Files          62       62              
  Lines        3278     3308      +30     
==========================================
+ Hits         3134     3137       +3     
- Misses        144      171      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

def create_background_3d_hdu(
background_3d,
reco_energy_bins,
fov_offset_bins,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have fov_lon_bins / fov_lat_bins

background_3d,
reco_energy_bins,
fov_offset_bins,
extname="BACKGROUND",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to define the alignment

header["HDUCLAS2"] = "BKG"
header["HDUCLAS3"] = "FULL-ENCLOSURE"
header["HDUCLAS4"] = "BKG_2D"
header["FOVALIGN"] = "ALTAZ"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an argument, not hard-coded

@maxnoe maxnoe mentioned this pull request Feb 19, 2024
per_energy = (hist.T / bin_width_energy).T

# divide by solid angle in each fov bin and the observation time
bin_solid_angle = np.diff(fov_offset_bins)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solid angle of the bins is not just the difference of the bin edges.

@luca-dib implemented the proper code here: #281 but it's not yet a proper function there but just computed inline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants