CRPropa / CRPropa3

CRPropa is a public astrophysical simulation framework for propagating extraterrestrial ultra-high energy particles. https://crpropa.github.io/CRPropa3/
https://crpropa.desy.de
GNU General Public License v3.0
71 stars 69 forks source link

Issue with EMPairProduction and other EM modules #317

Closed ke-fang closed 3 years ago

ke-fang commented 3 years ago

Describe the bug EMPairProduction fails to run. Seems to be an issue related to SWIG wrapper.

from crpropa import *
sim = ModuleList()
sim.add(SimplePropagation())
sim.add(Redshift())
sim.add(EMPairProduction(CMB,True))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "$home/CRPropa3/install/lib/python2.7/site-packages/crpropa/crpropa.py", line 7711, in __init__
    _crpropa.EMPairProduction_swiginit(self, _crpropa.new_EMPairProduction(photonField, haveElectrons, thinning, limit))
TypeError: Wrong number or type of arguments for overloaded function 'new_EMPairProduction'.
  Possible C/C++ prototypes are:
    crpropa::EMPairProduction::EMPairProduction(crpropa::ref_ptr< crpropa::PhotonField >,bool,double,double)
    crpropa::EMPairProduction::EMPairProduction(crpropa::ref_ptr< crpropa::PhotonField >,bool,double)
    crpropa::EMPairProduction::EMPairProduction(crpropa::ref_ptr< crpropa::PhotonField >,bool)
    crpropa::EMPairProduction::EMPairProduction(crpropa::ref_ptr< crpropa::PhotonField >)

System (please complete the following information):

rafaelab commented 3 years ago

Hi Ke,

This change was introduced in the 3.1.6 release.
Now the photon fields should be called with parentheses: CMB(), IRB_Gilmore12(), etc. The idea is to have a container that enables custom photon fields in the future.

Please let me know if this works.

ke-fang commented 3 years ago

That worked. Thanks, Rafa!