Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating whole pattern fitting for v 0.14.3 #493

Merged
merged 56 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
99e0936
origin fitting plot bug fix
cophus Sep 24, 2022
a3647de
Merge remote-tracking branch 'py4dstem/dev' into polar_peaks
cophus Apr 12, 2023
ce22f75
Inital polar peaks class
cophus Apr 13, 2023
82b591d
Adding simple peak fitting function
cophus Apr 13, 2023
9764297
More plotting functions
cophus Apr 13, 2023
67eda01
Merge branch 'polar_peaks' into py4dstem/dev
cophus Apr 13, 2023
9eb419d
Merge remote-tracking branch 'py4dstem/dev' into polar_peaks
cophus Apr 13, 2023
dd5c97a
fixing bug
cophus Apr 13, 2023
4f3390e
Adding grain clustering + plotting
cophus Apr 15, 2023
81ccd09
Fixing clustering
cophus May 13, 2023
10d47f8
fixing major bug in clustering
cophus May 13, 2023
c65fbfb
Merge remote-tracking branch 'py4dstem/dev' into polar_peaks
cophus May 15, 2023
42fccd6
Merge remote-tracking branch 'py4dstem/dev' into whole_pattern_fitting
cophus Jun 8, 2023
78fc2a6
Fixing add beamstop bug
cophus Jun 8, 2023
275ad9f
Merge branch 'dev' into whole_pattern_fitting
sezelt Jun 25, 2023
ff38927
starting to switch to externally managed offset for WPF parameters
sezelt Jun 25, 2023
91aaf82
Merge remote-tracking branch 'origin/whole_pattern_fitting' into whol…
cophus Jul 11, 2023
0c187c3
Merge branch 'polar_peaks' into whole_pattern_fitting
cophus Jul 11, 2023
4711c68
Merge remote-tracking branch 'py4dstem/dev' into whole_pattern_fitting
cophus Jul 28, 2023
ca785d6
Visualization tweaks
cophus Jul 28, 2023
81c7087
Updating viz to have white/black text
cophus Jul 28, 2023
0a0f5eb
Updates
cophus Jul 28, 2023
f1d9304
Parallel fitting working
cophus Jul 28, 2023
f654d7e
Cleaning up
cophus Jul 28, 2023
e8e1f3a
minor cleanup
cophus Jul 29, 2023
5b89bce
Removing old polar peaks
cophus Jul 29, 2023
32a4a41
Adding mpire to requirements
cophus Jul 30, 2023
907489e
Removing polar peaks py file
cophus Jul 30, 2023
ef968cb
Merge branch 'wpf_model_link' into whole_pattern_fitting
sezelt Aug 6, 2023
46541ee
building out parameter sharing infra
sezelt Aug 6, 2023
fa90c54
add model type flags and format
sezelt Aug 6, 2023
4e7a7d8
starting moire model
sezelt Aug 6, 2023
e3d9b4e
add linking function
sezelt Aug 6, 2023
9b5fa04
new offset assignment logic
sezelt Aug 6, 2023
f77552f
remove global special case in gaussian bkgd
sezelt Aug 8, 2023
54ff82f
remove global special case from gaussian ring
sezelt Aug 8, 2023
022b941
fully convert synthetic disk model and squash bugs
sezelt Aug 9, 2023
d5aa018
link multiple models at the same time and fix plots
sezelt Aug 9, 2023
d143cd1
changes to distributed WPF
sezelt Aug 9, 2023
c377e57
linter fixes
sezelt Aug 9, 2023
da829eb
fix how fit data is stored, improve distributed
sezelt Aug 10, 2023
5dc18dc
initialization of moire object built out
sezelt Aug 10, 2023
c88f7e3
moire generates pattern but derivatives are not complete
sezelt Aug 11, 2023
64dde4d
Fix for the mask in real space
cophus Aug 13, 2023
f4f3f42
Typo
cophus Aug 13, 2023
4441083
fixes for moire, derivative now working
sezelt Aug 14, 2023
087cd38
allow each moire disk to have separate intensity
sezelt Aug 14, 2023
fef118c
remove fit gamma scaling
sezelt Aug 14, 2023
fa6934a
add docstrings all around
sezelt Aug 14, 2023
c825e0d
update the weird lattice models to maybe work with new architecture
sezelt Aug 14, 2023
9b79ef5
linter fixes
sezelt Aug 14, 2023
51f6c1e
another linter fix
sezelt Aug 14, 2023
4fe16dd
improvements to moire
sezelt Aug 15, 2023
a578578
small updates
smribet Aug 18, 2023
d5652e3
wpf imports
smribet Aug 18, 2023
c6eaaac
fix for moire cell generation
sezelt Aug 18, 2023
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
8 changes: 4 additions & 4 deletions py4DSTEM/datacube/datacube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,11 +1126,11 @@ def get_beamstop_mask(
name = 'gen_params',
data = {
#'gen_func' :
'threshold' : 0.25,
'distance_edge' : 4.0,
'include_edges' : True,
'threshold' : threshold,
'distance_edge' : distance_edge,
'include_edges' : include_edges,
'name' : "mask_beamstop",
'returncalc' : True,
'returncalc' : returncalc,
}
)

