Skip to content

Instantly share code, notes, and snippets.

@cdeil
Created June 5, 2016 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdeil/f01065eda3493dea7ba20c9e62d2c66e to your computer and use it in GitHub Desktop.
Save cdeil/f01065eda3493dea7ba20c9e62d2c66e to your computer and use it in GitHub Desktop.
_____________________________________________________ test_spectrum_extraction_from_config ______________________________________________________
tmpdir = local('/private/var/folders/sb/4qv5j4m90pz1rw7m70rj1b1r0000gn/T/pytest-of-deil/pytest-7/test_spectrum_extraction_from_0')
@requires_dependency('scipy')
@requires_data('gammapy-extra')
def test_spectrum_extraction_from_config(tmpdir):
configfile = gammapy_extra.filename(
'test_datasets/spectrum/spectrum_analysis_example.yaml')
config = read_yaml(configfile)
> target = Target.from_config(config)
gammapy/spectrum/tests/test_spectrum_extraction.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'gammapy.data.target.Target'>
config = {'extraction': {'binning': {'emax': '300 TeV', 'emin': '10 GeV', 'equal_log_spacing': True, 'nbins': 100}, 'data': {'d...sion.fits'}, 'off_region': {'min_distance': '0.02 rad', 'n_min': 1, 'type': 'reflected'}, ...}, 'fit': {'model': 'PL'}}
@classmethod
def from_config(cls, config):
"""Initialize target from config
The config dict is stored as attribute for later use by other analysis
classes.
"""
> obs_id = config['obs']
E KeyError: 'obs'
gammapy/data/target.py:116: KeyError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment