Manipulating .g2 Files

21 views
Skip to first unread message

Eliza Diggins

unread,
Nov 6, 2022, 1:59:29 PM11/6/22
to pynbody-users
Hi all,

I'm in need of a way to make edits to .g2 initial condition files and then resave them. I'm building initial condition files of single galaxy clusters and I'd like to be able to create files with multiple identical clusters by manipulating the original file. Is this possible in Pynbody? If not, are there tools that you would recommend?

Thanks,
Eliza Diggins

Rubens Machado

unread,
Nov 7, 2022, 3:00:54 PM11/7/22
to pynbody-users
hi Eliza,

If you only need to handle isolated clusters (i.e. non-cosmological) in type 2 Gadget format, then these simple tools might be useful: https://github.com/regmachado/SnapGadget specially the snapmanip.py which is an empty example of how to read/manipulate/write.

I suspect it can be done in pynbody. There was a thread "Create gadget snapshot file from scratch" on May 1, 2020.

cheers,
Rubens

Eliza Diggins

unread,
Nov 10, 2022, 10:56:31 AM11/10/22
to pynbody-users
Awesome! This is really helpful. This looks to be easily manipulable for my need!
Reply all
Reply to author
Forward
0 new messages