Skip to content
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

Smoothing with 3D #67

Open
matthew-w-lundy opened this issue Nov 1, 2024 · 0 comments
Open

Smoothing with 3D #67

matthew-w-lundy opened this issue Nov 1, 2024 · 0 comments

Comments

@matthew-w-lundy
Copy link
Collaborator

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'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant