SWIFTSIM / swiftgalaxy

Load in particles of a simulated galaxy, rotate coordinates, easy spherical/cylindrical coordinates, access integrated properties, and more.
GNU General Public License v3.0
2 stars 1 forks source link

Iterate SWIFTGalaxy's efficiently #13

Open kyleaoman opened 1 week ago

kyleaoman commented 1 week ago

If we want to iterate over many galaxies that lie in the same top-level cell(s) in the snapshot then creating separate SWIFTGalaxy objects will be inefficient because each time a SWIFTGalaxy is created the same particles will be read from disk, and then all but those corresponding to the halo of interest will be discarded. Instead we would like to do the expensive disk i/o once and then temporarily mask out particles that don't belong to the current galaxy of interest while iterating over galaxies.

We can do this cleverly using existing SWIFTGalaxy functionality: it's already easy to return a SWIFTGalaxy that is a subset (masked) of a SWIFTGalaxy. Draft workflow looks like:

kyleaoman commented 2 days ago

All of the basics are now in place! Some further nice-to-have stuff:

And of course: