pynbody.test_utils.split_swift_snapshot.split_swift_snapshot#
- pynbody.test_utils.split_swift_snapshot.split_swift_snapshot(template_file, nr_files, cell_file_index, output_name, cell_mask=None, write_zero_size_datasets=False)[source]#
Given a single file SWIFT snapshot at path template_file, write a new, multi-file snapshot by assigning cells to files using cell_file_index.
- Parameters:
template_file (pathlib.Path or str) – Name of a single file Swift snapshot to use as a template
nr_files (int) – The number of files to split the template snapshot into
cell_file_index (numpy.ndarray) – Array with a file index to assign each cell to
output_name (pathlib.Path or str) – Name of the output files. Any .X.hdf5 suffix will be replaced.
cell_mask (dict) – Dict where the keys are particle type names (PartTypeX) and the values are boolean masks indicating which cells to keep for that particle type.
write_zero_size_datasets (bool) – If False, datasets which would have zero particles are omitted (as in older Swift versions). If True, all datasets are always written regardless of size (current Swift behaviour).