Created
September 26, 2019 14:01
-
-
Save cdeil/4ad273ad8a41cbc0f3d72b312056042e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================================================================================ FAILURES ================================================================================ | |
______________________________________________________________________________ test_complex ______________________________________________________________________________ | |
xml = OrderedDict([('@type', 'PowerLaw'), ('parameter', [OrderedDict([('@free', '1'), ('@max', '1000.0'), ('@min', '0.001'),...[('@free', '0'), ('@max', '2000.0'), ('@min', '30.0'), ('@name', 'Scale'), ('@scale', '1.0'), ('@value', '100.0')])])]) | |
which = 'spectral' | |
def xml_to_model(xml, which): | |
""" | |
Convert XML to `~gammapy.modeling.models.SpatialModel` or | |
`~gammapy.modeling.models.SpectralModel` | |
""" | |
type_ = xml["@type"] | |
try: | |
> model = model_registry[which][type_]["model"] | |
E KeyError: 'PowerLaw' | |
gammapy/modeling/serialize_xml.py:186: KeyError | |
During handling of the above exception, another exception occurred: | |
@requires_data() | |
def test_complex(): | |
filename = "$GAMMAPY_DATA/tests/models/examples.xml" | |
> sourcelib = SkyModels.read(filename) | |
gammapy/modeling/tests/test_serialize_xml.py:50: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
gammapy/modeling/models/cube.py:108: in read | |
return cls.from_xml(xml) | |
gammapy/modeling/models/cube.py:90: in from_xml | |
return xml_to_sky_models(xml) | |
gammapy/modeling/serialize_xml.py:156: in xml_to_sky_models | |
skymodel = xml_to_skymodel(xml_skymodel) | |
gammapy/modeling/serialize_xml.py:174: in xml_to_skymodel | |
spectral = xml_to_model(xml["spectrum"], "spectral") | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
xml = OrderedDict([('@type', 'PowerLaw'), ('parameter', [OrderedDict([('@free', '1'), ('@max', '1000.0'), ('@min', '0.001'),...[('@free', '0'), ('@max', '2000.0'), ('@min', '30.0'), ('@name', 'Scale'), ('@scale', '1.0'), ('@value', '100.0')])])]) | |
which = 'spectral' | |
def xml_to_model(xml, which): | |
""" | |
Convert XML to `~gammapy.modeling.models.SpatialModel` or | |
`~gammapy.modeling.models.SpectralModel` | |
""" | |
type_ = xml["@type"] | |
try: | |
model = model_registry[which][type_]["model"] | |
except KeyError: | |
> raise UnknownModelError(f"{which} model {type_!r} not registered") | |
E gammapy.modeling.serialize_xml.UnknownModelError: spectral model 'PowerLaw' not registered | |
gammapy/modeling/serialize_xml.py:188: UnknownModelError | |
__________________________________________________________________________ test_datasets_to_io ___________________________________________________________________________ | |
tmpdir = local('/private/var/folders/t_/_mywtcj146lbk2c99bnxw7z40000gp/T/pytest-of-deil/pytest-86/test_datasets_to_io0') | |
@requires_data() | |
def test_datasets_to_io(tmpdir): | |
filedata = "$GAMMAPY_DATA/tests/models/gc_example_datasets.yaml" | |
filemodel = "$GAMMAPY_DATA/tests/models/gc_example_models.yaml" | |
> datasets = Datasets.from_yaml(filedata, filemodel) | |
gammapy/modeling/tests/test_serialize_yaml.py:106: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
gammapy/modeling/datasets.py:171: in from_yaml | |
constructor = dict_to_datasets(data_list, components) | |
gammapy/modeling/serialize.py:141: in __init__ | |
self.models = dict_to_models(components) | |
gammapy/modeling/serialize.py:74: in dict_to_models | |
model = SkyModel.from_dict(component) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
cls = <class 'gammapy.modeling.models.cube.SkyModel'> | |
data = {'name': 'gc', 'spatial': {'frame': 'galactic', 'parameters': [{'frozen': False, 'name': 'lon_0', 'unit': 'deg', 'valu...': False, 'name': 'lambda_', 'unit': 'TeV-1', 'value': 0.1}], 'type': 'ExponentialCutoffPowerLaw'}, 'type': 'SkyModel'} | |
@classmethod | |
def from_dict(cls, data): | |
"""Create SkyModel from dict""" | |
from gammapy.modeling.models import SPATIAL_MODELS, SPECTRAL_MODELS | |
> model_class = SPECTRAL_MODELS[data["spectral"]["type"]] | |
E KeyError: 'ExponentialCutoffPowerLaw' | |
gammapy/modeling/models/cube.py:317: KeyError | |
===================================================== 2 failed, 1429 passed, 2 skipped, 5 xfailed in 174.13 seconds ====================================================== | |
make: *** [test] Error 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment