amusecode / amuse

Astrophysical Multipurpose Software Environment. This is the main repository for AMUSE
http://www.amusecode.org
Apache License 2.0
158 stars 99 forks source link

kira.py issue with python3 #580

Closed rieder closed 2 years ago

rieder commented 4 years ago

As reported by @GiacobboNicola in the AMUSE slack

As you know, Giuliano and I worked with Kira.py last week. Here's a brief summary of what we found. We used the latest version of kira.py (available in repo github and reported here) with both python2 ('old' amuse) and python3 (latest version of amuse). In particular, with python2 the script works without problems while using python3 you get the following error: Traceback (most recent call last): File "/home/iorio/Software/amuse/src/amuse/datamodel/particle_attributes.py", line 538, in densitycentre_coreradius_coredens hop.particles.add_particles(particles) File "/home/iorio/Software/amuse/src/amuse/datamodel/particles.py", line 625, in add_particles self.add_particles_to_store(keys, attributes, converted) File "/home/iorio/Software/amuse/src/amuse/datamodel/particles.py", line 1333, in add_particles_to_store self._private.attribute_storage.add_particles_to_store(keys, attributes, values) File "/home/iorio/Software/amuse/src/amuse/datamodel/incode_storage.py", line 842, in add_particles_to_store raise Exception("particle with same key added twice: {0}".format(key)) Exception: particle with same key added twice: 791037137252728813 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "kira.py", line 286, in kira(options.tend,100,options.R, 50) File "kira.py", line 240, in kira multiples_code.all_singles.LagrangianRadii(converter))) File "/home/iorio/Software/amuse/src/amuse/datamodel/base.py", line 491, in call return self._function(self.particles, *list_arguments, *keyword_arguments) File "/home/iorio/Software/amuse/src/amuse/datamodel/particle_attributes.py", line 698, in LagrangianRadii reuse_hop=reuse_hop, hop=hop File "/home/iorio/Software/amuse/src/amuse/datamodel/base.py", line 491, in call return self._function(self.particles, list_arguments, **keyword_arguments) File "/home/iorio/Software/amuse/src/amuse/datamodel/particle_attributes.py", line 541, in densitycentre_coreradius_coredens raise exceptions.AmuseException(str(ex)+" (note: check whether Hop needs a converter here)") amuse.support.exceptions.AmuseException: particle with same key added twice: 791037137252728813 (note: check whether Hop needs a converter here) (edited)

rieder commented 4 years ago

I can't reproduce this error myself. When I run the kira.py example with AMUSE framework 13.0.1 and python 3.8, I get no errors.

ipelupessy commented 4 years ago

any particluar way to start the script? from the above it may be connected with the hop initialization for calculation of the densitycenter/ lagrangian radii..but that is just a wild guess..

ipelupessy commented 4 years ago

I can reproduce this (no time to fully debug atm...)

rieder commented 4 years ago

What is needed to reproduce it?

giulianoiorio commented 4 years ago

I obtained this error with AMUSE framework 13.0.1 and python 3.7. However, I think it is unlikely that the few changes between the two Python versions can be the cause. I will try to run it with python 3.8 asap.

rieder commented 4 years ago

I agree that sounds unlikely. Did you just run 'python kira.py'?

ipelupessy commented 4 years ago

for me, just running the script (using python 3.7.3)..it seems multiples is generating sets with duplicate particles...

rieder commented 4 years ago

Ok, I can also reproduce it now (Python 3.5.3). Perhaps @stevemcmillan or @spzwart could investigate?

rieder commented 4 years ago

The script crashes with the above error for me on a Linux machine. On macOS, it just freezes at some point (unclear to me if this is at the same time). edit: it didn't freeze, it just took a loooooong time to continue apparently... Still waiting to see if it will crash.

giulianoiorio commented 4 years ago

The script crashes with the above error for me on a Linux machine. On macOS, it just freezes at some point (unclear to me if this is at the same time). edit: it didn't freeze, it just took a loooooong time to continue apparently... Still waiting to see if it will crash.

Same for me in macOS with python 3.7.

spzwart commented 4 years ago

Steve McMillan and I are working on the multiples module. This should make kira.py more stable, better readable, etc.

rieder commented 4 years ago

Great!

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

ipelupessy commented 2 years ago

fixed?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

ipelupessy commented 2 years ago

needs to be checked

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.

ipelupessy commented 2 years ago

reopen if necessary