Skip to content

Commit

Permalink
fix(background_models): changing parallel backend to ray
Browse files Browse the repository at this point in the history
  • Loading branch information
steob92 committed Aug 12, 2024
1 parent f06c783 commit 562c8a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ services:
dockerfile: Dockerfile
ports:
# Modify port as needed
# Jupyter runs on 8888
- "8888:8888"
# Ray dashboard runs on 8265
- "8265:8265"
environment:
- JUPYTER_TOKEN=letmein
volumes:
Expand Down
7 changes: 5 additions & 2 deletions gammapy_tools/make_background/background_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import numpy as np
from scipy.ndimage import gaussian_filter
from multiprocess import Pool
# from multiprocess import Pool
import ray
from ray import Pool

# Astropy stuff

Expand Down Expand Up @@ -51,7 +53,8 @@ def __init__(
None
"""


ray.init()
self.njobs = njobs
self.counts = self._make_bkg2d(energy, offset, unit="")
self.exposure = self._make_bkg2d(energy, offset, unit="s TeV sr")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies = [
"PyYAML",
"regions",
"tqdm",
"ray[default]",
]

[project.optional-dependencies]
Expand Down

0 comments on commit 562c8a0

Please sign in to comment.