Dennis Trujillo commited on
Commit
8f490e0
·
1 Parent(s): 6459c2a

updated test.py

Browse files
Files changed (1) hide show
  1. test.py +29 -0
test.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ds1 import PatchDataset
2
+ from torch.utils.data import DataLoader
3
+ from torchvision.transforms import Normalize
4
+ import numpy as np
5
+ import torch
6
+
7
+ ffile = '/Users/dennistrujillo/Downloads/park_sam_cx5b_s0_ff_with_Pb_000402.ge3'
8
+ dfile = '/Users/dennistrujillo/Downloads/dark_before_000384.ge3'
9
+
10
+ bs = 1
11
+ dataset = PatchDataset(ffile, dfile, nFrames=1440)
12
+ #dataloader = DataLoader(dataset, batch_size=bs, shuffle=True)
13
+ patches_array = np.array(dataset.patches)
14
+ fnum_array = np.array(dataset.f_nums)
15
+
16
+ patches_tensor = torch.from_numpy(patches_array)
17
+ torch.save(patches_tensor, 'patches_array.pt')
18
+
19
+ fnum_tensor = torch.from_numpy(fnum_array)
20
+ torch.save(fnum_tensor, 'fnum_array.pt')
21
+
22
+ # Initialize an empty array to store the patches
23
+ #patches_tensor = torch.empty(size=dataloader.size)
24
+
25
+ # Concatenate the patches from each iteration of the dataloader
26
+ #for i, (patches, xy_positions) in enumerate(dataloader):
27
+ # patches_tensor = torch.cat((patches_tensor, patches))
28
+
29
+ #torch.save(patches_tensor, 'patches_tensor.pt')