Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add SkyDiffuseCube model for 3D maps #1634
@robertazanin - I figures out why the map inter_by_coord wasn't giving what we wanted yesterday.
First of all, for diffuse model cubes, we need to create an energy MapAxis with
Secondly, by default
Here's an example one can use to understand how it works. A cube with 2 pixels in energy, with value 10 at energy 1 TeV and value 20 at energy 100 TeV:
So the action items here are:
A second test case should be added where you actually read a diffuse model cube file.
@robertazanin - I'll leave this PR to you to finish up, or just come by on Monday and we do it together.
Just a few general comments maybe worth thinking about:
Why is it needed to introduce a new class for this? Can't the existing
For efficiency I would also strongly suggest to not interpolate in the
@adonath - What you suggest is not so easy. Note that the goal is to finish this today, I plan to work on this next. Basically I would suggest to postpone your suggestions to v0.9, unless you have a suggestion how to address these difficulties:
It probably could, but the evaluate argument handling might get complex. I think arbitrary extra axes in the model evaluation scheme will need much more thought and discussion and work.
Is fixing the geom on which one can evaluate on model init a good idea? It would mean special-casing model init for this one model to already pass a geom. So far our logic is that model evaluate is just on coords, not passed a geom.
How about we keep this model as-is, and then special-case it in the MapEvaluator. In my mind combining model and geom in a clever way it that class's responsibility. Although I have to admit I'm not sure it's clean and easy to do the caching of the interpolator or even pre-evaluated cube on a given geom there, i.e. to store that state on MapEvaluator.
@cdeil With taking a
The two suggestion I made above go along with each other and would greatly simplify the implementation. For now I would simplify the
So if we leave it up to the user or init to interpolate on a given geom, the evaluate becomes this, no?
I'm still wondering if that is a good idea. I was assuming such model eval caching for a given geom is done (for many models) by the
I'll come by later to discuss ...
I've fixed the coord handling in 824ef28 to match what the MapEvaluator passes.
This model now works with MapEvaluator. For the maps from analysis_3d.ipynb I find that the Galactic diffuse model produces 3567 counts. I'm not sure yet if that is correct, using
i.e. 4000 IEM events per run, so for 3 runs there should be 12,000 IEM events, a factor 3 more.
So maybe something is off, but I'd be inclined to merge now, to allow everyone using this and continue debugging in master.
I'm merging this in now.
@robertazanin and all - Please try it out and report any issues you find, or open a new issue or PR with suggestions to make this class better.
@adonath - You were right that it's slow. Especially for the 1DC diffuse model cube, which is 800 MB, an evaluate takes almost a second, and I presume that most of that time is spent in interpolator init, i.e. could be avoided by caching that. Making a cutout of the diffuse model is one way to improve speed for now.