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

Implement Map broadcasting #3570

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

Conversation

adonath
Copy link
Member

@adonath adonath commented Nov 3, 2021

Description

This pull request implements the support for broadcasting when doing map arithmetics. It include the following methods:

  • MapAxis.broadcast(), which returns the broadcasted axis dimension, i.e. the max of the len of the axis, when either both axes are equal or one of them has exactly one bin.
  • MapAxes.broadcast(), which follow bumpy broadcasting rules.
  • Geom.broadcast(), does broadcasting of the extra axes and requires the spatial dimension to be equivalent.

Dear reviewer
Todo:

  • Implement broadcasting arithmetics unit tests
  • Extend the maps.ipynb tutorial

@adonath adonath self-assigned this Nov 3, 2021
@adonath adonath added the feature label Nov 3, 2021
@adonath adonath added this to To do in gammapy.maps via automation Nov 3, 2021
@adonath adonath added this to the v0.19 milestone Nov 3, 2021
@codecov
Copy link

codecov bot commented Nov 3, 2021

Codecov Report

Merging #3570 (68540e5) into master (9623be1) will decrease coverage by 0.01%.
The diff coverage is 93.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3570      +/-   ##
==========================================
- Coverage   93.87%   93.86%   -0.02%     
==========================================
  Files         159      159              
  Lines       19216    19243      +27     
==========================================
+ Hits        18039    18062      +23     
- Misses       1177     1181       +4     
Impacted Files Coverage Δ
gammapy/maps/geom.py 82.48% <87.50%> (+0.49%) ⬆️
gammapy/maps/axes.py 92.58% <94.73%> (+0.03%) ⬆️
gammapy/maps/core.py 88.59% <100.00%> (+0.13%) ⬆️
gammapy/maps/region/ndmap.py 93.23% <100.00%> (-0.13%) ⬇️
gammapy/maps/wcs/ndmap.py 91.45% <100.00%> (ø)
gammapy/maps/wcs/geom.py 96.03% <0.00%> (-0.24%) ⬇️
gammapy/maps/hpx/geom.py 88.13% <0.00%> (-0.17%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9623be1...68540e5. Read the comment docs.

@adonath adonath modified the milestones: v0.19, 1.1 Nov 5, 2021
@registerrier
Copy link
Contributor

@adonath what is the status here?
Can this be rebased ? Can it be done for v1.1?

@adonath
Copy link
Member Author

adonath commented Apr 24, 2023

@registerrier No, I think this will require more discussion on the actual behavior. E.g. if positions of axes do not align etc. Let's postpone...

@registerrier registerrier modified the milestones: 1.1, 1.2 Apr 24, 2023
@registerrier
Copy link
Contributor

Hi @adonath . What is the status here?

@registerrier registerrier modified the milestones: 1.2, 1.3 Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
gammapy.maps
  
To do
Development

Successfully merging this pull request may close these issues.

None yet

2 participants