Expand Down
29 changes: 19 additions & 10 deletions py4DSTEM/process/calibration/origin.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ def get_origin_single_dp(dp, r, rscale=1.2):

def get_origin(
datacube,
r=None,
rscale=1.2,
dp_max=None,
mask=None
r = None,
rscale = 1.2,
dp_max = None,
mask = None,
fast_center = False,
):
"""
Find the origin for all diffraction patterns in a datacube, assuming (a) there is no
Expand All @@ -241,6 +242,8 @@ def get_origin(
mask (ndarray or None): if not None, should be an (R_Nx,R_Ny) shaped
boolean array. Origin is found only where mask==True, and masked
arrays are returned for qx0,qy0
fast_center: (bool)
Skip the center of mass refinement step.

Returns:
(2-tuple of (R_Nx,R_Ny)-shaped ndarrays): the origin, (x,y) at each scan position
Expand All @@ -266,10 +269,13 @@ def get_origin(
):
dp = datacube.data[rx, ry, :, :]
_qx0, _qy0 = np.unravel_index(
np.argmax(gaussian_filter(dp, r)), (datacube.Q_Nx, datacube.Q_Ny)
np.argmax(gaussian_filter(dp, r, mode='nearest')), (datacube.Q_Nx, datacube.Q_Ny)
)
_mask = np.hypot(qxx - _qx0, qyy - _qy0) < r * rscale
qx0[rx, ry], qy0[rx, ry] = get_CoM(dp * _mask)
if fast_center:
qx0[rx, ry], qy0[rx, ry] = _qx0, _qy0
else:
_mask = np.hypot(qxx - _qx0, qyy - _qy0) < r * rscale
qx0[rx, ry], qy0[rx, ry] = get_CoM(dp * _mask)

else:
assert mask.shape == (datacube.R_Nx, datacube.R_Ny)
Expand All @@ -290,10 +296,13 @@ def get_origin(
if mask[rx, ry]:
dp = datacube.data[rx, ry, :, :]
_qx0, _qy0 = np.unravel_index(
np.argmax(gaussian_filter(dp, r)), (datacube.Q_Nx, datacube.Q_Ny)
np.argmax(gaussian_filter(dp, r, mode='nearest')), (datacube.Q_Nx, datacube.Q_Ny)
)
_mask = np.hypot(qxx - _qx0, qyy - _qy0) < r * rscale
qx0.data[rx, ry], qy0.data[rx, ry] = get_CoM(dp * _mask)
if fast_center:
qx0[rx, ry], qy0[rx, ry] = _qx0, _qy0
else:
_mask = np.hypot(qxx - _qx0, qyy - _qy0) < r * rscale
qx0.data[rx, ry], qy0.data[rx, ry] = get_CoM(dp * _mask)
else:
qx0.mask, qy0.mask = True, True

Expand Down
Loading