Skip to content

Commit

Permalink
resolve ben/v15->py4dstem/dev conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
bsavitzky committed Mar 12, 2024
2 parents f47a3b4 + d5c102a commit 48fb834
Show file tree
Hide file tree
Showing 67 changed files with 10,886 additions and 211 deletions.
60 changes: 13 additions & 47 deletions py4DSTEM/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from emdfile import tqdmnd


### io
### Utility functions
from py4DSTEM.utils import *

# substructure
### IO substructure
from emdfile import (
Node,
Root,
Expand All @@ -15,17 +16,13 @@
Custom,
print_h5_tree,
)

_emd_hook = True

# structure
# IO structure
from py4DSTEM import io
from py4DSTEM.io import import_file, read, save


### basic data classes

# data
### Basic data classes
from py4DSTEM.data import (
Data,
Calibration,
Expand All @@ -34,60 +31,29 @@
QPoints,
)

# datacube
from py4DSTEM.datacube import DataCube, VirtualImage, VirtualDiffraction


### visualization

### Visualization
from py4DSTEM import visualize
from py4DSTEM.visualize import show, show_complex

### analysis classes

# braggvectors
from py4DSTEM.braggvectors import (
Probe,
BraggVectors,
BraggVectorMap,
)

# Analysis classes
from py4DSTEM.datacube import DataCube
from py4DSTEM.datacube import VirtualImage, VirtualDiffraction
from py4DSTEM.datacube.diskdetection import Probe
from py4DSTEM.braggvectors import BraggVectors, BraggVectorMap
from py4DSTEM.process import classification


# diffraction
from py4DSTEM.process.diffraction import Crystal, Orientation


# ptycho
from py4DSTEM.process import phase


# polar
from py4DSTEM.process.polar import PolarDatacube


# strain
from py4DSTEM.process.strain.strain import StrainMap

from py4DSTEM.process import wholepatternfit


### more submodules
# TODO

from py4DSTEM import preprocess
from py4DSTEM import process


### utilities

# config
### Config
from py4DSTEM.utils.configuration_checker import check_config

# TODO - config .toml

# testing
from os.path import dirname, join

_TESTPATH = join(dirname(__file__), "../test/unit_test_data")

3 changes: 0 additions & 3 deletions py4DSTEM/braggvectors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
from py4DSTEM.braggvectors.probe import Probe
from py4DSTEM.braggvectors.braggvectors import BraggVectors
from py4DSTEM.braggvectors.braggvector_methods import BraggVectorMap
from py4DSTEM.braggvectors.diskdetection import *
from py4DSTEM.braggvectors.probe import *

# from .diskdetection_aiml import *
# from .diskdetection_parallel_new import *
8 changes: 4 additions & 4 deletions py4DSTEM/braggvectors/braggvector_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
from __future__ import annotations
import inspect
from warnings import warn

from scipy.ndimage import gaussian_filter
import matplotlib.pyplot as plt
import numpy as np

from emdfile import Array, Metadata, _read_metadata, tqdmnd
from py4DSTEM import show
from py4DSTEM.utils import get_CoM
from py4DSTEM.datacube import VirtualImage
from scipy.ndimage import gaussian_filter



class BraggVectorMethods:
Expand Down Expand Up @@ -384,8 +386,6 @@ def measure_origin(
np.argmax(gaussian_filter(bvm, 10)), (Q_Nx, Q_Ny)
)
else:
from py4DSTEM.process.utils import get_CoM

x0, y0 = get_CoM(bvm)
else:
x0, y0 = center_guess
Expand Down
2 changes: 2 additions & 0 deletions py4DSTEM/datacube/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
from py4DSTEM.datacube.datacube import DataCube
from py4DSTEM.datacube.virtualimage import VirtualImage
from py4DSTEM.datacube.virtualdiffraction import VirtualDiffraction
from py4DSTEM.datacube.diskdetection.probe import Probe

29 changes: 13 additions & 16 deletions py4DSTEM/datacube/datacube.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@
distance_transform_edt,
binary_fill_holes,
gaussian_filter1d,
gaussian_filter,
)
gaussian_filter,)
from typing import Optional, Union

from emdfile import Array, Metadata, Node, Root, tqdmnd
from py4DSTEM.data import Data, Calibration
from py4DSTEM.datacube.virtualimage import DataCubeVirtualImager
from py4DSTEM.datacube.virtualdiffraction import DataCubeVirtualDiffraction
from py4DSTEM.datacube.preprocess import Preprocessor
from py4DSTEM.datacube.virtualimage import VirtualImager
from py4DSTEM.datacube.virtualdiffraction import VirtualDiffractioner
from py4DSTEM.datacube.diskdetection import BraggFinder
from py4DSTEM.datacube.diskdetection import ProbeMaker



class DataCube(
Array,
Data,
DataCubeVirtualImager,
DataCubeVirtualDiffraction,
Preprocessor,
VirtualImager,
VirtualDiffractioner,
BraggFinder,
ProbeMaker,
):
"""
Storage and processing methods for 4D-STEM datasets.
Expand Down Expand Up @@ -304,16 +310,6 @@ def add(self, data, name=""):
if isinstance(data, np.ndarray):
data = Array(data=data, name=name)
self.attach(data)

def set_scan_shape(self, Rshape):
"""
Reshape the data given the real space scan shape.
Accepts:
Rshape (2-tuple)
"""
from py4DSTEM.preprocess import set_scan_shape

assert len(Rshape) == 2, "Rshape must have a length of 2"
d = set_scan_shape(self, Rshape[0], Rshape[1])
return d
Expand Down Expand Up @@ -1342,3 +1338,4 @@ def get_braggmask(self, braggvectors, rx, ry, radius):
qr = np.hypot(self.qxx_raw - vects.qx[idx], self.qyy_raw - vects.qy[idx])
mask = np.logical_and(mask, qr > radius)
return mask

5 changes: 5 additions & 0 deletions py4DSTEM/datacube/diskdetection/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

from py4DSTEM.datacube.diskdetection.probe import Probe,ProbeMaker
from py4DSTEM.datacube.diskdetection.braggfinder import BraggFinder


Loading

0 comments on commit 48fb834

Please sign in to comment.