Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
this is a test --


> :warning: **py4DSTEM version 0.14 update** :warning: Warning: this is a major update and we expect some workflows to break. You can still install previous versions of py4DSTEM [as discussed here](#legacyinstall)

> :warning: **Phase retrieval refactor version 0.14.9** :warning: Warning: The phase-retrieval modules in py4DSTEM (DPC, parallax, and ptychography) underwent a major refactor in version 0.14.9 and as such older tutorial notebooks will not work as expected. Notably, class names have been pruned to remove the trailing "Reconstruction" (`DPCReconstruction` -> `DPC` etc.), and regularization functions have dropped the `_iter` suffix (and are instead specified as boolean flags). See the [updated tutorials](https://github.com/py4dstem/py4DSTEM_tutorials) for more information.
Expand Down
31 changes: 28 additions & 3 deletions py4DSTEM/process/diffraction/crystal_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def quantify_single_pattern(
plot_correlation_radius=False,
scale_markers_experiment=40,
scale_markers_calculated=200,
max_marker_size = 400,
crystal_inds_plot=None,
phase_colors=None,
figsize=(10, 7),
Expand Down Expand Up @@ -615,16 +616,23 @@ def quantify_single_pattern(
qy0,
qx0,
# s = scale_markers_experiment * intensity0,
s=scale_markers_experiment
* bragg_peaks.data["intensity"][np.logical_not(keep)],
s=np.minimum(
scale_markers_experiment
* bragg_peaks.data["intensity"][np.logical_not(keep)],
max_marker_size,
),
marker="o",
facecolor=[0.7, 0.7, 0.7],
)
ax.scatter(
qy,
qx,
# s = scale_markers_experiment * intensity,
s=scale_markers_experiment * bragg_peaks.data["intensity"][keep],
s=np.minimum(
scale_markers_experiment
* bragg_peaks.data["intensity"][keep],
max_marker_size,
),
marker="o",
facecolor=[0.7, 0.7, 0.7],
)
Expand Down Expand Up @@ -799,6 +807,7 @@ def quantify_phase(
strain_max=0.02,
include_false_positives=True,
weight_false_positives=1.0,
weight_unmatched_peaks=1.0,
progress_bar=True,
):
"""
Expand Down Expand Up @@ -899,6 +908,7 @@ def quantify_phase(
strain_max=strain_max,
include_false_positives=include_false_positives,
weight_false_positives=weight_false_positives,
weight_unmatched_peaks=weight_unmatched_peaks,
plot_result=False,
verbose=False,
returnfig=False,
Expand Down Expand Up @@ -1220,6 +1230,7 @@ def plot_dominant_phase(
self,
use_correlation_scores=False,
reliability_range=(0.0, 1.0),
normalize_exp_intensity = True,
sigma=0.0,
phase_colors=None,
ticks=True,
Expand Down Expand Up @@ -1302,6 +1313,12 @@ def plot_dominant_phase(
sigma=sigma,
mode="nearest",
)
self.phase_sig = phase_sig

# # normalize the signal by the intensity of each experimental pattern
# if normalize_exp_intensity:
# phase_sig /= self.int_total[None,:,:]


# find highest correlation score for each crystal and match index
for a0 in range(self.num_crystals):
Expand All @@ -1327,6 +1344,12 @@ def plot_dominant_phase(

# Estimate the reliability
phase_rel = phase_corr - phase_corr_2nd

# normalize the reliability by the intensity of each experimental pattern
if normalize_exp_intensity:
phase_rel /= self.int_total


phase_scale = np.clip(
(phase_rel - reliability_range[0])
/ (reliability_range[1] - reliability_range[0]),
Expand All @@ -1351,6 +1374,8 @@ def plot_dominant_phase(
sub = phase_map == a0
for a1 in range(3):
self.phase_rgb[:, :, a1][sub] = phase_colors[a0, a1] * phase_scale[sub]

self.phase_scale = phase_scale
# normalize
# self.phase_rgb = np.clip(
# (self.phase_rgb - rel_range[0]) / (rel_range[1] - rel_range[0]),
Expand Down
Loading