def __init__(self, h5file, mpmt_positions_file, is_distributed, transforms=None, collapse_arrays=False): """ Args: h5_path ... path to h5 dataset file is_distributed ... whether running in multiprocessing mode transforms ... transforms to apply collapse_arrays ... whether to collapse arrays in return """ super().__init__(h5file, is_distributed) self.mpmt_positions = np.load(mpmt_positions_file)['mpmt_image_positions'] self.data_size = np.max(self.mpmt_positions, axis=0) + 1 self.barrel_rows = [row for row in range(self.data_size[0]) if np.count_nonzero(self.mpmt_positions[:,0] == row) == self.data_size[1]] n_channels = pmts_per_mpmt self.data_size = np.insert(self.data_size, 0, n_channels) self.collapse_arrays = collapse_arrays self.transforms = du.get_transformations(transformations, transforms)
def __init__(self, h5file, mpmt_positions_file, is_distributed, transforms=None, collapse_arrays=False, pad=False): """ Args: h5_path ... path to h5 dataset file is_distributed ... whether running in multiprocessing mode transforms ... transforms to apply collapse_arrays ... whether to collapse arrays in return """ super().__init__(h5file, is_distributed) self.mpmt_positions = np.load( mpmt_positions_file)['mpmt_image_positions'] self.data_size = np.max(self.mpmt_positions, axis=0) + 1 self.barrel_rows = [ row for row in range(self.data_size[0]) if np.count_nonzero( self.mpmt_positions[:, 0] == row) == self.data_size[1] ] n_channels = pmts_per_mpmt self.data_size = np.insert(self.data_size, 0, n_channels) self.collapse_arrays = collapse_arrays self.transforms = du.get_transformations(self, transforms) self.pad = pad ################ # self.transforms = transforms # self.transforms_funcs = { # 'horizontal_flip': self.horizontal_flip, # 'vertical_flip': self.vertical_flip, # 'rotation180': self.rotation180 # } self.horizontal_flip_mpmt_map = [ 0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 12, 17, 16, 15, 14, 13, 18 ] self.vertical_flip_mpmt_map = [ 6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 15, 14, 13, 12, 17, 16, 18 ]
def __init__(self, h5file, geometry_file, is_distributed, use_orientations=False, transforms=None, max_points=None): super().__init__(h5file, is_distributed) geo_file = np.load(geometry_file, 'r') geo_positions = torch.from_numpy(geo_file["position"]).float() geo_orientations = torch.from_numpy(geo_file["orientation"]).float() self.mpmt_positions = geo_positions[18::19, :].T self.mpmt_orientations = geo_orientations[18::19, :].T mpmt_y = np.abs(self.mpmt_positions[1, :]) self.barrel_mpmts = np.where(mpmt_y < mpmt_y.max() - 10)[0].astype( np.int16) self.use_orientations = use_orientations self.max_points = max_points self.transforms = du.get_transformations(transformations, transforms)
def __init__(self, h5file, geometry_file, is_distributed, use_times=True, use_orientations=False, n_points=4000, transforms=None): super().__init__(h5file, is_distributed) geo_file = np.load(geometry_file, 'r') self.geo_positions = geo_file["position"].astype(np.float32) self.geo_orientations = geo_file["orientation"].astype(np.float32) self.use_orientations = use_orientations self.use_times = use_times self.n_points = n_points self.transforms = du.get_transformations(transformations, transforms) self.channels = 4 if use_orientations: self.channels += 3 if use_times: self.channels += 1