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

Error on synchrotron from interplated distribution #161

Open
IlariaViale opened this issue Jul 16, 2024 · 1 comment
Open

Error on synchrotron from interplated distribution #161

IlariaViale opened this issue Jul 16, 2024 · 1 comment

Comments

@IlariaViale
Copy link
Collaborator

Hi all,

I was trying to compute the synchrotron emission from a distribution of electrons defined through the InterpolatedDistribution of agnpy.
However, at the line
sed_synch = synch.sed_flux(nu_grid) (where nu_grid = np.logspace(9, 27) * u.Hz)
I obtain the following error (I am using a jupyter notebook):

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[25], line 5
      2 nu_grid = np.logspace(9, 27) * u.Hz
      4 # compute a synchrotron, and a self-absorbed synchrotron SED
----> 5 sed_synch = synch.sed_flux(nu_grid)
      6 sed_synch_ssa = synch_ssa.sed_flux(nu_grid)

File /sw_fermipy/mambaforge/envs/agnpy-tutorial/lib/python3.9/site-packages/agnpy/synchrotron/synchrotron.py:231, in Synchrotron.sed_flux(self, nu)
    220 def sed_flux(self, nu):
    221     r"""Evaluates the synchrotron flux SED for a Synchrotron object built
    222     from a Blob."""
    223     return self.evaluate_sed_flux(
    224         nu,
    225         self.blob.z,
    226         self.blob.d_L,
    227         self.blob.delta_D,
    228         self.blob.B,
    229         self.blob.R_b,
    230         self.blob.n_e,
--> 231         *self.blob.n_e.parameters,
    232         ssa=self.ssa,
    233         integrator=self.integrator,
    234         gamma=self.blob.gamma_e,
    235     )

AttributeError: 'InterpolatedDistribution' object has no attribute 'parameters'

I obtain the same also when trying to compute sed_synch_ssa = synch_ssa.sed_flux(nu_grid), sed_ssc = ssc.sed_flux(nu_grid), and sed_ssc_ssa = ssc_ssa.sed_flux(nu_grid).

@cosimoNigro
Copy link
Owner

cosimoNigro commented Oct 8, 2024

Dear @IlariaViale,

I am very sorry for the late reply.
To me it's working without those errors.

Is there any chance that you are using an older version that does not contain the fixes in #145?
Seems to me the parameters attribute was added there.

Or maybe we did the latest release (that I assumed you installed via conda) before fixing this!
Using the dev version should fix this.

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

2 participants