Is there a simple method to acquire a small box with specific width from a complete snapshot which has been downloaded? Maybe it can save as fits or hdf5. I have got tired of reading all snapshot data when my code starts to run.
You mean a box in space (x,y,z)? Unfortunately, no.
Assuming you have downloaded a snapshot, I would suggest you just do this selection once and save it. I.e., load each x, y, and z separately and in a row, making your (min,max) box selection on each. Accumulate the results in a bool mask array, run a np.where() on it, and save the final list of indices to a hdf5 file.
If you ever want to load the particles in your box, then you know you just have to load those indices.
Alternatively, you could then loop through all the fields and dumpy save out each, including those indices alone, into a new "snapshot_box_selection.hdf5" file. Subsequent loading/analysis would then be essentially instant.
Yes. I want to get a box which contains all the particles of the fof group I am interested in.
You can get all the particles in a FoF group, this is what most of the scripts and documentation discusses.
To get a "complete" set of all the particles near a given FoF, you will need to do this yourself, by loading (at least once) all the particles in the entire box.
The small box should not exclude the particles which belong the other groups.
Yes exactly, so you will need to load all particles in the snapshot (once), to make this spatial box selection, which is entirely independent of the halos (it depends only on xyz min max).