Exemplo n.º 1
0
 def dtype(self) -> np.dtype:
     logging.info(f"Accessing '{self.location}' for 'dtype'")
     (z_data, z_info) = read(str(self.location))
     fields = []
     for quant in self.quantity_names:
         fields.append((quant, z_data[quant].dtype))
     return np.dtype(fields)
Exemplo n.º 2
0
    def get_data(self, indexing=None, fields=None) -> np.ndarray:
        (z_data, z_info) = read(str(self.location))

        # create a structured array
        dset = np.zeros(self.num_particles, dtype=self.dtype)

        # fill the array
        for quant in self.quantity_names:
            dset[quant] = z_data[quant]

        return dset
Exemplo n.º 3
0
    def get_data(self, indexing=None, fields=None) -> np.ndarray:
        logging.info(f"Reading data in '{self.location}'")
        (z_data, z_info) = read(str(self.location))
        if fields is None:
            # create a structured array
            dset = np.empty(self.num_particles, dtype=self.dtype)

            # fill the array
            for quant in self.quantity_names:
                dset[quant] = z_data[quant]
        else:
            if indexing is None:
                dset = z_data[fields][:]
            else:
                dset = z_data[fields][indexing]

        return dset
Exemplo n.º 4
0
 def dtype(self):
     logging.info(f"Accessing '{self.location}' for 'dtype'")
     (z_data, z_info) = read(str(self.location))
     return z_data.dtype
Exemplo n.º 5
0
 def get_data(self=None, indexing=None):
     # TODO: apply indexing here
     (z_data, z_info) = read(str(self.location))
     return z_data.transpose()