예제 #1
0
    def  __getitem__(self, item):

        data_dict = super().__getitem__(item)

        processed_data = from_numpy(self.process_data(self.event_hit_pmts, self.event_hit_charges))
        processed_data = du.apply_random_transformations(self.transforms, processed_data)

        data_dict["data"] = processed_data

        return data_dict
    def __getitem__(self, item):

        data_dict = self.digi_dataset.__getitem__(item)

        truth_item = self.digi_truth_mapping[item]
        self.truth_dataset.__getitem__(truth_item)
        parents = self.get_digi_hit_parent(self.digi_dataset.event_hit_pmts, self.truth_dataset.event_hit_pmts, self.truth_dataset.event_hit_parents)

        segmentation = self.digi_dataset.process_data(self.digi_dataset.event_hit_pmts, parents)

        if self.transforms is not None:
            data, segmentation = du.apply_random_transformations(self.transforms, data_dict["data"], segmentation)
            data_dict["data"] = data

        data_dict["segmented_labels"] = segmentation #this is a dict of np arrays of shape (19,40,40)

        return data_dict    
예제 #3
0
    def __getitem__(self, item):

        data_dict = super().__getitem__(item)

        processed_data = from_numpy(
            self.process_data(self.event_hit_pmts, self.event_hit_charges))

        processed_data = du.apply_random_transformations(
            self.transforms, processed_data)

        # Add padding
        if self.pad:
            processed_data = transformations.mpmtPadding(
                processed_data, self.barrel_rows)

        data_dict["data"] = processed_data

        return data_dict
예제 #4
0
    def __getitem__(self, item):

        data_dict = super().__getitem__(item)
        hit_pmts = data_dict["data"]["hit_pmts"]
        hit_charges = data_dict["data"]["hit_charges"]
        hit_times = data_dict["data"]["hit_times"]

        hit_mpmts = hit_pmts // pmts_per_mpmt
        hit_pmt_in_modules = hit_pmts % pmts_per_mpmt
        hit_barrel = np.where(np.in1d(hit_mpmts, self.barrel_mpmts))[0]
        hit_pmt_in_modules[hit_barrel] = barrel_map_array_idxs[
            hit_pmt_in_modules[hit_barrel]]

        if self.max_points is not None:
            n_points = self.max_points
            unique_mpmts, unique_hit_mpmts = np.unique(hit_mpmts,
                                                       return_index=True)
            if unique_mpmts.shape[0] > self.max_points:
                unique_mpmts = unique_mpmts[:self.max_points]
                unique_hit_mpmts = unique_hit_mpmts.where[
                    unique_hit_mpmts < self.max_points]
        else:
            n_points = self.mpmt_positions.shape[1]
            unique_mpmts = np.arange(n_points)
            unique_hit_mpmts = hit_mpmts
        if not self.use_orientations:
            data = np.zeros((41, n_points))
            charge_channels = hit_pmt_in_modules + 3
            time_channels = hit_pmt_in_modules + 22
        else:
            data = np.zeros((44, n_points))
            data[3:5, :] = self.mpmt_orientations[:, unique_mpmts]
            charge_channels = hit_pmt_in_modules + 6
            time_channels = hit_pmt_in_modules + 25
        data[:3, :] = self.mpmt_positions[:, unique_mpmts]
        data[charge_channels, unique_hit_mpmts] = hit_charges
        data[time_channels, unique_hit_mpmts] = hit_times

        data = du.apply_random_transformations(self.transforms, data)

        data_dict["data"] = data
        return data_dict
예제 #5
0
    def __getitem__(self, item):

        data_dict = super().__getitem__(item)

        n_hits = min(self.n_points, self.event_hit_pmts.shape[0])
        hit_positions = self.geo_positions[self.event_hit_pmts[:n_hits], :]
        data = np.zeros((self.channels, self.n_points), dtype=np.float32)
        data[:3, :n_hits] = hit_positions.T
        if self.use_orientations:
            hit_orientations = self.geo_orientations[
                self.event_hit_pmts[:n_hits], :]
            data[3:6, :n_hits] = hit_orientations.T
        if self.use_times:
            data[-2, :n_hits] = self.event_hit_times[:n_hits]
        data[-1, :n_hits] = self.event_hit_charges[:n_hits]

        data = du.apply_random_transformations(self.transforms, data)

        data_dict["data"] = data
        return data_dict
예제 #6
0
    def __getitem__(self, item):

        data_dict = super().__getitem__(item)

        hit_positions = self.geo_positions[self.event_hit_pmts, :]
        n_hits = min(self.n_points, self.event_hit_pmts.shape[0])
        if not self.use_orientations:
            data = np.zeros((5, self.n_points))
        else:
            hit_orientations = self.geo_orientations[
                self.event_hit_pmts[:n_hits], :]
            data = np.zeros((7, self.n_points))
            data[3:5, :n_hits] = hit_orientations.T
        data[:3, :n_hits] = hit_positions[:n_hits].T
        data[-2, :n_hits] = self.event_hit_charges[:n_hits]
        data[-1, :n_hits] = self.event_hit_times[:n_hits]

        data = du.apply_random_transformations(self.transforms, data)

        data_dict["data"] = data
        return data_dict