mirror of
https://github.com/cdtools-developers/cdtools.git
synced 2026-11-27 15:37:49 +01:00
Merge pull request #22 from gnzng/fix-gaussian
Fix use of gaussian_probe() + typo
This commit is contained in:
3 files changed
+5
-7
No files matched your search
@@ -195,7 +195,7 @@ class FancyPtycho(CDIModel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_dataset(cls,
|
def from_dataset(cls,
|
||||||
dataset,
|
dataset,
|
||||||
probe_size=None,
|
probe_shape=None,
|
||||||
randomize_ang=0,
|
randomize_ang=0,
|
||||||
n_modes=1,
|
n_modes=1,
|
||||||
n_obj_modes=1,
|
n_obj_modes=1,
|
||||||
@@ -277,7 +277,7 @@ class FancyPtycho(CDIModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Finally, initialize the probe and object using this information
|
# Finally, initialize the probe and object using this information
|
||||||
if probe_size is None:
|
if probe_shape is None:
|
||||||
probe = tools.initializers.SHARP_style_probe(
|
probe = tools.initializers.SHARP_style_probe(
|
||||||
dataset,
|
dataset,
|
||||||
propagation_distance=propagation_distance,
|
propagation_distance=propagation_distance,
|
||||||
@@ -288,7 +288,6 @@ class FancyPtycho(CDIModel):
|
|||||||
dataset,
|
dataset,
|
||||||
obj_basis,
|
obj_basis,
|
||||||
probe_shape,
|
probe_shape,
|
||||||
probe_size,
|
|
||||||
propagation_distance=propagation_distance,
|
propagation_distance=propagation_distance,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class MultislicePtycho(CDIModel):
|
|||||||
dataset,
|
dataset,
|
||||||
dz,
|
dz,
|
||||||
nz,
|
nz,
|
||||||
probe_size=None,
|
probe_shape=None,
|
||||||
randomize_ang=0,
|
randomize_ang=0,
|
||||||
n_modes=1,
|
n_modes=1,
|
||||||
n_obj_modes=1,
|
n_obj_modes=1,
|
||||||
@@ -262,7 +262,7 @@ class MultislicePtycho(CDIModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Finally, initialize the probe and object using this information
|
# Finally, initialize the probe and object using this information
|
||||||
if probe_size is None:
|
if probe_shape is None:
|
||||||
probe = tools.initializers.SHARP_style_probe(
|
probe = tools.initializers.SHARP_style_probe(
|
||||||
dataset,
|
dataset,
|
||||||
propagation_distance=propagation_distance,
|
propagation_distance=propagation_distance,
|
||||||
@@ -273,7 +273,6 @@ class MultislicePtycho(CDIModel):
|
|||||||
dataset,
|
dataset,
|
||||||
obj_basis,
|
obj_basis,
|
||||||
probe_shape,
|
probe_shape,
|
||||||
probe_size,
|
|
||||||
propagation_distance=propagation_distance,
|
propagation_distance=propagation_distance,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ def gaussian_probe(dataset, basis, shape, sigma, propagation_distance=0, polariz
|
|||||||
polarizer = dataset.polarizer.tolist()
|
polarizer = dataset.polarizer.tolist()
|
||||||
analyzer = dataset.analyzer.tolist()
|
analyzer = dataset.analyzer.tolist()
|
||||||
factors = [(math.cos(math.radians(polarizer[idx] - analyzer[idx])))**2 for idx in range(len(dataset)) if (abs(polarizer[idx] - analyzer[idx]) > 5)]
|
factors = [(math.cos(math.radians(polarizer[idx] - analyzer[idx])))**2 for idx in range(len(dataset)) if (abs(polarizer[idx] - analyzer[idx]) > 5)]
|
||||||
avg_intensities = [t.sum(dataset[idx][1]) / factor[idx] for idx in range(len(dataset))]
|
avg_intensities = [t.sum(dataset[idx][1]) / factors[idx] for idx in range(len(dataset))]
|
||||||
|
|
||||||
avg_intensity = t.mean(t.tensor(avg_intensities))
|
avg_intensity = t.mean(t.tensor(avg_intensities))
|
||||||
probe_intensity = t.sum(t.abs(probe)**2)
|
probe_intensity = t.sum(t.abs(probe)**2)
|
||||||
|
|||||||
Reference in new issue
Block a user