From 7eded9dc477ccfdb1a7844fde3a77eedc7cde653 Mon Sep 17 00:00:00 2001 From: Stephanie Ribet Date: Sun, 26 May 2024 13:50:51 -0700 Subject: [PATCH 1/4] bug in polar peak detection --- py4DSTEM/process/polar/polar_peaks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/py4DSTEM/process/polar/polar_peaks.py b/py4DSTEM/process/polar/polar_peaks.py index 82138d15a..535ae7143 100644 --- a/py4DSTEM/process/polar/polar_peaks.py +++ b/py4DSTEM/process/polar/polar_peaks.py @@ -164,6 +164,7 @@ def find_peaks_single_pattern( im_polar_sm, num_peaks=num_peaks_max, threshold_abs=threshold_abs, + exclude_border=False, ) # check if peaks should be removed from the polar transformation mask From c49f745cf67ae2e706638d681055f1b13b56fd0b Mon Sep 17 00:00:00 2001 From: Stephanie Ribet Date: Mon, 27 May 2024 07:48:26 -0700 Subject: [PATCH 2/4] option to replace NaN --- py4DSTEM/process/calibration/origin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/py4DSTEM/process/calibration/origin.py b/py4DSTEM/process/calibration/origin.py index 7f0c07a81..41c87f0e0 100644 --- a/py4DSTEM/process/calibration/origin.py +++ b/py4DSTEM/process/calibration/origin.py @@ -226,6 +226,7 @@ def get_origin( dp_max=None, mask=None, fast_center=False, + remove_NaN=False, ): """ Find the origin for all diffraction patterns in a datacube, assuming (a) there is no @@ -253,6 +254,8 @@ def get_origin( arrays are returned for qx0,qy0 fast_center: (bool) Skip the center of mass refinement step. + remove_NaN: (bool) + If True, sets NaN to mean value Returns: (2-tuple of (R_Nx,R_Ny)-shaped ndarrays): the origin, (x,y) at each scan position @@ -317,6 +320,10 @@ def get_origin( else: qx0.mask, qy0.mask = True, True + if remove_NaN: + qx0[np.isnan(qx0)] = np.mean(qx0[~np.isnan(qx0)]) + qy0[np.isnan(qy0)] = np.mean(qy0[~np.isnan(qy0)]) + # return mask = np.ones(datacube.Rshape, dtype=bool) return qx0, qy0, mask From 4fb8f7ffbac89fafadba6b3fcfad64a73189bc81 Mon Sep 17 00:00:00 2001 From: Stephanie Ribet Date: Tue, 28 May 2024 08:10:06 -0700 Subject: [PATCH 3/4] pypi comment in --- .github/workflows/pypi_upload.yml | 162 +++++++++++++++--------------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/.github/workflows/pypi_upload.yml b/.github/workflows/pypi_upload.yml index 900d6cf94..dd9bbe3f0 100644 --- a/.github/workflows/pypi_upload.yml +++ b/.github/workflows/pypi_upload.yml @@ -1,87 +1,87 @@ -# # Action to check the version of the package and upload it to PyPI -# # if the version is higher than the one on PyPI -# name: PyPI Upload +# Action to check the version of the package and upload it to PyPI +# if the version is higher than the one on PyPI +name: PyPI Upload -# on: -# push: -# branches: -# - main -# # pull_request: -# # branches: -# # - main +on: + push: + branches: + - main + # pull_request: + # branches: + # - main -# jobs: -# update_version: -# runs-on: ubuntu-latest -# name: Check if version.py is changed and update if the version.py is not changed -# steps: -# - uses: actions/checkout@v4 -# with: -# fetch-depth: 0 -# token: ${{ secrets.GH_ACTION_VERSION_UPDATE }} -# - name: Get changed files -# id: changed-files-specific -# uses: tj-actions/changed-files@v43 -# with: -# files: | -# py4DSTEM/version.py -# - name: Debug version file change checker -# run: | -# echo "Checking variable..." -# echo ${{ steps.changed-files-specific.outputs.any_changed }} -# echo "Done" -# - name: Running if py4DSTEM/version.py file is not changed -# if: steps.changed-files-specific.outputs.any_changed == 'false' -# run: | -# echo "Version file not changed, running script to change the version file." -# #git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} -# python .github/scripts/update_version.py -# git config --global user.email "ben.savitzky@gmail.com" -# git config --global user.name "bsavitzky" -# git commit -a -m "Auto-update version number (GH Action)" -# git push origin +jobs: + update_version: + runs-on: ubuntu-latest + name: Check if version.py is changed and update if the version.py is not changed + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GH_ACTION_VERSION_UPDATE }} + - name: Get changed files + id: changed-files-specific + uses: tj-actions/changed-files@v43 + with: + files: | + py4DSTEM/version.py + - name: Debug version file change checker + run: | + echo "Checking variable..." + echo ${{ steps.changed-files-specific.outputs.any_changed }} + echo "Done" + - name: Running if py4DSTEM/version.py file is not changed + if: steps.changed-files-specific.outputs.any_changed == 'false' + run: | + echo "Version file not changed, running script to change the version file." + #git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} + python .github/scripts/update_version.py + git config --global user.email "ben.savitzky@gmail.com" + git config --global user.name "bsavitzky" + git commit -a -m "Auto-update version number (GH Action)" + git push origin -# sync_with_dev: -# needs: update_version -# runs-on: ubuntu-latest -# name: Sync main with dev -# steps: -# - name: Sync main with dev -# uses: actions/checkout@v4 -# with: -# ref: dev -# fetch-depth: 0 -# token: ${{ secrets.GH_ACTION_VERSION_UPDATE }} -# - run: | -# # set strategy to default merge -# git config pull.rebase false -# git config --global user.email "ben.savitzky@gmail.com" -# git config --global user.name "bsavitzky" -# git pull origin main --commit --no-edit -# git push origin dev -# deploy: -# needs: sync_with_dev -# runs-on: ubuntu-latest -# name: Deploy to PyPI -# steps: -# - uses: actions/checkout@v4 -# with: -# ref: dev -# - name: Set up Python -# uses: actions/setup-python@v5 -# with: -# python-version: 3.8 -# - name: Install dependencies -# run: | -# python -m pip install --upgrade pip -# pip install build -# - name: Build package -# run: python -m build -# - name: Publish package -# uses: pypa/gh-action-pypi-publish@release/v1 -# with: -# user: __token__ -# password: ${{ secrets.PYPI_API_TOKEN }} + sync_with_dev: + needs: update_version + runs-on: ubuntu-latest + name: Sync main with dev + steps: + - name: Sync main with dev + uses: actions/checkout@v4 + with: + ref: dev + fetch-depth: 0 + token: ${{ secrets.GH_ACTION_VERSION_UPDATE }} + - run: | + # set strategy to default merge + git config pull.rebase false + git config --global user.email "ben.savitzky@gmail.com" + git config --global user.name "bsavitzky" + git pull origin main --commit --no-edit + git push origin dev + deploy: + needs: sync_with_dev + runs-on: ubuntu-latest + name: Deploy to PyPI + steps: + - uses: actions/checkout@v4 + with: + ref: dev + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} From 7df84785f5ac773f24c24fc8ddd3beb57034061e Mon Sep 17 00:00:00 2001 From: Stephanie Ribet Date: Tue, 28 May 2024 08:13:02 -0700 Subject: [PATCH 4/4] remove pypi upload --- .github/workflows/pypi_upload.yml | 87 ------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 .github/workflows/pypi_upload.yml diff --git a/.github/workflows/pypi_upload.yml b/.github/workflows/pypi_upload.yml deleted file mode 100644 index dd9bbe3f0..000000000 --- a/.github/workflows/pypi_upload.yml +++ /dev/null @@ -1,87 +0,0 @@ -# Action to check the version of the package and upload it to PyPI -# if the version is higher than the one on PyPI -name: PyPI Upload - -on: - push: - branches: - - main - # pull_request: - # branches: - # - main - -jobs: - update_version: - runs-on: ubuntu-latest - name: Check if version.py is changed and update if the version.py is not changed - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GH_ACTION_VERSION_UPDATE }} - - name: Get changed files - id: changed-files-specific - uses: tj-actions/changed-files@v43 - with: - files: | - py4DSTEM/version.py - - name: Debug version file change checker - run: | - echo "Checking variable..." - echo ${{ steps.changed-files-specific.outputs.any_changed }} - echo "Done" - - name: Running if py4DSTEM/version.py file is not changed - if: steps.changed-files-specific.outputs.any_changed == 'false' - run: | - echo "Version file not changed, running script to change the version file." - #git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} - python .github/scripts/update_version.py - git config --global user.email "ben.savitzky@gmail.com" - git config --global user.name "bsavitzky" - git commit -a -m "Auto-update version number (GH Action)" - git push origin - - sync_with_dev: - needs: update_version - runs-on: ubuntu-latest - name: Sync main with dev - steps: - - name: Sync main with dev - uses: actions/checkout@v4 - with: - ref: dev - fetch-depth: 0 - token: ${{ secrets.GH_ACTION_VERSION_UPDATE }} - - run: | - # set strategy to default merge - git config pull.rebase false - git config --global user.email "ben.savitzky@gmail.com" - git config --global user.name "bsavitzky" - git pull origin main --commit --no-edit - git push origin dev - deploy: - needs: sync_with_dev - runs-on: ubuntu-latest - name: Deploy to PyPI - steps: - - uses: actions/checkout@v4 - with: - ref: dev - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - - -