Skip to content

Smoothing with 3D  #67

@matthew-w-lundy

Description

@matthew-w-lundy

Running with

config['io']['3d_bkg'] = True

and

config['background_selection']['smooth'] = True

results in the following error when running:

config = run_make_background(config)

 RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "[/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/multiprocessing/pool.py", line 125](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/multiprocessing/pool.py#line=124), in worker
    result = (True, func(*args, **kwds))
  File "[/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/multiprocessing/pool.py", line 48](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/multiprocessing/pool.py#line=47), in mapstar
    return list(map(*args))
  File "[/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy_tools/make_background/make_background.py", line 184](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy_tools/make_background/make_background.py#line=183), in get_background_for_run
    hdul.append(estimator.background_rate.to_table_hdu())
  File "[/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy_tools/make_background/background_models.py", line 393](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy_tools/make_background/background_models.py#line=392), in background_rate
    rate = smooth(rate, sigma=self.smooth_sigma)
  File "[/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy_tools/make_background/background_models.py", line 415](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy_tools/make_background/background_models.py#line=414), in smooth
    offset = bkg.axes['offset'].center.value
  File "[/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy/maps/axes.py", line 1821](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy/maps/axes.py#line=1820), in __getitem__
    raise KeyError(f"No axes: {idx!r}")
KeyError: "No axes: 'offset'"
"""

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
Cell In[61], line 1
----> 1 config = run_make_background(config)

File [~/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy_tools/make_background/make_background.py:450](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/site-packages/gammapy_tools/make_background/make_background.py#line=449), in run_make_background(config)
    448     map_fn = get_background_for_run
    449     with Pool(1) as pool:
--> 450         output = pool.map(map_fn, obs_parameters)
    452 if from_run:
    453     flist = output

File [~/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/multiprocessing/pool.py:364](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/multiprocessing/pool.py#line=363), in Pool.map(self, func, iterable, chunksize)
    359 def map(self, func, iterable, chunksize=None):
    360     '''
    361     Apply `func` to each element in `iterable`, collecting the results
    362     in a list that is returned.
    363     '''
--> 364     return self._map_async(func, iterable, mapstar, chunksize).get()

File [~/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/multiprocessing/pool.py:771](http://localhost:8888/home/matthew/anaconda3/envs/mamba/envs/gammapy1/lib/python3.10/multiprocessing/pool.py#line=770), in ApplyResult.get(self, timeout)
    769     return self._value
    770 else:
--> 771     raise self._value

KeyError: "No axes: 'offset'"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions