pynbody.array.shared.make_shared_array

pynbody.array.shared.make_shared_array#

pynbody.array.shared.make_shared_array(dims, dtype, zeros=False, fname=None, create=True, offset=None, strides=None) SharedMemorySimArray[source]#

Create or reconstruct an array of dimensions dims with the given numpy dtype, backed on shared memory.

If create is True, a new shared memory array is created. If create is False, the shared memory array is opened (and fname must be specified).

Parameters:
  • dims (tuple | int) – The dimensions of the numpy array to create

  • dtype – The data type to use

  • zeros – If True, zero the array; otherwise leave uninitialised

  • fname (str, optional) – The shared memory name to use. If None, and create is True, a random name will be generated.

  • create (bool) – Whether to create the shared array, or to open existing shared memory. If the latter, the fname must be specified and the caller is responsible for making sure the dtype and dims match the original array.

  • offset (int, optional) – The offset into the shared memory to use. This is only valid with create=False

  • strides (tuple, optional) – The strides to use. This is only valid with create=False