From 3cdf1c5e1f7bf1fd0ddeb42fc487879889c9a886 Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Thu, 31 Aug 2023 16:45:35 -0700 Subject: [PATCH 1/8] adding black definition to pyproject.toml --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..82c669ff6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +[tool.black] +target-version = ['py39', 'py310', 'py311'] +# line-length = 88 +exclude = '__init__.py' \ No newline at end of file From ed1b386e408cc3833655647a9940b0fbd7bd64a8 Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Thu, 31 Aug 2023 17:26:53 -0700 Subject: [PATCH 2/8] Revert "adding black definition to pyproject.toml" --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 82c669ff6..000000000 --- a/pyproject.toml +++ /dev/null @@ -1,4 +0,0 @@ -[tool.black] -target-version = ['py39', 'py310', 'py311'] -# line-length = 88 -exclude = '__init__.py' \ No newline at end of file From a2b5309a03e67a5c07b7e9b3245169172b93999f Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Thu, 31 Aug 2023 17:27:52 -0700 Subject: [PATCH 3/8] running black with new defintions --- py4DSTEM/braggvectors/diskdetection_aiml.py | 2 +- py4DSTEM/braggvectors/diskdetection_aiml_cuda.py | 2 +- .../braggvectors/diskdetection_parallel_new.py | 4 ++-- py4DSTEM/io/filereaders/read_mib.py | 2 +- py4DSTEM/process/diffraction/crystal_viz.py | 2 +- py4DSTEM/visualize/show.py | 14 +++++++------- py4DSTEM/visualize/vis_RQ.py | 2 +- py4DSTEM/visualize/vis_special.py | 16 ++++++++-------- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/py4DSTEM/braggvectors/diskdetection_aiml.py b/py4DSTEM/braggvectors/diskdetection_aiml.py index 67df18074..68c01a851 100644 --- a/py4DSTEM/braggvectors/diskdetection_aiml.py +++ b/py4DSTEM/braggvectors/diskdetection_aiml.py @@ -559,7 +559,7 @@ def find_Bragg_disks_aiml( model_path=None, distributed=None, CUDA=True, - **kwargs + **kwargs, ): """ Finds the Bragg disks in all diffraction patterns of datacube by AI/ML method. This method diff --git a/py4DSTEM/braggvectors/diskdetection_aiml_cuda.py b/py4DSTEM/braggvectors/diskdetection_aiml_cuda.py index d0f550dcc..649680634 100644 --- a/py4DSTEM/braggvectors/diskdetection_aiml_cuda.py +++ b/py4DSTEM/braggvectors/diskdetection_aiml_cuda.py @@ -265,7 +265,7 @@ def _find_Bragg_disks_aiml_single_DP_CUDA( blocks=None, threads=None, model_path=None, - **kwargs + **kwargs, ): """ Finds the Bragg disks in single DP by AI/ML method. This method utilizes FCU-Net diff --git a/py4DSTEM/braggvectors/diskdetection_parallel_new.py b/py4DSTEM/braggvectors/diskdetection_parallel_new.py index c15e41732..6771cb9af 100644 --- a/py4DSTEM/braggvectors/diskdetection_parallel_new.py +++ b/py4DSTEM/braggvectors/diskdetection_parallel_new.py @@ -100,7 +100,7 @@ def beta_parallel_disk_detection( close_dask_client=False, return_dask_client=True, *args, - **kwargs + **kwargs, ): """ This is not fully validated currently so may not work, please report bugs on the py4DSTEM github page. @@ -225,7 +225,7 @@ def beta_parallel_disk_detection( probe_kernel_FT=dask_probe_delayed[0, 0], # probe_kernel_FT=delayed_probe_kernel_FT, *args, - **kwargs + **kwargs, ) # passing through args from earlier or should I use # corrPower=corrPower, # sigma=sigma_gaussianFilter, diff --git a/py4DSTEM/io/filereaders/read_mib.py b/py4DSTEM/io/filereaders/read_mib.py index 079c9d1bd..7456bd594 100644 --- a/py4DSTEM/io/filereaders/read_mib.py +++ b/py4DSTEM/io/filereaders/read_mib.py @@ -14,7 +14,7 @@ def load_mib( reshape=True, flip=True, scan=(256, 256), - **kwargs + **kwargs, ): """ Read a MIB file and return as py4DSTEM DataCube. diff --git a/py4DSTEM/process/diffraction/crystal_viz.py b/py4DSTEM/process/diffraction/crystal_viz.py index 8ffd558e9..c8876dd59 100644 --- a/py4DSTEM/process/diffraction/crystal_viz.py +++ b/py4DSTEM/process/diffraction/crystal_viz.py @@ -1888,7 +1888,7 @@ def plot_ring_pattern( figsize=(10, 10), returnfig=False, input_fig_handle=None, - **kwargs + **kwargs, ): """ 2D plot of diffraction rings diff --git a/py4DSTEM/visualize/show.py b/py4DSTEM/visualize/show.py index 3b9e9437d..2c8266168 100644 --- a/py4DSTEM/visualize/show.py +++ b/py4DSTEM/visualize/show.py @@ -75,7 +75,7 @@ def show( theta=None, title=None, show_fft=False, - **kwargs + **kwargs, ): """ General visualization function for 2D arrays. @@ -891,7 +891,7 @@ def show_Q( gridlabelsize=12, gridlabelcolor="k", alpha=0.35, - **kwargs + **kwargs, ): """ Shows a diffraction space image with options for several overlays to define the scale, @@ -1131,7 +1131,7 @@ def show_rectangles( alpha=0.25, linewidth=2, returnfig=False, - **kwargs + **kwargs, ): """ Visualization function which plots a 2D array with one or more overlayed rectangles. @@ -1184,7 +1184,7 @@ def show_circles( alpha=0.3, linewidth=2, returnfig=False, - **kwargs + **kwargs, ): """ Visualization function which plots a 2D array with one or more overlayed circles. @@ -1239,7 +1239,7 @@ def show_ellipses( alpha=0.3, linewidth=2, returnfig=False, - **kwargs + **kwargs, ): """ Visualization function which plots a 2D array with one or more overlayed ellipses. @@ -1295,7 +1295,7 @@ def show_annuli( alpha=0.3, linewidth=2, returnfig=False, - **kwargs + **kwargs, ): """ Visualization function which plots a 2D array with one or more overlayed annuli. @@ -1347,7 +1347,7 @@ def show_points( open_circles=False, title=None, returnfig=False, - **kwargs + **kwargs, ): """ Plots a 2D array with one or more points. diff --git a/py4DSTEM/visualize/vis_RQ.py b/py4DSTEM/visualize/vis_RQ.py index 6c2fbff3c..85c0eb042 100644 --- a/py4DSTEM/visualize/vis_RQ.py +++ b/py4DSTEM/visualize/vis_RQ.py @@ -15,7 +15,7 @@ def show_selected_dp( pointsize=50, pointcolor="r", scaling="log", - **kwargs + **kwargs, ): """ """ dp = datacube.data[rx, ry, :, :] diff --git a/py4DSTEM/visualize/vis_special.py b/py4DSTEM/visualize/vis_special.py index 89f09606a..b185c616d 100644 --- a/py4DSTEM/visualize/vis_special.py +++ b/py4DSTEM/visualize/vis_special.py @@ -31,7 +31,7 @@ def show_elliptical_fit( linewidth_ann=2, linewidth_ell=2, returnfig=False, - **kwargs + **kwargs, ): """ Plots an elliptical curve over its annular fit region. @@ -97,7 +97,7 @@ def show_amorphous_ring_fit( ellipse_alpha=0.7, ellipse_lw=2, returnfig=False, - **kwargs + **kwargs, ): """ Display a diffraction pattern with a fit to its amorphous ring, interleaving @@ -225,7 +225,7 @@ def show_qprofile( ticklabelsize=14, grid=True, label=None, - **kwargs + **kwargs, ): """ Plots a diffraction space radial profile. @@ -302,7 +302,7 @@ def show_voronoi( color_lines="w", max_dist=None, returnfig=False, - **kwargs + **kwargs, ): """ words @@ -375,7 +375,7 @@ def show_class_BPs_grid( axsize=(6, 6), titlesize=0, get_bordercolor=None, - **kwargs + **kwargs, ): """ words @@ -732,7 +732,7 @@ def select_point( color_selected="r", size=20, returnfig=False, - **kwargs + **kwargs, ): """ Show enumerated index labels for a set of points, with one selected point highlighted @@ -857,7 +857,7 @@ def show_selected_dps( HW=None, figsize_im=(6, 6), figsize_dp=(4, 4), - **kwargs + **kwargs, ): """ Shows two plots: first, a real space image overlaid with colored dots @@ -1011,7 +1011,7 @@ def show_complex( returnfig=False, hue_start=0, invert=False, - **kwargs + **kwargs, ): """ Function to plot complex arrays From 647f5e50f90baf3617d3baddd8b8f2d44507d805 Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Fri, 3 Nov 2023 18:01:02 -0700 Subject: [PATCH 4/8] initial namespace chages --- py4DSTEM/__init__.py | 69 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/py4DSTEM/__init__.py b/py4DSTEM/__init__.py index dcb6a861d..2d312c437 100644 --- a/py4DSTEM/__init__.py +++ b/py4DSTEM/__init__.py @@ -52,18 +52,69 @@ BraggVectorMap, ) -# strain -from py4DSTEM.process import StrainMap +# TODO - classification +# from py4DSTEM.process.classification import ( +# BraggVectorClassification, +# ConvergenceWarning, +# DataCube, +# FastICA, +# Featurization, +# GaussianMixture, +# MinMaxScaler, +# NMF, +# PCA, +# PointListArray, +# RobustScaler, +# permutations, +# ) + +# diffraction +from py4DSTEM.process.diffraction import Crystal + +# py4DSTEM.process.diffraction +# ['Axes', 'Crystal', 'Crystal_Phase', 'Figure', 'Fraction', 'ListedColormap', 'Orientation', 'PointList', 'PointListArray', 'single_atom_scatter'] + + +# ptycho +from py4DSTEM.process.phase import ( + DPCReconstruction, + MixedstatePtychographicReconstruction, + MultislicePtychographicReconstruction, + OptimizationParameter, + OverlapMagneticTomographicReconstruction, + OverlapTomographicReconstruction, + ParallaxReconstruction, + PtychographyOptimizer, + SimultaneousPtychographicReconstruction, + SingleslicePtychographicReconstruction, +) -# TODO - crystal -# TODO - ptycho -# TODO - others +# polar +from py4DSTEM.process.polar import PolarDatacube -# TODO - where -from py4DSTEM.process import ( - PolarDatacube, -) +# from py4DSTEM.process import ( +# PolarDatacube, +# ) + +# strain +from py4DSTEM.process import StrainMap +# TODO WPF +# from py4DSTEM.process.wholepatternfit import ( +# ComplexOverlapKernelDiskLattice, +# DCBackground, +# Flag, +# GaussianBackground, +# GaussianRing, +# KernelDiskLattice, +# Parameter, +# SyntheticDiskLattice, +# SyntheticDiskMoire, +# WPFModel, +# WPFModelType, +# WholePatternFit, +# auto, +# ) ### more submodules # TODO From df069f824f1859e329dba736231733ee6b4b2bea Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Mon, 13 Nov 2023 10:29:52 -0800 Subject: [PATCH 5/8] p4DSTEM.phase/classification style --- py4DSTEM/__init__.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/py4DSTEM/__init__.py b/py4DSTEM/__init__.py index 627bfae5d..c721dcea2 100644 --- a/py4DSTEM/__init__.py +++ b/py4DSTEM/__init__.py @@ -52,8 +52,8 @@ BraggVectorMap, ) -# TODO - classification -# from py4DSTEM.process.classification import ( +from py4DSTEM.process import classification +# import ( # BraggVectorClassification, # ConvergenceWarning, # DataCube, @@ -76,18 +76,19 @@ # ptycho -from py4DSTEM.process.phase import ( - DPCReconstruction, - MixedstatePtychographicReconstruction, - MultislicePtychographicReconstruction, - OptimizationParameter, - OverlapMagneticTomographicReconstruction, - OverlapTomographicReconstruction, - ParallaxReconstruction, - PtychographyOptimizer, - SimultaneousPtychographicReconstruction, - SingleslicePtychographicReconstruction, -) +from py4DSTEM.process import phase +# import ( +# DPCReconstruction, +# MixedstatePtychographicReconstruction, +# MultislicePtychographicReconstruction, +# OptimizationParameter, +# OverlapMagneticTomographicReconstruction, +# OverlapTomographicReconstruction, +# ParallaxReconstruction, +# PtychographyOptimizer, +# SimultaneousPtychographicReconstruction, +# SingleslicePtychographicReconstruction, +# ) # polar from py4DSTEM.process.polar import PolarDatacube @@ -100,7 +101,8 @@ from py4DSTEM.process.strain.strain import StrainMap # TODO WPF -# from py4DSTEM.process.wholepatternfit import ( +from py4DSTEM.process import wholepatternfit +# import ( # ComplexOverlapKernelDiskLattice, # DCBackground, # Flag, From 82fcd88087927a50b49f871959ba09aa533ee0b7 Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Mon, 13 Nov 2023 10:32:05 -0800 Subject: [PATCH 6/8] black --- py4DSTEM/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/py4DSTEM/__init__.py b/py4DSTEM/__init__.py index c721dcea2..59b2cd8d4 100644 --- a/py4DSTEM/__init__.py +++ b/py4DSTEM/__init__.py @@ -52,7 +52,8 @@ BraggVectorMap, ) -from py4DSTEM.process import classification +from py4DSTEM.process import classification + # import ( # BraggVectorClassification, # ConvergenceWarning, @@ -76,7 +77,8 @@ # ptycho -from py4DSTEM.process import phase +from py4DSTEM.process import phase + # import ( # DPCReconstruction, # MixedstatePtychographicReconstruction, @@ -102,6 +104,7 @@ # TODO WPF from py4DSTEM.process import wholepatternfit + # import ( # ComplexOverlapKernelDiskLattice, # DCBackground, From e80ee4e6b9898a55f3154d7972c03e90495d2781 Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Mon, 13 Nov 2023 10:36:48 -0800 Subject: [PATCH 7/8] adding orientation --- py4DSTEM/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py4DSTEM/__init__.py b/py4DSTEM/__init__.py index 59b2cd8d4..59bcfcf0c 100644 --- a/py4DSTEM/__init__.py +++ b/py4DSTEM/__init__.py @@ -70,7 +70,7 @@ # ) # diffraction -from py4DSTEM.process.diffraction import Crystal +from py4DSTEM.process.diffraction import Crystal, Orientation # py4DSTEM.process.diffraction # ['Axes', 'Crystal', 'Crystal_Phase', 'Figure', 'Fraction', 'ListedColormap', 'Orientation', 'PointList', 'PointListArray', 'single_atom_scatter'] From 7cfdeba2d1265595ba277d6ec8d73d74ba9075a6 Mon Sep 17 00:00:00 2001 From: alex-rakowski Date: Mon, 13 Nov 2023 14:25:38 -0800 Subject: [PATCH 8/8] removing comments --- py4DSTEM/__init__.py | 48 -------------------------------------------- 1 file changed, 48 deletions(-) diff --git a/py4DSTEM/__init__.py b/py4DSTEM/__init__.py index 59bcfcf0c..d5df63f5e 100644 --- a/py4DSTEM/__init__.py +++ b/py4DSTEM/__init__.py @@ -54,72 +54,24 @@ from py4DSTEM.process import classification -# import ( -# BraggVectorClassification, -# ConvergenceWarning, -# DataCube, -# FastICA, -# Featurization, -# GaussianMixture, -# MinMaxScaler, -# NMF, -# PCA, -# PointListArray, -# RobustScaler, -# permutations, -# ) # diffraction from py4DSTEM.process.diffraction import Crystal, Orientation -# py4DSTEM.process.diffraction -# ['Axes', 'Crystal', 'Crystal_Phase', 'Figure', 'Fraction', 'ListedColormap', 'Orientation', 'PointList', 'PointListArray', 'single_atom_scatter'] - # ptycho from py4DSTEM.process import phase -# import ( -# DPCReconstruction, -# MixedstatePtychographicReconstruction, -# MultislicePtychographicReconstruction, -# OptimizationParameter, -# OverlapMagneticTomographicReconstruction, -# OverlapTomographicReconstruction, -# ParallaxReconstruction, -# PtychographyOptimizer, -# SimultaneousPtychographicReconstruction, -# SingleslicePtychographicReconstruction, -# ) # polar from py4DSTEM.process.polar import PolarDatacube -# from py4DSTEM.process import ( -# PolarDatacube, -# ) # strain from py4DSTEM.process.strain.strain import StrainMap -# TODO WPF from py4DSTEM.process import wholepatternfit -# import ( -# ComplexOverlapKernelDiskLattice, -# DCBackground, -# Flag, -# GaussianBackground, -# GaussianRing, -# KernelDiskLattice, -# Parameter, -# SyntheticDiskLattice, -# SyntheticDiskMoire, -# WPFModel, -# WPFModelType, -# WholePatternFit, -# auto, -# ) ### more submodules # TODO