pynbody.array.shared.pack#
- pynbody.array.shared.pack(array, transfer_ownership=False)[source]#
Turn an array backed onto shared memory into something that can be passed between processes
- Parameters:
array (SimArray) – The array to pack. Note that this must be a shared memory array, created via
make_shared_array()
, or a view of such an array. Snapshots load arrays into shared memory only if you have calledpynbody.snapshot.simsnap.SimSnap.enable_shared_arrays()
first.transfer_ownership (bool) – If True, the receiving process will take over responsibility for cleaning up the shared memory.
- Returns:
array_description – A description of the array that can be passed between processes (e.g. using pickle to turn it into a short string that can be sent via a pipe).
- Return type:
object