Skip to content

Commit

Permalink
Changed name to get rid of shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbieker committed Jul 5, 2020
1 parent efca857 commit 275c65d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions factnn/generator/pytorch/eventfile_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def __init__(self, root, transform=None, pre_transform=None):
super(EventFileDataset, self).__init__(root, transform, pre_transform)
self.processed_filenames = []

@property
def raw_file_names(self):
return []

@property
def processed_file_names(self):
return self.processed_filenames
Expand All @@ -33,9 +37,9 @@ def process(self):
if osp.getsize(raw_path) > 0:
# Checks that file is not 0
with open(raw_path, "rb") as pickled_event:
data, data_format, features, feature_cluster = pickle.load(pickled_event)
event_data, data_format, features, feature_cluster = pickle.load(pickled_event)
# Convert List of List to Point Cloud, then truncation is simply cutting in the z direction
event_photons = data[data_format["Image"]]
event_photons = event_data[data_format["Image"]]
event_photons = list_of_lists_to_raw_phs(event_photons)
point_cloud = np.asarray(raw_phs_to_point_cloud(event_photons,
cx=GEOMETRY.x_angle,
Expand All @@ -46,13 +50,13 @@ def process(self):
data.event_type = torch.tensor(0, dtype=torch.int8)
elif "proton" in raw_path:
data.event_type = torch.tensor(1, dtype=torch.int8)
data.energy = torch.tensor(data[data_format["Energy"]], dtype=torch.float)
data.disp = torch.tensor(euclidean_distance(data[data_format['Source_X']], data[data_format['Source_Y']],
data[data_format['COG_X']], data[data_format['COG_Y']]),
data.energy = torch.tensor(event_data[data_format["Energy"]], dtype=torch.float)
data.disp = torch.tensor(euclidean_distance(event_data[data_format['Source_X']], event_data[data_format['Source_Y']],
event_data[data_format['COG_X']], event_data[data_format['COG_Y']]),
dtype=torch.float16)
data.sign = torch.tensor(true_sign(data[data_format['Source_X']], data[data_format['Source_Y']],
data[data_format['COG_X']], data[data_format['COG_Y']],
data[data_format['Delta']]), dtype=torch.uint8)
data.sign = torch.tensor(true_sign(event_data[data_format['Source_X']], event_data[data_format['Source_Y']],
event_data[data_format['COG_X']], event_data[data_format['COG_Y']],
event_data[data_format['Delta']]), dtype=torch.uint8)

if self.pre_filter is not None and not self.pre_filter(data):
continue
Expand All @@ -70,3 +74,4 @@ def len(self):
def get(self, idx):
data = torch.load(osp.join(self.processed_dir, 'data_{}.pt'.format(idx)))
return data

0 comments on commit 275c65d

Please sign in to comment.