Add XML SkyModel serialization #1397
Conversation
@joleroi - Thanks! I think my preference would be to do this:
and basically have this:
It's close to what you put here, but it
|
I'm -1 on |
We've had these discussions before. "List" shouldn't be in the name if it's not a list, but a wrapper that doesn't really expose the list API (like slicing, ...). My preference would be |
No need to argue about not subclassing
Also agreed, I will thing about a name, and fall back to |
<parameter free="0" max="1" min="-1" name="Index" scale="1.0" value="0"></parameter> | ||
<parameter free="0" max="2e2" min="5e1" name="Scale" scale="1.0" value="1e2"></parameter> | ||
</spectrum> | ||
<spatialModel file="$GAMMAPY_EXTRA/datasets/fermi_iem/gll_iem_v02.fit" type="MapCubeFunction"> |
joleroi
Apr 26, 2018
Author
Contributor
I didn't push anything to gammapy-extra
yet. This old version of the diffuse model is ~30 MB. OK to add? Or do you have a better idea for a test case?
I didn't push anything to gammapy-extra
yet. This old version of the diffuse model is ~30 MB. OK to add? Or do you have a better idea for a test case?
cdeil
Apr 26, 2018
Member
There is e.g. gammapy-extra/test_datasets/unbundled/fermi/gll_iem_v02_cutout.fits
.
Let's not add a 30 MB file.
IMO even better would be to not use data files if not really needed, and instead create the file in a temp folder in the text with a few lines.
With gammapy.maps
it's now easy to make any kind of map; for example:
https://github.com/gammapy/gammapy/blob/master/gammapy/cube/tests/test_models.py#L14
There is e.g. gammapy-extra/test_datasets/unbundled/fermi/gll_iem_v02_cutout.fits
.
Let's not add a 30 MB file.
IMO even better would be to not use data files if not really needed, and instead create the file in a temp folder in the text with a few lines.
With gammapy.maps
it's now easy to make any kind of map; for example:
https://github.com/gammapy/gammapy/blob/master/gammapy/cube/tests/test_models.py#L14
joleroi
Apr 27, 2018
Author
Contributor
👍
sourcelib = SourceLibrary.from_xml(filename) | ||
assert len(sourcelib.skymodels) == 4 | ||
|
||
# TODO: add more tests |
joleroi
Apr 26, 2018
Author
Contributor
This will be part of this PR
This will be part of this PR
This PR adds support for XML serialisation of sky models.