Reading Ramses particle potential

22 views
Skip to first unread message

Thor Tepper-Garcia

unread,
Sep 21, 2022, 5:34:22 AM9/21/22
to pynbody-users
Hi all,

I'm writing out the particle potential to e.g. part_00001.out00001 (using the OUTPUT_PARTICLE_POTENTIAL directive, in case anyone wonders), and I'm trying to read it in with pynbody. Even though the part_file_descriptor.txt lists the potential like so:

# version:  1
# ivar, variable_name, variable_type
 1, position_x, d
 2, position_y, d
 3, position_z, d
 4, velocity_x, d
 5, velocity_y, d
 6, velocity_z, d
 7, mass, d
 8, identity, I
 9, levelp, I
10, family, b
11, tag, b
12, potential, d

and the key 'potential' is available, when I do e.g. s['potential'] I get only 0s.

I guess there are a number of things I need to adjust in the config.ini file, e.g. add the mapping 'potential: phi' to ramses-name-mapping and modify:

particle-blocks=x,y,z,vx,vy,vz,mass,iord,level,age,metal
particle-format=f8,f8,f8,f8,f8,f8,f8,i4,i4,f8,f8

to list the potential and its type.

However, I note that pynbody does not recognise the type 'b' which is a 1 byte character. I fear that by not setting that correctly, the fields in part_xxxxx may not be read correctly. I looked into the code and realised that these types (e.g. f8, i4) are defined in ramses.py (TYPE_MAP). I guess I could hack into that and add a type 'b', but I'm not really sure how that should be done.

So before trying this and making a lot of mistakes, my question is: Is it possible to read the particle potential from part_00001.out00001 without hacking into the code, perhaps only adjusting the config file?

Thanks heaps in advance for any help!

Thor

Reply all
Reply to author
Forward
0 new messages