Skip to content

Commit aaaa4cd

Browse files
committed
Preparation for 0.5.0 release - versions and dependencies bump (require python 3.11 and astropy 7.0)
1 parent 5e3e1b3 commit aaaa4cd

File tree

8 files changed

+23
-37
lines changed

8 files changed

+23
-37
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: ["3.9", "3.10", "3.11"]
15+
python-version: ["3.11", "3.12", "3.13"]
1616

1717
steps:
1818
- uses: actions/checkout@v3

.zenodo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@
7979
],
8080
"title": "agnpy",
8181
"upload_type": "software",
82-
"version": "0.4.0"
82+
"version": "0.5.0"
8383
}

agnpy/fit/data.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ def load_gammapy_flux_points(sed_path, E_min, E_max, systematics_dict=None):
130130
dataset = FluxPointsDataset(data=data, name=name)
131131

132132
# set the minimum energy to be used for the fit
133-
mask = (dataset.data.energy_ref >= E_min) * (dataset.data.energy_ref <= E_max)
134-
dataset.mask_fit = mask
133+
dataset.mask_fit = dataset.data.geom.energy_mask(energy_min=E_min, energy_max=E_max)
135134

136135
datasets.append(dataset)
137136

agnpy/fit/gammapy_wrapper.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def __init__(self, n_e, ssa=False):
134134
self._emission_region_pars_names = list(emission_region_pars.keys())
135135

