Issue with Ramses + physical_units (Pynbody v1.2.3)

48 views
Skip to first unread message

Thor Tepper-Garcia

unread,
Sep 22, 2022, 4:11:45 AM9/22/22
to pynbody-users
Hi,

I have just updated my installation from 1.02 to 1.2.3 and ran into an issue right away.

When I load a Ramses output and do try to change to physical units like so:

>>> s = pynbody.load('output_00001')
>>> s.physical_units()

I get a lengthy error message that ends up with:

File "/Users/tepper/Library/Python/3.7/lib/python/site-packages/pynbody-1.2.3-py3.7-macosx-10.15-x86_64.egg/pynbody/units.py", line 505, in _expand

    self._scale *= b._scale ** p

ZeroDivisionError: 0.0 cannot be raised to a negative power

There is nothing wrong with the snapshot, as I was just using it without trouble prior to updating Pynbody. Any help and / or ideas how to solve this will be much appreciated!

Thor 

Andrew Pontzen

unread,
Sep 22, 2022, 4:15:01 AM9/22/22
to Thor Tepper-Garcia, pynbody-users
Sounds like a bug but please post a reproducible example with link to data so that it can be reproduced.

All the best

Andrew

--
You received this message because you are subscribed to the Google Groups "pynbody-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynbody-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pynbody-users/22ae45fe-f2a2-42dd-b037-4f40ad97232en%40googlegroups.com.

Tepper

unread,
Sep 22, 2022, 5:17:20 AM9/22/22
to Andrew Pontzen, pynbody-users
Hey Andrew,

Thanks a lot for your prompt reply.

Here are two Dropbox links, one to a short python script that reproduced the error, another to the (zipped) data used to illustrate the issue:

https://www.dropbox.com/s/epaatxy551zzipx/test.py?dl=0

https://www.dropbox.com/s/ry6w53pjw4kch2u/output_00001.zip?dl=0

Please let me know if anything else is needed.

Cheers

Thor

___________________________
Dr. Thor Tepper García
Astrophysicist
www.thorsten.mx
@thorsten_mx

Pontzen, Andrew

unread,
Sep 22, 2022, 3:36:45 PM9/22/22
to pynbody-users
Hi Thor,

No problem. Please could you check whether the following version solves your issue:


Regarding your other question, I think you will have no problem with the latest version of pynbody which natively reads part_file_descriptor.txt (overriding the config file which is only needed for older-format ramses files).

All the best,

Andrew


On 22 Sep 2022, at 10:17, Tepper <ttep...@gmail.com> wrote:

⚠ Caution: External sender



Hey Andrew,

Thanks a lot for your prompt reply.

Here are two Dropbox links, one to a short python script that reproduced the error, another to the (zipped) data used to illustrate the issue:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dropbox.com%2Fs%2Fepaatxy551zzipx%2Ftest.py%3Fdl%3D0&amp;data=05%7C01%7Ca.pontzen%40ucl.ac.uk%7C33f3d45eb259430bd69908da9c7b413e%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C637994351354825601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=t8dNZS3ipgJH5C8uzl0Cs0dZSl%2FviFh8%2BrmnVSSEd%2FQ%3D&amp;reserved=0

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.dropbox.com%2Fs%2Fry6w53pjw4kch2u%2Foutput_00001.zip%3Fdl%3D0&amp;data=05%7C01%7Ca.pontzen%40ucl.ac.uk%7C33f3d45eb259430bd69908da9c7b413e%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C637994351354825601%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=owIr9gJEttFNmxLPJmeMiq6qSNcjzssDVGSxf%2Bws6FU%3D&amp;reserved=0


Please let me know if anything else is needed.

Cheers

Thor

___________________________
Dr. Thor Tepper García
Astrophysicist
On 22 Sep 2022, at 18:14, Andrew Pontzen <a.po...@ucl.ac.uk> wrote:

Sounds like a bug but please post a reproducible example with link to data so that it can be reproduced.

All the best

Andrew

On Thu, 22 Sep 2022 at 09:11, Thor Tepper-Garcia <ttep...@gmail.com> wrote:
Hi,

I have just updated my installation from 1.02 to 1.2.3 and ran into an issue right away.

When I load a Ramses output and do try to change to physical units like so:

s = pynbody.load('output_00001')
s.physical_units()

I get a lengthy error message that ends up with:

File "/Users/tepper/Library/Python/3.7/lib/python/site-packages/pynbody-1.2.3-py3.7-macosx-10.15-x86_64.egg/pynbody/units.py", line 505, in _expand

   self._scale *= b._scale ** p

ZeroDivisionError: 0.0 cannot be raised to a negative power

There is nothing wrong with the snapshot, as I was just using it without trouble prior to updating Pynbody. Any help and / or ideas how to solve this will be much appreciated!

Thor


--
You received this message because you are subscribed to the Google Groups "pynbody-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynbody-user...@googlegroups.com.

Tepper

unread,
Sep 25, 2022, 9:45:35 PM9/25/22
to Pontzen, Andrew, pynbody-users
Dear Andrew,

I confirm that the new version does solve the problem (as I mentioned in an earlier email), and that it also reads in the gravitational potential from a Ramses output (as long as this is present in the part_file descriptor file).

But in order to for the potential to be converted from the weird Ramses units into physical units (which is accomplished by ramses.py), I still need to add 'potential: phi’ to the section ‘ramses-name-mapping’ of the (now customised) config file, like so:

[ramses-name-mapping]
position_x: x
position_y: y
position_z: z
velocity_x: vx
velocity_y: vy
velocity_z: vz
identity: iord
levelp: level
birth_time: form
potential: phi


After that, everything works as expected =)

By the way: May I suggest that ‘phi’ be renamed ‘pot’ in future versions? I think this makes sense because ‘phi’ has the potential to being confused with the azimuthal angle (as used in the Fourier routines), Also, if ‘pot’ is available in the input data, it can be used to calculate the radial profile of the potential (also called ‘pot’) rather than using the expensive gravity routines.

Many thanks again for your help, for developing pynbody, and for making it freely available; simply awesome!

Cheers

Thor

___________________________
Dr. Thor Tepper García
Astrophysicist
www.thorsten.mx
@thorsten_mx
> To view this discussion on the web visit https://groups.google.com/d/msgid/pynbody-users/83599F63-1462-47B7-9E13-761BFFB2FD13%40ucl.ac.uk.

Reply all
Reply to author
Forward
0 new messages