refactor datasets, wrote more docs, added one more test dataset

This commit is contained in:
Abe Levitan committed 2019-09-09 14:16:42 -04:00
1 parent 99d02f95cf
commit 40998908f1
20 files changed
+338 -160

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ from matplotlib import pyplot as plt
# This file is too large to be distributed via Github.
# Please contact Abe Levitan (alevitan@mit) if you would like access
filename = '/media/Data Bank/CSX_6_17/Processed_CXIs/79511_p.cxi'
dataset = CDTools.datasets.Ptycho_2D_Dataset.from_cxi(filename)
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
# In this dataset, the edges of the patterns are masked off anyway
# We can easily just remove this data instead of leaving it to float.
+1 -1
View File
@@ -5,7 +5,7 @@ import pickle
# Load the data
filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
dataset = CDTools.datasets.Ptycho_2D_Dataset.from_cxi(filename)
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
results = []
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -6,7 +6,7 @@ import pickle
# First, we load an example dataset from a .cxi file
filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
dataset = CDTools.datasets.Ptycho_2D_Dataset.from_cxi(filename)
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
# Next, we create a ptychography model from the dataset
# Note that we explicitly as for two incoherent probe modes
+1 -1
View File
@@ -5,7 +5,7 @@ from matplotlib import pyplot as plt
# First, we load an example dataset from a .cxi file
filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
dataset = CDTools.datasets.Ptycho_2D_Dataset.from_cxi(filename)
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
# And we take a look at the data
dataset.inspect()
+28
View File
@@ -0,0 +1,28 @@
from __future__ import division, print_function, absolute_import
import CDTools
from matplotlib import pyplot as plt
import pickle
filename = 'example_data/lab_ptycho_data.cxi'
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
# dataset.inspect()
# plt.show()
model = CDTools.models.FancyPtycho.from_dataset(dataset, oversampling=2,
probe_support_radius=90)
model.to(device='cuda')
dataset.get_as(device='cuda')
model.translation_offsets.requires_grad = False
for i, loss in enumerate(model.Adam_optimize(50, dataset)):
model.inspect(dataset)
print(i,loss)
with open('example_reconstructions/lab_ptycho.pickle', 'wb') as f:
pickle.dump(model.save_results(dataset),f)
model.compare(dataset)
plt.show()
+1 -1
View File
@@ -5,7 +5,7 @@ from matplotlib import pyplot as plt
# First, we load an example dataset from a .cxi file
filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
dataset = CDTools.datasets.Ptycho_2D_Dataset.from_cxi(filename)
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
# Next, we create a ptychography model from the dataset
model = CDTools.models.SimplePtycho.from_dataset(dataset)
+1 -1
View File
@@ -7,7 +7,7 @@ from matplotlib import pyplot as plt
# This file is too large to be distributed via Github.
# Please contact Abe Levitan (alevitan@mit) if you would like access
filename = '/media/Data Bank/CSX_10_18/Processed_CXIs/110531_p.cxi'
dataset = CDTools.datasets.Ptycho_2D_Dataset.from_cxi(filename)
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
# This model definition includes lots of tweaks, described below.