136136
# group the model parameters, add the norm at the bottom of the list
137-
norm = Parameter("norm", 1, min=0.1, max=10, is_norm=True, frozen=True)
137+
norm = Parameter("norm", 1, min=0.1, max=10, frozen=True)
138138
self.default_parameters = Parameters(
139139
[*spectral_pars.values(), *emission_region_pars.values(), norm]
140140
)
@@ -163,7 +163,7 @@ def evaluate(self, energy, **kwargs):
163163
NOTE: All the model parameters will be passed as kwargs by
164164
SpectralModel.evaluate()."""
165165

166-
nu = energy.to("Hz", equivalencies=u.spectral())
166+
nu = energy.reshape([energy.shape[0]]).to("Hz", equivalencies=u.spectral())
167167

168168
args = _sort_spectral_parameters(self._spectral_pars_names, self._n_e, **kwargs)
169169
z, d_L, delta_D, B, R_b = _sort_emission_region_parameters("ssc", **kwargs)
@@ -180,15 +180,8 @@ def evaluate(self, energy, **kwargs):
180180
)
181181
sed = sed_synch + sed_ssc
182182

183-
# to avoid the problem pointed out in
184-
# https://github.com/cosimoNigro/agnpy/issues/117
185-
# we can do here something like
186-
# sed = sed.reshape(energy.shape)
187-
# this is done in Gammapy's `NaimaSpectralModel`
188-
# https://github.com/gammapy/gammapy/blob/master/gammapy/modeling/models/spectral.py#L2119
189-
190183
# gammapy requires a differential flux in input
191-
return (sed / energy**2).to("1 / (cm2 eV s)")
184+
return (sed.reshape(energy.shape) / energy**2).to("1 / (cm2 eV s)")
192185

193186

194187
class ExternalComptonSpectralModel(SpectralModel):
@@ -234,7 +227,7 @@ def __init__(self, n_e, targets, ssa=False):
234227
self._targets_pars_names = list(targets_pars.keys())
235228

236229
# group the model parameters, add the norm at the bottom of the list
237-
norm = Parameter("norm", 1, min=0.1, max=10, is_norm=True, frozen=True)
230+
norm = Parameter("norm", 1, min=0.1, max=10, frozen=True)
238231
self.default_parameters = Parameters(
239232
[
240233
*spectral_pars.values(),
@@ -295,8 +288,7 @@ def evaluate(self, energy, **kwargs):
295288
"""Evaluate the SED model.
296289
NOTE: All the model parameters will be passed as kwargs by
297290
SpectralModel.evaluate()."""
298-
299-
nu = energy.to("Hz", equivalencies=u.spectral())
291+
nu = energy.reshape([energy.shape[0]]).to("Hz", equivalencies=u.spectral())
300292

301293
args = _sort_spectral_parameters(self._spectral_pars_names, self._n_e, **kwargs)
302294
z, d_L, delta_D, B, R_b, mu_s, r = _sort_emission_region_parameters(
@@ -365,9 +357,4 @@ def evaluate(self, energy, **kwargs):
365357
)
366358
sed += sed_bb_dt
367359

368-
# eventual reshaping
369-
# we can do here something like
370-
# sed = sed.reshape(energy.shape)
371-
# see the same comment in the SSC model
372-
373-
return (sed / energy**2).to("1 / (cm2 eV s)")
360+
return (sed.reshape(energy.shape) / energy**2).to("1 / (cm2 eV s)")

codemeta.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"dateModified": "2023-02-12",
88
"codeRepository": "https://github.com/cosimoNigro/agnpy",
99
"issueTracker": "https://github.com/cosimoNigro/agnpy/issues",
10-
"downloadUrl": "https://github.com/cosimoNigro/agnpy/releases/tag/v0.4.0",
10+
"downloadUrl": "https://github.com/cosimoNigro/agnpy/releases/tag/v0.5.0",
1111
"name": "agnpy",
12-
"version": "0.4.0",
12+
"version": "0.5.0",
1313
"identifier": "10.5281/zenodo.4055175",
1414
"description": "agnpy is a python package focusing on the computation of the radiative processes of relativistic particles accelerated in the jets of Active Galactic Nuclei (AGN). It includes classes describing the galaxy components responsible for line and thermal emission and calculates the absorption due to gamma-gamma pair production on soft (IR-UV) photon fields.",
1515
"applicationCategory": "Astronomy",
@@ -18,7 +18,7 @@
1818
"isPartOf": "https://www.astropy.org/affiliated/",
1919
"referencePublication": "https://doi.org/10.1051/0004-6361/202142000",
2020
"readme": "https://agnpy.readthedocs.io/en/latest/",
21-
"softwareVersion": "0.4.0",
21+
"softwareVersion": "0.5.0",
2222
"funder": {
2323
"@type": "Organization",
2424
"name": "European Union's Horizon 2020 research and innovation programme"

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = "Cosimo Nigro"
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = "0.4.0"
25+
release = "0.5.0"
2626

2727

2828
# -- General configuration ---------------------------------------------------

environment.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ channels:
55
- sherpa
66

77
dependencies:
8-
- python>=3.9,<3.12
9-
- astropy>=5.0,<6.0
10-
- numpy>=1.21
8+
- python>=3.11,<3.14
9+
- astropy>=7.0
10+
- numpy>=1.24,<2.3
1111
- pandas>=1.5
12-
- scipy>=1.5,<1.10
13-
- pyyaml # needed to read astropy ecsv file
14-
- matplotlib>=3.4,<=3.9
12+
- scipy>=1.14
13+
- pyyaml>=6.0 # needed to read astropy ecsv file
14+
- matplotlib>=3.9.1
1515
- sherpa
1616
- pre-commit
17-
- gammapy<1.2
17+
- gammapy>=1.3

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="agnpy",
8-
version="0.4.0",
8+
version="0.5.0",
99
author="Cosimo Nigro",
1010
author_email="cosimonigro2@gmail.com.com",
1111
description="Modelling jetted Active Galactic Nuclei radiative processes with python",
@@ -20,6 +20,6 @@
2020
"License :: OSI Approved :: BSD License",
2121
"Operating System :: OS Independent",
2222
],
23-
install_requires=["astropy>=5.0,<6.0", "numpy>=1.21", "pandas>=1.5", "scipy>=1.5,<1.10", "pyyaml", "matplotlib>=3.4,<=3.9", "sherpa", "pre-commit", "gammapy<1.2"],
24-
python_requires=">=3.9,<3.12",
23+
install_requires=["astropy>=7.0", "numpy>=1.24,<2.3", "pandas>=1.5", "scipy>=1.14", "pyyaml>=6.0", "matplotlib>=3.9.1", "sherpa", "pre-commit", "gammapy>=1.3"],
24+
python_requires=">=3.11,<3.14",
2525
)

0 commit comments

Comments
 (0)