mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-10-11 10:40:24 +02:00
Changed module name no lowercase because that's really how it should be
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
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.Ptycho2DDataset.from_cxi(filename)
|
||||
filename = '79511_p.cxi'
|
||||
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.
|
||||
@@ -18,7 +18,7 @@ dataset.mask = dataset.mask[70:-70,70:-70]
|
||||
# translations_scale defines how aggressive the position reconstruction is
|
||||
# n_modes is the number of incoherent modes
|
||||
# propagation_distance is the distance to propagate from the SHARP-style guess of the probe's focal spot (in this case, the value comes from knowledge of the experimental geometry).
|
||||
model = CDTools.models.FancyPtycho.from_dataset(dataset,
|
||||
model = cdtools.models.FancyPtycho.from_dataset(dataset,
|
||||
translation_scale = 4,
|
||||
n_modes=2,
|
||||
propagation_distance=73e-6)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import numpy as np
|
||||
import torch as t
|
||||
from matplotlib import pyplot as plt
|
||||
from CDTools.datasets import CDataset
|
||||
from CDTools.tools import data as cdtdata
|
||||
from cdtools.datasets import CDataset
|
||||
from cdtools.tools import data as cdtdata
|
||||
|
||||
|
||||
__all__ = ['BasicPtychoDataset']
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from matplotlib import pyplot as plt
|
||||
from scipy import io
|
||||
|
||||
from CDTools.tools import plotting
|
||||
from CDTools.tools import analysis
|
||||
from cdtools.tools import plotting
|
||||
from cdtools.tools import analysis
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
import numpy as np
|
||||
from scipy import io
|
||||
|
||||
# Load the data
|
||||
filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
results = []
|
||||
n = 25
|
||||
@@ -13,7 +13,7 @@ for idx in range(n):
|
||||
print('Starting Reconstruction', idx+1, 'of',n)
|
||||
|
||||
# Create a new model each time
|
||||
model = CDTools.models.FancyPtycho.from_dataset(dataset,n_modes=3,
|
||||
model = cdtools.models.FancyPtycho.from_dataset(dataset,n_modes=3,
|
||||
randomize_ang=0.1*np.pi)
|
||||
|
||||
# Work on the GPU
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
from matplotlib import pyplot as plt
|
||||
from scipy import io
|
||||
|
||||
# First, we load an example dataset from a .cxi file
|
||||
filename = 'example_data/AuBalls_700ms_30nmStep_3_6SS_filter.cxi'
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
# Next, we create a ptychography model from the dataset
|
||||
# Note that we explicitly ask for two incoherent probe modes
|
||||
model = CDTools.models.FancyPtycho.from_dataset(dataset, n_modes=2)
|
||||
model = cdtools.models.FancyPtycho.from_dataset(dataset, n_modes=2)
|
||||
|
||||
# Let's do this reconstruction on the GPU, shall we?
|
||||
model.to(device='cuda')
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
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.Ptycho2DDataset.from_cxi(filename)
|
||||
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
# And we take a look at the data
|
||||
dataset.inspect()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
from matplotlib import pyplot as plt
|
||||
from scipy import io
|
||||
|
||||
@@ -10,12 +10,12 @@ from scipy import io
|
||||
|
||||
# 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/Lab Ptycho/Zone Plate Bragg 633.cxi'
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
filename = 'Zone Plate Bragg 633.cxi'
|
||||
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
#dataset.inspect()
|
||||
|
||||
model = CDTools.models.Bragg2DPtycho.from_dataset(dataset,probe_support_radius=60,correct_tilt=False)
|
||||
model = cdtools.models.Bragg2DPtycho.from_dataset(dataset,probe_support_radius=60,correct_tilt=False)
|
||||
model.to(device='cuda')
|
||||
dataset.get_as(device='cuda')
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
from matplotlib import pyplot as plt
|
||||
from scipy import io
|
||||
|
||||
|
||||
# A simple dataset collected from our optical setup
|
||||
filename = 'example_data/lab_ptycho_data.cxi'
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
dataset.inspect(units='mm')
|
||||
plt.show()
|
||||
|
||||
model = CDTools.models.FancyPtycho.from_dataset(dataset, oversampling=2,
|
||||
model = cdtools.models.FancyPtycho.from_dataset(dataset, oversampling=2,
|
||||
probe_support_radius=90,
|
||||
n_modes=2,
|
||||
dm_rank=0,units='mm')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
# First, we load an example dataset from a .cxi file
|
||||
filename = 'example_data/lab_ptycho_data.cxi'
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.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)
|
||||
model = cdtools.models.SimplePtycho.from_dataset(dataset)
|
||||
|
||||
# Now, we run a short reconstruction from the dataset!
|
||||
for loss in model.Adam_optimize(20, dataset):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools import tools
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools import tools
|
||||
|
||||
__all__ = ['SimplePtycho']
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
from matplotlib import pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
@@ -6,7 +6,7 @@ import numpy as np
|
||||
# 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.Ptycho2DDataset.from_cxi(filename)
|
||||
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
|
||||
# This model definition includes lots of tweaks, described below.
|
||||
@@ -14,7 +14,7 @@ dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
# randomize_ang defines the initial random phase noise's extent
|
||||
# translations_scale defines how aggressive the position reconstruction is
|
||||
# scattering_mode overrides any sample normal information stored in the .cxi file
|
||||
model = CDTools.models.FancyPtycho.from_dataset(dataset,
|
||||
model = cdtools.models.FancyPtycho.from_dataset(dataset,
|
||||
randomize_ang = np.pi/4,
|
||||
translation_scale=10,
|
||||
scattering_mode='reflection')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
import pickle
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
@@ -11,12 +11,12 @@ with open('example_data/Optical_ptycho_incoherent.pickle', 'rb') as f:
|
||||
probe = ptycho_results['probe']
|
||||
background = ptycho_results['background']
|
||||
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(ss_filename)
|
||||
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(ss_filename)
|
||||
|
||||
|
||||
# Next, we create an RPI model from the dataset
|
||||
# Note that we explicitly as for two incoherent probe modes
|
||||
model = CDTools.models.RPI.from_dataset(dataset, probe, [500,500],
|
||||
model = cdtools.models.RPI.from_dataset(dataset, probe, [500,500],
|
||||
background=background, n_modes=2,
|
||||
initialization='random')
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import CDTools
|
||||
import cdtools
|
||||
from matplotlib import pyplot as plt
|
||||
from scipy import io
|
||||
|
||||
|
||||
filename = 'example_data/lab_ptycho_data.cxi'
|
||||
dataset = CDTools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
dataset = cdtools.datasets.Ptycho2DDataset.from_cxi(filename)
|
||||
|
||||
#dataset.inspect(units='mm')
|
||||
#plt.show()
|
||||
|
||||
@@ -4,21 +4,21 @@ with open("README.md", "r") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setuptools.setup(
|
||||
name="CDTools",
|
||||
version="0.1.1",
|
||||
name="cdtools",
|
||||
version="0.2.0",
|
||||
python_requires='>3.7', # recommended minimum version for pytorch
|
||||
author="Abe Levitan",
|
||||
author_email="alevitan@mit.edu",
|
||||
description="Coherent Diffraction Tools",
|
||||
description="Tools for coherent diffractive imaging and ptychography",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.mit.edu/scattering/CDTools.git",
|
||||
install_requires=[
|
||||
"numpy>=1.0",
|
||||
"scipy>=1.0",
|
||||
"matplotlib>=2.0", # 2.0 introduces better colormaps which are used by default
|
||||
"matplotlib>=2.0", # 2.0 has better colormaps which are used by default
|
||||
"python-dateutil",
|
||||
"torch>=1.9.0", #1.9.0 implements support for autograd on indexed complex tensors
|
||||
"torch>=1.9.0", #1.9.0 supports autograd on indexed complex tensors
|
||||
"h5py>=2.1"],
|
||||
extras_require={
|
||||
'tests': ["pytest"],
|
||||
|
||||
@@ -6,7 +6,7 @@ warnings.filterwarnings("ignore",
|
||||
|
||||
__all__ = ['tools', 'datasets', 'models']
|
||||
|
||||
from CDTools import tools
|
||||
from CDTools import datasets
|
||||
from CDTools import models
|
||||
from cdtools import tools
|
||||
from cdtools import datasets
|
||||
from cdtools import models
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@ dataset before attempting to do so
|
||||
# to be explicit that import * is safe
|
||||
__all__ = ['CDataset','Ptycho2DDataset','PolarizedPtycho2DDataset']
|
||||
|
||||
from CDTools.datasets.base import CDataset
|
||||
from CDTools.datasets.ptycho_2d_dataset import Ptycho2DDataset
|
||||
from CDTools.datasets.polarized_ptycho_2d_dataset import PolarizedPtycho2DDataset
|
||||
from cdtools.datasets.base import CDataset
|
||||
from cdtools.datasets.ptycho_2d_dataset import Ptycho2DDataset
|
||||
from cdtools.datasets.polarized_ptycho_2d_dataset import PolarizedPtycho2DDataset
|
||||
|
||||
@@ -17,7 +17,7 @@ import torch as t
|
||||
from copy import copy
|
||||
import h5py
|
||||
import pathlib
|
||||
from CDTools.tools import data as cdtdata
|
||||
from cdtools.tools import data as cdtdata
|
||||
from torch.utils import data as torchdata
|
||||
|
||||
__all__ = ['CDataset']
|
||||
|
||||
@@ -2,9 +2,9 @@ import numpy as np
|
||||
import torch as t
|
||||
import h5py
|
||||
import pathlib
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from CDTools.tools import data as cdtdata
|
||||
from CDTools.tools import plotting
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
from cdtools.tools import data as cdtdata
|
||||
from cdtools.tools import plotting
|
||||
|
||||
__all__ = ['PolarizedPtycho2DDataset']
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ import torch as t
|
||||
from copy import copy
|
||||
import h5py
|
||||
import pathlib
|
||||
from CDTools.datasets import CDataset
|
||||
from CDTools.tools import data as cdtdata
|
||||
from CDTools.tools import plotting
|
||||
from cdtools.datasets import CDataset
|
||||
from cdtools.tools import data as cdtdata
|
||||
from cdtools.tools import plotting
|
||||
|
||||
__all__ = ['Ptycho2DDataset']
|
||||
|
||||
|
||||
@@ -24,17 +24,17 @@ defining a new ptychography model before attempting to do so.
|
||||
# to be explicit that import * is safe
|
||||
__all__ = ['CDIModel', 'SimplePtycho', 'FancyPtycho', 'PolarizedFancyPtycho', 'Bragg2DPtycho', 'Multislice2DPtycho', 'RPI', 'TimeResolvedPtychoCalibration', 'TimeResolvedRPI']
|
||||
|
||||
from CDTools.models.base import CDIModel
|
||||
from CDTools.models.simple_ptycho import SimplePtycho
|
||||
from CDTools.models.fancy_ptycho import FancyPtycho
|
||||
from CDTools.models.polarized_fancy_ptycho import PolarizedFancyPtycho
|
||||
from CDTools.models.bragg_2d_ptycho import Bragg2DPtycho
|
||||
from CDTools.models.multislice_2d_ptycho import Multislice2DPtycho
|
||||
from CDTools.models.rpi import RPI
|
||||
from CDTools.models.multimode_rpi import MultimodeRPI
|
||||
from CDTools.models.time_resolved_ptycho_calibration import TimeResolvedPtychoCalibration
|
||||
from CDTools.models.time_resolved_rpi import TimeResolvedRPI
|
||||
from cdtools.models.base import CDIModel
|
||||
from cdtools.models.simple_ptycho import SimplePtycho
|
||||
from cdtools.models.fancy_ptycho import FancyPtycho
|
||||
from cdtools.models.polarized_fancy_ptycho import PolarizedFancyPtycho
|
||||
from cdtools.models.bragg_2d_ptycho import Bragg2DPtycho
|
||||
from cdtools.models.multislice_2d_ptycho import Multislice2DPtycho
|
||||
from cdtools.models.rpi import RPI
|
||||
from cdtools.models.multimode_rpi import MultimodeRPI
|
||||
from cdtools.models.time_resolved_ptycho_calibration import TimeResolvedPtychoCalibration
|
||||
from cdtools.models.time_resolved_rpi import TimeResolvedRPI
|
||||
|
||||
# Still needs to be updated for the new complex numbers
|
||||
#from CDTools.models.s_matrix_ptycho import SMatrixPtycho
|
||||
#from cdtools.models.s_matrix_ptycho import SMatrixPtycho
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from CDTools import tools
|
||||
from CDTools.tools import plotting as p
|
||||
from CDTools.tools.propagators import generate_generalized_angular_spectrum_propagator as ggasp
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
from cdtools import tools
|
||||
from cdtools.tools import plotting as p
|
||||
from cdtools.tools.propagators import generate_generalized_angular_spectrum_propagator as ggasp
|
||||
from matplotlib import pyplot as plt
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
@@ -455,7 +455,7 @@ class Bragg2DPtycho(CDIModel):
|
||||
|
||||
# First, I need to gather all the relevant data
|
||||
# that needs to be added to the dataset
|
||||
entry_info = {'program_name': 'CDTools',
|
||||
entry_info = {'program_name': 'cdtools',
|
||||
'instrument_n': 'Simulated Data',
|
||||
'start_time': datetime.now()}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from CDTools import tools
|
||||
from CDTools.tools import plotting as p
|
||||
from CDTools.tools import analysis
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
from cdtools import tools
|
||||
from cdtools.tools import plotting as p
|
||||
from cdtools.tools import analysis
|
||||
from matplotlib import pyplot as plt
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
@@ -414,7 +414,7 @@ class FancyPtycho(CDIModel):
|
||||
|
||||
# First, I need to gather all the relevant data
|
||||
# that needs to be added to the dataset
|
||||
entry_info = {'program_name': 'CDTools',
|
||||
entry_info = {'program_name': 'cdtools',
|
||||
'instrument_n': 'Simulated Data',
|
||||
'start_time': datetime.now()}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools import tools
|
||||
from CDTools.tools import plotting as p
|
||||
from CDTools.tools.interactions import RPI_interaction
|
||||
from CDTools.tools import initializers
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools import tools
|
||||
from cdtools.tools import plotting as p
|
||||
from cdtools.tools.interactions import RPI_interaction
|
||||
from cdtools.tools import initializers
|
||||
from scipy.ndimage.morphology import binary_dilation
|
||||
import numpy as np
|
||||
from copy import copy
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from CDTools import tools
|
||||
from CDTools.tools import analysis, image_processing
|
||||
from CDTools.tools import plotting as p
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
from cdtools import tools
|
||||
from cdtools.tools import analysis, image_processing
|
||||
from cdtools.tools import plotting as p
|
||||
from matplotlib import pyplot as plt
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
@@ -447,7 +447,7 @@ class Multislice2DPtycho(CDIModel):
|
||||
|
||||
# First, I need to gather all the relevant data
|
||||
# that needs to be added to the dataset
|
||||
entry_info = {'program_name': 'CDTools',
|
||||
entry_info = {'program_name': 'cdtools',
|
||||
'instrument_n': 'Simulated Data',
|
||||
'start_time': datetime.now()}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel, FancyPtycho
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from CDTools import tools
|
||||
from CDTools.tools import plotting as p
|
||||
# from CDTools.tools import polarized_plotting as pp
|
||||
from CDTools.tools import analysis
|
||||
from cdtools.models import CDIModel, FancyPtycho
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
from cdtools import tools
|
||||
from cdtools.tools import plotting as p
|
||||
# from cdtools.tools import polarized_plotting as pp
|
||||
from cdtools.tools import analysis
|
||||
from matplotlib import pyplot as plt
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
from scipy import linalg as sla
|
||||
from copy import copy
|
||||
from CDTools.tools import polarization
|
||||
from cdtools.tools import polarization
|
||||
|
||||
__all__ = ['PolarizedFancyPtycho']
|
||||
|
||||
@@ -353,7 +353,7 @@ class PolarizedFancyPtycho(FancyPtycho):
|
||||
|
||||
# First, I need to gather all the relevant data
|
||||
# that needs to be added to the dataset
|
||||
entry_info = {'program_name': 'CDTools',
|
||||
entry_info = {'program_name': 'cdtools',
|
||||
'instrument_n': 'Simulated Data',
|
||||
'start_time': datetime.now()}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools import tools
|
||||
from CDTools.tools import plotting as p
|
||||
from CDTools.tools.interactions import RPI_interaction
|
||||
from CDTools.tools import initializers
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools import tools
|
||||
from cdtools.tools import plotting as p
|
||||
from cdtools.tools.interactions import RPI_interaction
|
||||
from cdtools.tools import initializers
|
||||
from scipy.ndimage.morphology import binary_dilation
|
||||
import numpy as np
|
||||
from copy import copy
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from CDTools import tools
|
||||
from CDTools.tools import cmath
|
||||
from CDTools.tools import plotting as p
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
from cdtools import tools
|
||||
from cdtools.tools import cmath
|
||||
from cdtools.tools import plotting as p
|
||||
from matplotlib import pyplot as plt
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
@@ -353,7 +353,7 @@ class SMatrixPtycho(CDIModel):
|
||||
|
||||
# First, I need to gather all the relevant data
|
||||
# that needs to be added to the dataset
|
||||
entry_info = {'program_name': 'CDTools',
|
||||
entry_info = {'program_name': 'cdtools',
|
||||
'instrument_n': 'Simulated Data',
|
||||
'start_time': datetime.now()}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from CDTools import tools
|
||||
from CDTools.tools import plotting as p
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
from cdtools import tools
|
||||
from cdtools.tools import plotting as p
|
||||
from copy import copy
|
||||
from torch.utils import data as torchdata
|
||||
from datetime import datetime
|
||||
@@ -159,7 +159,7 @@ class SimplePtycho(CDIModel):
|
||||
|
||||
# First, I need to gather all the relevant data
|
||||
# that needs to be added to the dataset
|
||||
entry_info = {'program_name': 'CDTools',
|
||||
entry_info = {'program_name': 'cdtools',
|
||||
'instrument_n': 'Simulated Data',
|
||||
'start_time': datetime.now()}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from CDTools import tools
|
||||
from CDTools.tools import plotting as p
|
||||
from CDTools.tools import analysis
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
from cdtools import tools
|
||||
from cdtools.tools import plotting as p
|
||||
from cdtools.tools import analysis
|
||||
from matplotlib import pyplot as plt
|
||||
from datetime import datetime
|
||||
import numpy as np
|
||||
@@ -362,7 +362,7 @@ class TimeResolvedPtychoCalibration(CDIModel):
|
||||
|
||||
# First, I need to gather all the relevant data
|
||||
# that needs to be added to the dataset
|
||||
entry_info = {'program_name': 'CDTools',
|
||||
entry_info = {'program_name': 'cdtools',
|
||||
'instrument_n': 'Simulated Data',
|
||||
'start_time': datetime.now()}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import torch as t
|
||||
from CDTools.models import CDIModel
|
||||
from CDTools import tools
|
||||
from CDTools.tools import plotting as p
|
||||
from CDTools.tools.interactions import RPI_interaction
|
||||
from CDTools.tools import initializers
|
||||
from cdtools.models import CDIModel
|
||||
from cdtools import tools
|
||||
from cdtools.tools import plotting as p
|
||||
from cdtools.tools.interactions import RPI_interaction
|
||||
from cdtools.tools import initializers
|
||||
from scipy.ndimage.morphology import binary_dilation
|
||||
import numpy as np
|
||||
from copy import copy
|
||||
|
||||
@@ -9,19 +9,19 @@ that one needs for a specific application.
|
||||
The submodules are all structured as modules with their own __init__ files,
|
||||
which use an import * statement to import from a file defining the various
|
||||
functions. This is done to prevent leakage of imported packages into the
|
||||
namespace of CDTools. I know, we're all consenting adults, but I just hate
|
||||
having numpy and torch defined under CDTools.tools.cmath, you know?
|
||||
namespace of cdtools. I know, we're all consenting adults, but I just hate
|
||||
having numpy and torch defined under cdtools.tools.cmath, you know?
|
||||
|
||||
"""
|
||||
|
||||
from CDTools.tools import losses
|
||||
from CDTools.tools import data
|
||||
from CDTools.tools import image_processing
|
||||
from CDTools.tools import initializers
|
||||
from CDTools.tools import plotting
|
||||
from CDTools.tools import interactions
|
||||
from CDTools.tools import propagators
|
||||
from CDTools.tools import measurements
|
||||
from CDTools.tools import analysis
|
||||
from CDTools.tools import atoms
|
||||
from CDTools.tools import polarization
|
||||
from cdtools.tools import losses
|
||||
from cdtools.tools import data
|
||||
from cdtools.tools import image_processing
|
||||
from cdtools.tools import initializers
|
||||
from cdtools.tools import plotting
|
||||
from cdtools.tools import interactions
|
||||
from cdtools.tools import propagators
|
||||
from cdtools.tools import measurements
|
||||
from cdtools.tools import analysis
|
||||
from cdtools.tools import atoms
|
||||
from cdtools.tools import polarization
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.analysis.analysis import *
|
||||
from cdtools.tools.analysis.analysis import *
|
||||
|
||||
@@ -8,7 +8,7 @@ data has been stored in numpy arrays.
|
||||
|
||||
import torch as t
|
||||
import numpy as np
|
||||
from CDTools.tools import image_processing as ip
|
||||
from cdtools.tools import image_processing as ip
|
||||
from scipy import fftpack
|
||||
from scipy import linalg as sla
|
||||
from scipy import special
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.atoms.atoms import *
|
||||
from cdtools.tools.atoms.atoms import *
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.data.data import *
|
||||
from cdtools.tools.data.data import *
|
||||
|
||||
@@ -419,7 +419,7 @@ def get_ptycho_translations(cxi_file):
|
||||
"""Gets an array of x,y,z translations, if such an array has been defined in the file
|
||||
|
||||
It negates the translations, because the CXI file format is designed
|
||||
to specify translations of the samples and the CDTools code specifies
|
||||
to specify translations of the samples and the cdtools code specifies
|
||||
translations of the optics.
|
||||
|
||||
Parameters
|
||||
@@ -775,7 +775,7 @@ def add_ptycho_translations(cxi_file, translations):
|
||||
The translations to be saved
|
||||
"""
|
||||
# accounting for the different definition between cxi files and
|
||||
# CDTools
|
||||
# cdtools
|
||||
translations = -translations
|
||||
|
||||
add_shot_to_shot_info(cxi_file, translations, 'translation')
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.image_processing.image_processing import *
|
||||
from cdtools.tools.image_processing.image_processing import *
|
||||
|
||||
@@ -9,7 +9,7 @@ a way that it is safe to include them in automatic differentiation models.
|
||||
|
||||
import numpy as np
|
||||
import torch as t
|
||||
from CDTools.tools import propagators
|
||||
from cdtools.tools import propagators
|
||||
|
||||
__all__ = ['centroid', 'centroid_sq', 'sinc_subpixel_shift',
|
||||
'find_subpixel_shift', 'find_pixel_shift', 'find_shift',
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.initializers.initializers import *
|
||||
from cdtools.tools.initializers.initializers import *
|
||||
|
||||
@@ -8,9 +8,9 @@ geierating sensible initializations for the probe guess.
|
||||
import math
|
||||
import numpy as np
|
||||
import torch as t
|
||||
from CDTools.tools.propagators import *
|
||||
from CDTools.tools.analysis import orthogonalize_probes
|
||||
from CDTools.tools import image_processing
|
||||
from cdtools.tools.propagators import *
|
||||
from cdtools.tools.analysis import orthogonalize_probes
|
||||
from cdtools.tools import image_processing
|
||||
from scipy.fftpack import next_fast_len
|
||||
from scipy.sparse import linalg as spla
|
||||
from torch.nn.functional import pad
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.interactions.interactions import *
|
||||
from cdtools.tools.interactions.interactions import *
|
||||
|
||||
@@ -7,7 +7,7 @@ for ptychographic reconstruction.
|
||||
|
||||
import torch as t
|
||||
import numpy as np
|
||||
from CDTools.tools import propagators, image_processing, polarization
|
||||
from cdtools.tools import propagators, image_processing, polarization
|
||||
|
||||
__all__ = ['translations_to_pixel', 'pixel_to_translations',
|
||||
'project_translations_to_sample',
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.losses.losses import *
|
||||
from cdtools.tools.losses.losses import *
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.measurements.measurements import *
|
||||
from cdtools.tools.measurements.measurements import *
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
from CDTools.tools.plotting.plotting import *
|
||||
from cdtools.tools.plotting.plotting import *
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.polarization.polarization import *
|
||||
from cdtools.tools.polarization.polarization import *
|
||||
|
||||
@@ -1 +1 @@
|
||||
from CDTools.tools.propagators.propagators import *
|
||||
from cdtools.tools.propagators.propagators import *
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ def ptycho_cxi_1():
|
||||
e1f['experiment_identifier'] = np.string_(e1e['experiment_identifier'])
|
||||
e1e['experiment_description'] = 'A fully defined ptychography experiment to test the data loading'
|
||||
e1f['experiment_description'] = np.string_(e1e['experiment_description'])
|
||||
e1e['program_name'] = 'CDTools'
|
||||
e1e['program_name'] = 'cdtools'
|
||||
e1f['program_name'] = np.string_(e1e['program_name'])
|
||||
e1e['title'] = 'The one experiment we did'
|
||||
e1f['title'] = np.string_(e1e['title'])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from CDTools.datasets import *
|
||||
from CDTools.tools import data as cdtdata
|
||||
from cdtools.datasets import *
|
||||
from cdtools.tools import data as cdtdata
|
||||
import numpy as np
|
||||
import torch as t
|
||||
import h5py
|
||||
|
||||
@@ -4,7 +4,7 @@ from scipy import linalg as la
|
||||
import torch as t
|
||||
from itertools import combinations
|
||||
|
||||
from CDTools.tools import analysis, initializers
|
||||
from cdtools.tools import analysis, initializers
|
||||
|
||||
|
||||
def test_orthogonalize_probes():
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from CDTools.tools import data
|
||||
from cdtools.tools import data
|
||||
import numpy as np
|
||||
import torch as t
|
||||
import h5py
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
import torch as t
|
||||
|
||||
from CDTools.tools import image_processing, interactions
|
||||
from cdtools.tools import image_processing, interactions
|
||||
from scipy import ndimage
|
||||
|
||||
def test_centroid():
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from CDTools.tools import initializers
|
||||
from CDTools.datasets import Ptycho2DDataset
|
||||
from cdtools.tools import initializers
|
||||
from cdtools.datasets import Ptycho2DDataset
|
||||
import numpy as np
|
||||
import torch as t
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from CDTools.tools import interactions
|
||||
from cdtools.tools import interactions
|
||||
import numpy as np
|
||||
import torch as t
|
||||
from numpy import fft
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from CDTools.tools import losses
|
||||
from cdtools.tools import losses
|
||||
import numpy as np
|
||||
import torch as t
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from CDTools.tools import measurements
|
||||
from cdtools.tools import measurements
|
||||
import torch as t
|
||||
import numpy as np
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from CDTools.tools import plotting
|
||||
from CDTools.tools import initializers
|
||||
from cdtools.tools import plotting
|
||||
from cdtools.tools import initializers
|
||||
import numpy as np
|
||||
import torch as t
|
||||
import scipy.misc
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import numpy as np
|
||||
import torch as t
|
||||
from CDTools.tools.polarization import apply_linear_polarizer, generate_linear_polarizer
|
||||
from CDTools.tools.polarization import apply_jones_matrix as jones
|
||||
from cdtools.tools.polarization import apply_linear_polarizer, generate_linear_polarizer
|
||||
from cdtools.tools.polarization import apply_jones_matrix as jones
|
||||
|
||||
|
||||
# Abe - I removed all the imports that didn't need to be here.
|
||||
@@ -621,4 +621,4 @@ def test_apply_jones_matrix_mult_modes_one_pattern_probe_mult_patterns_jones_2()
|
||||
assert t.allclose(out[2, 3, 1, :-2, -2:], t.zeros(2, 2, dtype=t.cfloat))
|
||||
assert t.allclose(out[2, 3, 0, -2:, :-2], out[2, 3, 1, -2:, :-2])
|
||||
assert np.allclose(np.real(out[2, 3, 0, -2:, -2:]), np.real(out[2, 3, 0, -2:, -2:]))
|
||||
assert out.shape == t.Size((3, 4, 2, 4, 4))
|
||||
assert out.shape == t.Size((3, 4, 2, 4, 4))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from CDTools.tools import initializers
|
||||
from CDTools.tools import propagators
|
||||
from CDTools.tools import image_processing
|
||||
from cdtools.tools import initializers
|
||||
from cdtools.tools import propagators
|
||||
from cdtools.tools import image_processing
|
||||
|
||||
import numpy as np
|
||||
import torch as t
|
||||
|
||||
Reference in New Issue
Block a user