I just received an error by running the electromagnetic_demo.py
RESTART: E:\Documents\PyParticles\PyParticles\pyparticles\demo\electromagnetic_demo.py
Traceback (most recent call last):
File "E:\Documents\PyParticles\PyParticles\pyparticles\demo\electromagnetic_demo.py", line 128, in
electromag_field()
File "E:\Documents\PyParticles\PyParticles\pyparticles\demo\electromagnetic_demo.py", line 78, in electromag_field
elmag = elmf.ElectromagneticField( pset.size , dim=pset.dim , m=pset.M , q=pset.Q )
File "C:\Users\Raffael\AppData\Local\Programs\Python\Python37\lib\site-packages\pyparticles\forces\electromagnetic_field.py", line 55, in init
if m != None :
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The problem seems to be the the electromagnetic_field.py. -> I just solved it by change line 55 from:
if m != None :
to:
if m is not None :
and the same on line 56...
from:
if q != None :
to:
if q is not None :
This works now fine.
By the way i am using python 3.7.2 and numpy version 1.16.0
Same thing happens in a lot of other places too with "!= None" or "== None". Easy fix as suggested by hakkimakki is to replace all occurrences with "is not None" and "is None".
I just received an error by running the electromagnetic_demo.py
RESTART: E:\Documents\PyParticles\PyParticles\pyparticles\demo\electromagnetic_demo.py Traceback (most recent call last): File "E:\Documents\PyParticles\PyParticles\pyparticles\demo\electromagnetic_demo.py", line 128, in
electromag_field()
File "E:\Documents\PyParticles\PyParticles\pyparticles\demo\electromagnetic_demo.py", line 78, in electromag_field
elmag = elmf.ElectromagneticField( pset.size , dim=pset.dim , m=pset.M , q=pset.Q )
File "C:\Users\Raffael\AppData\Local\Programs\Python\Python37\lib\site-packages\pyparticles\forces\electromagnetic_field.py", line 55, in init
if m != None :
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The problem seems to be the the electromagnetic_field.py. -> I just solved it by change line 55 from: if m != None : to: if m is not None : and the same on line 56... from: if q != None : to: if q is not None :
This works now fine.
By the way i am using python 3.7.2 and numpy version 1.16.0