-
Notifications
You must be signed in to change notification settings - Fork 194
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
Improve SkyCube convolution and npred computation #766
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few inline comments.
Overall the changes look good, but are too large for me to review in detail this week.
So thank you very much for this cleanup and new features. It's great that you pushed on this and now get agreement with the Fermi ST!
energy_axis = LogEnergyAxis(energy, mode='edges') | ||
elif mode == 'center': | ||
energy = Energy.equal_log_spacing(emin, emax, enumbins, eunit) | ||
energy_axis = LogEnergyAxis(energy, mode='center') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please always end with
else:
raise ValueError(...)
for multiple-choice based on user string input.
It really helps to get a good error message when you mistype something.
2-dim sky image | ||
""" | ||
data = self.data[idx] | ||
return SkyImage(name=self.name, data=data, wcs=self.wcs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return copy for data and wcs, at least by default, to avoid accidentally coupled objects?
(I thought we had that method already, didn't review the SkyCube class again. Just ignore me if this is not a good suggestion)
Parameters | ||
---------- | ||
kernels : list | ||
List of 2D convolution kernels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are kernels? Numpy arrays? Astropy kernel objects?
Above you say:
Convolve cube with a given energy dependent PSF.
which suggests the input would be such a PSF object, which I guess it isn't?
Can you make this more clear in the docstring or put an example here or in the high-level docs and link to it from here?
Returns | ||
------- | ||
kernels : list | ||
List of 2D image kernels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Say what type of object the kernels are.
Reference sky cube. | ||
kwargs : dict | ||
Keyword arguments passed to | ||
`EnergyDependentTablePSF.table_psf_in_energy_band()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this resolve as a Sphinx link in the HTML docs?
4f75afd
to
6a1272c
Compare
@cdeil Thanks! I've addressed all your comments and will merge as soon as Travis-CI passed. |
b317bfe
to
e7ece72
Compare
This is the third part of the major
SkyCube
rework. These are the most important changes in this PR:convolve_cube
function toSkyCube.convolve()
cube_to_spec
function toSkyCube.to_spectrum
, but currently not working.EnergyDependentTablePSF.kernels()
method to get a set of kernels for cube convolutioncompute_npred_cube
functionWhen running the script
docs/tutorials/npred/npred_convolved.py
, I get very good agreement with the result from the fermi science tools. The total number of counts agrees within >1%, depending on the precision of the flux image integration.