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

Release memory after Bayesian optimization #599

Merged
merged 8 commits into from
Feb 28, 2024
Merged

Release memory after Bayesian optimization #599

merged 8 commits into from
Feb 28, 2024

Conversation

sezelt
Copy link
Member

@sezelt sezelt commented Jan 22, 2024

Previously the BO code retained a reference to the ptycho reconstruction, which in some cases would include a copy of the dataset. This ensures that these resources are released. Additionally it puts pbar.close() into a try/finally clause so the progressbar is always terminated correctly.

@sezelt sezelt requested a review from smribet January 22, 2024 19:09
@gvarnavi
Copy link
Member

Thanks @sezelt - looks good to me!

Quick-note re: how BO plays w/ the new device/storage memory management:

The current default behavior for clear_fft_cache=True is to clear the cupy FFT plans at the end of preprocess/reconstruct. This might make less sense for BO since we're running reconstruct over and over again.

The user can always specify clear_fft_cache=False in init_args to disable this, but perhaps it might make more sense to add this to _set_optimizer_defaults and simply call ptycho.clear_device_mem(ptycho._device,True) during the finally clause.

@sezelt
Copy link
Member Author

sezelt commented Jan 23, 2024

I'm curious, how much time does it actually take to generate the plan, and how much memory does it use?

@gvarnavi
Copy link
Member

I think it's actually not insignificant, since it's of the order of (max_batch_size,Qx,Qy).

You can get a feel on how slow it is by seeing how much slower the first ptycho iteration is from subsequent iterations with clear_fft_cache=True, and test the memory usage with the notebook I attached here.

@sezelt
Copy link
Member Author

sezelt commented Feb 8, 2024

I added clear_fft_cache=False to the default optimizer args. Calling ptycho.clear_device_mem is trickier because the ptycho object is wrapped by the optimizer function, so it's not in scope at the level of optimizer.optimize. I think the better solution (and one which potentially will fix other GPU memory usage issues I've been having in my notebooks recently even without using the optimizer) is for the ptycho object to clear the plans on its destruction.

@sezelt
Copy link
Member Author

sezelt commented Feb 8, 2024

There also seems to be something odd happening with the black style check, since it wants to reformat 21 files unrelated to this PR. Perhaps the version of black on the GH action has changed?

@sezelt
Copy link
Member Author

sezelt commented Feb 8, 2024

So it does seem a new version of black was released, and that has led to new rules in some places. I've applied the new formatting in this PR (the only functional changes are the ones originally described).

@sezelt
Copy link
Member Author

sezelt commented Feb 23, 2024

@gvarnavi I made the change you asked for, but haven't tested everything. Is the current approach to your liking?

Copy link
Member

@gvarnavi gvarnavi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks @sezelt!

@sezelt sezelt merged commit 6b3e8af into py4dstem:dev Feb 28, 2024
6 checks passed
sezelt added a commit that referenced this pull request Mar 21, 2024
* adding annotation import

* fft normalization

* upsampling limit bugs

* bilinear sampling during position correction

* sequential numerator-denominator pixel rolling to save memory

* some useful warnings for now

* add occupancy to CIF reader

* add occupancy to structure factors

* format with black

* removing optional conda comment

* adding dependencies comment

* Adding correlation metrics

* Correlation coefs finished

* Black formatting

* normalize_order = 0 bug

* plotting fixes

* switching to gray

* allowing python 12.1

* changing python requirement to <3.13

* changing install requirements

* adding initial fixes

* changing how peaks are accessed

* changing to PLA from BraggVectors

* changing to PLA from BraggVectors

* moving import to top of file

* black

* removing hardcoded link to sample collections

* adding overwrite

* typo

* typo

* removing accidental noteobok

* back to hardcoded id

* changing filename for FCU-Net file

* Adding ability to force filename for collection Items

* back to non hardcoded now gdrive function fixed

* removing print statements

* bumping allowed version of tensorflow

* black

* adding strain mapping back into WPF

* Finishing up

* Fixing minor bugs

* Black formatting

* removing test plotting

* doc strains for visualize strain

* bugs

* doc string update

* fixing reset=False bug

* explicit bin order

* some plotting preferences

* fixing upsampling limits

* explicit aberration orders fit

* fixing abtem bug, adding conversion to polar property

* adding ability to pass descan_correction_fit_function

* DCT-based poisson solver phase unwrapping

* constraints refactoring

* fixing reshaping bugs

* cleaning up calibrations

* cleaning up calculate rotation

* adding grid search functionality to optimize

* removing tuning functions from subclasses - moved to optimizer

* Update corr_kernel_size documentation

* small typo

* cupy numpy bug

* refactoring object and probe methods

* multislice plotting tweaks

* moved read-only self-attribute calls up-front. Might remove all-together, especially for positions

* cleaned up single-slice preprocess

* cleaned up multislice preprocess

* cleaned up mixedstate preprocess

* underscore typos

* underscore typos

* huh, not how super works

* cleaned up mixed-multi slice preprocess

* cleaned up overlap tomography preprocess

* removing redundant tune func from parallax

* moved single-slice forward and adjoint to methods.py

* added necessary multi-slice forward and adjoint methods

* added necessary mixed-state forward and adjoint methods

* added necessary mixed-state-multi-slce forward and adjoint methods

* removed redundant forward and adjoint methods from overlap tomo

* cleaned up single-slice reconstruct

* cleaned up multi-slice reconstruct

* cleaned up mixed-state reconstruct

* cleaned up mixed-state multi-slice reconstruct

* cleaned up overlap tomo reconstruct, different probes per tilt

* moved show_transmitted probe

* cleaned up self-consistency viz

* oops, forgot to delete duplicate code

* cleaned up position correction - is mixed state correct?

* more natural location for 3D function

* Bump tj-actions/changed-files from 39 to 41 in /.github/workflows

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 39 to 41.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v39...v41)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* added and cleaned up total position update functionality back in

* modernized probe position correction viz

* starting viz overhaul

* remove redundant figax viz functions

* added visualize_last functionality

* visualize_all for single-slice

* visualize_all for all

* small np cp bugs

* some figsize defaults

* histogram scaling for all

* added virtual detector mask

* adding dependabot.yml

* update to check_config workflow

* black

* adding dp_mask argument

* renamed to ptycho-tomo, started magnetic refactoring

* arina reader bug fix

* reconstruct functionality for iterative magnetic

* splitting up constraints

* bumping python version to 3.10

* correctly handling collective updates constraints

* Bugfix for forced scan sampling

Correctly set scan units when `force_scan_sampling` is used

* finished with magnetic ptycho

* phase unwrapping bugfixes

* Update py4DSTEM/io/filereaders/read_arina.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* better support for multiple measurements probe properties

* broadcasting polar coordinates

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* docstrings

* vectorized_fourier_resample docstrings

* generalized show_fourier_probe, added general show_probe, added intensity reporting

* visual tweaks

* removed leading iterative_ from file names and trailing Reconstruction from class names

* typo

* FFT plotting improvements

* Revert "FFT plotting improvements"

This reverts commit 6669195.

* Revert "typo"

This reverts commit 5990942.

* Revert "removed leading iterative_ from file names and trailing Reconstruction from class names"

This reverts commit 9114df5.

* removed leading iterative_ from file names and trailing Reconstruction from class names

* typo

* FFT plotting improvements

* switched divergence field functions to be periodic

* magnetic ptycho-tomo preprocessing

* magnetic ptycho tomo constraints

* magnetic ptycho tomo works

* improved 3D visualizations

* ragged list partitions support for complex plotting

* added detector plane resampling

* cleaned up cupyx.scipy imports

* added storage support for singleslice. other classes likely broken, will fix tomorrow

* actually enable overwriting device

* fixing single-slice projection sets bugs with storage refactor

* cleaning up multislice for device. changed propagator tilt convention to negative mrad

* added storage support to multislice

* adding mixed-state storage support

* added storage to mixed-multislice

* attrs copying cleanup

* added storage to dpc

* more dpc viz tweaks

* adding vectorized flag to CoM

* dp_mask can be None, dub

* adding batch size in single-slice preprocess

* adding to dpc, multislice, mixedstate, multislice-mixedstate

* adding some basic device cleanup to parallax, no storage yer

* magnetic ptycho preprocess storage support

* added full storage support for magnetic ptycho

* added storage to ptycho tomo

* added storage support to magnetic ptycho-tomo

* transferring parallax bug Steph found in phase_contrast

* Update CONTRIBUTORS.md

* Update CONTRIBUTORS.md

* Update CONTRIBUTORS.md

* Update CONTRIBUTORS.md

* Update CONTRIBUTORS.md

* tweaks to clear_fft_cache

* Create CODE_OF_CONDUCT.md

This is a suggested template that seems widely used and seems reasonable.

* adding FFT-based DCT-II implementations, fixing cupy10.6 bug

* small numpy bug

* cleaned up cupy 12 feature guarding using try-except

* restored scikit functionality

* scikit-image by default, poisson as flag

* various fixes discovered while making testing notebook

* position update bug fix

* syntax update for bug fix

* complex plotting grid search

* multislice grid search plotting

* read/write bug fix

* show hanning window fix

* typo fix

* mixedstate probe fourier constraint bug fix

* constrain first aperture only

* parallax verbosity to True

* ms butterworth bug

* silly George

* cleaning up warnings

* simplifying warnings, restructuring single  slice regularization flags

* one more read write bug fix

* more flags more problems: multislice, mixed state, and mixed-multislice

* dpc

* mistake in multislice

* flags to magnetic ptycho

* ptycho tomo flags

* magnetic ptycho tomo flags

* stricter flags

* perhaps i forgot an underscore

* small parallax change

* small read-write changes

* removing switch_obj_iter

* remore switch_iter from all classes

* show_fft bug

* Bump tj-actions/changed-files from 41 to 42

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 41 to 42.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v41...v42)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump github/super-linter from 4 to 5

Bumps [github/super-linter](https://github.com/github/super-linter) from 4 to 5.
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](github/super-linter@v4...v5)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump actions/setup-python from 2 to 5

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v2...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* minor fixes

* Friedel origin finder, various FEM tools (#607)

* bug fix

* Revert "bug fix"

This reverts commit cbce25c.

* num_probes_fit_aberrations

* flip 180 option for read arina

* ptycho positions offset

* remove 180 flip

* median_filter_masked_pixels

* save polar aberrations instead

* read-write compatibility

* uncertainty viz bug

* adding force_com_measured functionality to ptycho

* clean up force_com_measured

* adding DP normalization progress bar

* moving fov_mask calc to as needed

* adding detector_fourier_mask

* Auto center finding works!

* Adding center finding without a mask

* Adding plot range to show_origin_fit, fixing bug

* Adding local mean / variance functions for FEM

* Adding symmetry analysis and plotting

* Fix divide by zero in correlation origin finding function

* bug fix for filtering

* adding initial commit for friedel correlation origin finder

* Correlation working, but mask still buggy

* Fixing the masked CC

* Simplifying the expression

* cleaning up - still need subpixel shifts

* Update origin fitting visualization

* adding device arg to upsample function

* First attempt to add Friedel origin finding to ptycho

GPU not yet working

* Adding GPU implementation warning

* parabolic subpixel fitting

* minor updates

* Going back to dev version of phase contrast

* Changing np to xp for GPU compatibility

* Fixing xp = np device options

* Revering phase contrast options back to dev

* Cleaning up code, fixing GPU support

* black formatting

* black updates

* Adding annular symmetry plotting function

* black formatting

* cleaning typos and dead code and such

* Update py4DSTEM/process/polar/polar_analysis.py

Co-authored-by: Steve Zeltmann <[email protected]>

---------

Co-authored-by: Stephanie Ribet <[email protected]>
Co-authored-by: Georgios Varnavides <[email protected]>
Co-authored-by: gvarnavi <[email protected]>
Co-authored-by: SE Zeltmann <[email protected]>
Co-authored-by: Steve Zeltmann <[email protected]>

* Release memory after Bayesian optimization (#599)

* do not retain optimization function after finished running, to release memory

* update comment

* set clear_fft_cache off in optimizer defaults

* Update parameter_optimize.py

* format with black 24.1.1

* Update parameter_optimize.py

* format with black

* Added phase_contrast warning in README (#608)

* Adding error for orix install requirements

* ACOM .ang file writer fixes

* format with black

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: alex-rakowski <[email protected]>
Co-authored-by: Georgios Varnavides <[email protected]>
Co-authored-by: bsavitzky <[email protected]>
Co-authored-by: Steven Zeltmann <[email protected]>
Co-authored-by: Steve Zeltmann <[email protected]>
Co-authored-by: Stephanie Ribet <[email protected]>
Co-authored-by: SE Zeltmann <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: gvarnavi <[email protected]>
sezelt added a commit that referenced this pull request Mar 21, 2024
* Adding more papers

* more cites

* bug fix

* Revert "bug fix"

This reverts commit cbce25c.

* Bump tj-actions/changed-files from 41 to 42

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 41 to 42.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v41...v42)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump github/super-linter from 4 to 5

Bumps [github/super-linter](https://github.com/github/super-linter) from 4 to 5.
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](github/super-linter@v4...v5)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump actions/setup-python from 2 to 5

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v2...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* num_probes_fit_aberrations

* flip 180 option for read arina

* ptycho positions offset

* remove 180 flip

* tweaking amorphous fitting function

* median_filter_masked_pixels

* save polar aberrations instead

* read-write compatibility

* uncertainty viz bug

* adding force_com_measured functionality to ptycho

* clean up force_com_measured

* adding DP normalization progress bar

* moving fov_mask calc to as needed

* adding detector_fourier_mask

* bug fix for filtering

* Friedel origin finder, various FEM tools (#607)

* bug fix

* Revert "bug fix"

This reverts commit cbce25c.

* num_probes_fit_aberrations

* flip 180 option for read arina

* ptycho positions offset

* remove 180 flip

* median_filter_masked_pixels

* save polar aberrations instead

* read-write compatibility

* uncertainty viz bug

* adding force_com_measured functionality to ptycho

* clean up force_com_measured

* adding DP normalization progress bar

* moving fov_mask calc to as needed

* adding detector_fourier_mask

* Auto center finding works!

* Adding center finding without a mask

* Adding plot range to show_origin_fit, fixing bug

* Adding local mean / variance functions for FEM

* Adding symmetry analysis and plotting

* Fix divide by zero in correlation origin finding function

* bug fix for filtering

* adding initial commit for friedel correlation origin finder

* Correlation working, but mask still buggy

* Fixing the masked CC

* Simplifying the expression

* cleaning up - still need subpixel shifts

* Update origin fitting visualization

* adding device arg to upsample function

* First attempt to add Friedel origin finding to ptycho

GPU not yet working

* Adding GPU implementation warning

* parabolic subpixel fitting

* minor updates

* Going back to dev version of phase contrast

* Changing np to xp for GPU compatibility

* Fixing xp = np device options

* Revering phase contrast options back to dev

* Cleaning up code, fixing GPU support

* black formatting

* black updates

* Adding annular symmetry plotting function

* black formatting

* cleaning typos and dead code and such

* Update py4DSTEM/process/polar/polar_analysis.py

Co-authored-by: Steve Zeltmann <[email protected]>

---------

Co-authored-by: Stephanie Ribet <[email protected]>
Co-authored-by: Georgios Varnavides <[email protected]>
Co-authored-by: gvarnavi <[email protected]>
Co-authored-by: SE Zeltmann <[email protected]>
Co-authored-by: Steve Zeltmann <[email protected]>

* Default threshold should be zero

* Release memory after Bayesian optimization (#599)

* do not retain optimization function after finished running, to release memory

* update comment

* set clear_fft_cache off in optimizer defaults

* Update parameter_optimize.py

* format with black 24.1.1

* Update parameter_optimize.py

* format with black

* remove duplicate make_fourier_coords_2D

* format with black

* Added phase_contrast warning in README (#608)

* switching to non-vectorized datacube resampling

* fixing region_of_interest_shape flag

* adding cross-correlation function

* more careful array sums interpolation

* Bump gdown to 5.1.0 (#617)

* docstring change per Colin review

* DP resampling mode to nearest

* adding fourier_mask in forward mode, ie pre error calculation

* small bugfix, moving reset before object_type change

* parallax odd pixel padding bugfix

* parallax upsample, fit, and correct should return self

* removing Wiener filter

* fixing depth sectioning

* Bump tj-actions/changed-files from 42 to 43 (#629)

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 42 to 43.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v42...v43)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fixing aberration correction for odd radial symmetries. I think the sign ought to be negative, still checking with sims

* ACOM module - fix for .ang file writer (#382)

* adding annotation import

* fft normalization

* upsampling limit bugs

* bilinear sampling during position correction

* sequential numerator-denominator pixel rolling to save memory

* some useful warnings for now

* add occupancy to CIF reader

* add occupancy to structure factors

* format with black

* removing optional conda comment

* adding dependencies comment

* Adding correlation metrics

* Correlation coefs finished

* Black formatting

* normalize_order = 0 bug

* plotting fixes

* switching to gray

* allowing python 12.1

* changing python requirement to <3.13

* changing install requirements

* adding initial fixes

* changing how peaks are accessed

* changing to PLA from BraggVectors

* changing to PLA from BraggVectors

* moving import to top of file

* black

* removing hardcoded link to sample collections

* adding overwrite

* typo

* typo

* removing accidental noteobok

* back to hardcoded id

* changing filename for FCU-Net file

* Adding ability to force filename for collection Items

* back to non hardcoded now gdrive function fixed

* removing print statements

* bumping allowed version of tensorflow

* black

* adding strain mapping back into WPF

* Finishing up

* Fixing minor bugs

* Black formatting

* removing test plotting

* doc strains for visualize strain

* bugs

* doc string update

* fixing reset=False bug

* explicit bin order

* some plotting preferences

* fixing upsampling limits

* explicit aberration orders fit

* fixing abtem bug, adding conversion to polar property

* adding ability to pass descan_correction_fit_function

* DCT-based poisson solver phase unwrapping

* constraints refactoring

* fixing reshaping bugs

* cleaning up calibrations

* cleaning up calculate rotation

* adding grid search functionality to optimize

* removing tuning functions from subclasses - moved to optimizer

* Update corr_kernel_size documentation

* small typo

* cupy numpy bug

* refactoring object and probe methods

* multislice plotting tweaks

* moved read-only self-attribute calls up-front. Might remove all-together, especially for positions

* cleaned up single-slice preprocess

* cleaned up multislice preprocess

* cleaned up mixedstate preprocess

* underscore typos

* underscore typos

* huh, not how super works

* cleaned up mixed-multi slice preprocess

* cleaned up overlap tomography preprocess

* removing redundant tune func from parallax

* moved single-slice forward and adjoint to methods.py

* added necessary multi-slice forward and adjoint methods

* added necessary mixed-state forward and adjoint methods

* added necessary mixed-state-multi-slce forward and adjoint methods

* removed redundant forward and adjoint methods from overlap tomo

* cleaned up single-slice reconstruct

* cleaned up multi-slice reconstruct

* cleaned up mixed-state reconstruct

* cleaned up mixed-state multi-slice reconstruct

* cleaned up overlap tomo reconstruct, different probes per tilt

* moved show_transmitted probe

* cleaned up self-consistency viz

* oops, forgot to delete duplicate code

* cleaned up position correction - is mixed state correct?

* more natural location for 3D function

* Bump tj-actions/changed-files from 39 to 41 in /.github/workflows

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 39 to 41.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v39...v41)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* added and cleaned up total position update functionality back in

* modernized probe position correction viz

* starting viz overhaul

* remove redundant figax viz functions

* added visualize_last functionality

* visualize_all for single-slice

* visualize_all for all

* small np cp bugs

* some figsize defaults

* histogram scaling for all

* added virtual detector mask

* adding dependabot.yml

* update to check_config workflow

* black

* adding dp_mask argument

* renamed to ptycho-tomo, started magnetic refactoring

* arina reader bug fix

* reconstruct functionality for iterative magnetic

* splitting up constraints

* bumping python version to 3.10

* correctly handling collective updates constraints

* Bugfix for forced scan sampling

Correctly set scan units when `force_scan_sampling` is used

* finished with magnetic ptycho

* phase unwrapping bugfixes

* Update py4DSTEM/io/filereaders/read_arina.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* better support for multiple measurements probe properties

* broadcasting polar coordinates

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* Update py4DSTEM/process/phase/utils.py

Co-authored-by: Steve Zeltmann <[email protected]>

* docstrings

* vectorized_fourier_resample docstrings

* generalized show_fourier_probe, added general show_probe, added intensity reporting

* visual tweaks

* removed leading iterative_ from file names and trailing Reconstruction from class names

* typo

* FFT plotting improvements

* Revert "FFT plotting improvements"

This reverts commit 6669195.

* Revert "typo"

This reverts commit 5990942.

* Revert "removed leading iterative_ from file names and trailing Reconstruction from class names"

This reverts commit 9114df5.

* removed leading iterative_ from file names and trailing Reconstruction from class names

* typo

* FFT plotting improvements

* switched divergence field functions to be periodic

* magnetic ptycho-tomo preprocessing

* magnetic ptycho tomo constraints

* magnetic ptycho tomo works

* improved 3D visualizations

* ragged list partitions support for complex plotting

* added detector plane resampling

* cleaned up cupyx.scipy imports

* added storage support for singleslice. other classes likely broken, will fix tomorrow

* actually enable overwriting device

* fixing single-slice projection sets bugs with storage refactor

* cleaning up multislice for device. changed propagator tilt convention to negative mrad

* added storage support to multislice

* adding mixed-state storage support

* added storage to mixed-multislice

* attrs copying cleanup

* added storage to dpc

* more dpc viz tweaks

* adding vectorized flag to CoM

* dp_mask can be None, dub

* adding batch size in single-slice preprocess

* adding to dpc, multislice, mixedstate, multislice-mixedstate

* adding some basic device cleanup to parallax, no storage yer

* magnetic ptycho preprocess storage support

* added full storage support for magnetic ptycho

* added storage to ptycho tomo

* added storage support to magnetic ptycho-tomo

* transferring parallax bug Steph found in phase_contrast

* Update CONTRIBUTORS.md

* Update CONTRIBUTORS.md

* Update CONTRIBUTORS.md

* Update CONTRIBUTORS.md

* Update CONTRIBUTORS.md

* tweaks to clear_fft_cache

* Create CODE_OF_CONDUCT.md

This is a suggested template that seems widely used and seems reasonable.

* adding FFT-based DCT-II implementations, fixing cupy10.6 bug

* small numpy bug

* cleaned up cupy 12 feature guarding using try-except

* restored scikit functionality

* scikit-image by default, poisson as flag

* various fixes discovered while making testing notebook

* position update bug fix

* syntax update for bug fix

* complex plotting grid search

* multislice grid search plotting

* read/write bug fix

* show hanning window fix

* typo fix

* mixedstate probe fourier constraint bug fix

* constrain first aperture only

* parallax verbosity to True

* ms butterworth bug

* silly George

* cleaning up warnings

* simplifying warnings, restructuring single  slice regularization flags

* one more read write bug fix

* more flags more problems: multislice, mixed state, and mixed-multislice

* dpc

* mistake in multislice

* flags to magnetic ptycho

* ptycho tomo flags

* magnetic ptycho tomo flags

* stricter flags

* perhaps i forgot an underscore

* small parallax change

* small read-write changes

* removing switch_obj_iter

* remore switch_iter from all classes

* show_fft bug

* Bump tj-actions/changed-files from 41 to 42

Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 41 to 42.
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](tj-actions/changed-files@v41...v42)

---
updated-dependencies:
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump github/super-linter from 4 to 5

Bumps [github/super-linter](https://github.com/github/super-linter) from 4 to 5.
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](github/super-linter@v4...v5)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump actions/setup-python from 2 to 5

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v2...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* minor fixes

* Friedel origin finder, various FEM tools (#607)

* bug fix

* Revert "bug fix"

This reverts commit cbce25c.

* num_probes_fit_aberrations

* flip 180 option for read arina

* ptycho positions offset

* remove 180 flip

* median_filter_masked_pixels

* save polar aberrations instead

* read-write compatibility

* uncertainty viz bug

* adding force_com_measured functionality to ptycho

* clean up force_com_measured

* adding DP normalization progress bar

* moving fov_mask calc to as needed

* adding detector_fourier_mask

* Auto center finding works!

* Adding center finding without a mask

* Adding plot range to show_origin_fit, fixing bug

* Adding local mean / variance functions for FEM

* Adding symmetry analysis and plotting

* Fix divide by zero in correlation origin finding function

* bug fix for filtering

* adding initial commit for friedel correlation origin finder

* Correlation working, but mask still buggy

* Fixing the masked CC

* Simplifying the expression

* cleaning up - still need subpixel shifts

* Update origin fitting visualization

* adding device arg to upsample function

* First attempt to add Friedel origin finding to ptycho

GPU not yet working

* Adding GPU implementation warning

* parabolic subpixel fitting

* minor updates

* Going back to dev version of phase contrast

* Changing np to xp for GPU compatibility

* Fixing xp = np device options

* Revering phase contrast options back to dev

* Cleaning up code, fixing GPU support

* black formatting

* black updates

* Adding annular symmetry plotting function

* black formatting

* cleaning typos and dead code and such

* Update py4DSTEM/process/polar/polar_analysis.py

Co-authored-by: Steve Zeltmann <[email protected]>

---------

Co-authored-by: Stephanie Ribet <[email protected]>
Co-authored-by: Georgios Varnavides <[email protected]>
Co-authored-by: gvarnavi <[email protected]>
Co-authored-by: SE Zeltmann <[email protected]>
Co-authored-by: Steve Zeltmann <[email protected]>

* Release memory after Bayesian optimization (#599)

* do not retain optimization function after finished running, to release memory

* update comment

* set clear_fft_cache off in optimizer defaults

* Update parameter_optimize.py

* format with black 24.1.1

* Update parameter_optimize.py

* format with black

* Added phase_contrast warning in README (#608)

* Adding error for orix install requirements

* ACOM .ang file writer fixes

* format with black

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: alex-rakowski <[email protected]>
Co-authored-by: Georgios Varnavides <[email protected]>
Co-authored-by: bsavitzky <[email protected]>
Co-authored-by: Steven Zeltmann <[email protected]>
Co-authored-by: Steve Zeltmann <[email protected]>
Co-authored-by: Stephanie Ribet <[email protected]>
Co-authored-by: SE Zeltmann <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: gvarnavi <[email protected]>

* Fixing projection 2D thickness (#631)

* initial commit for projected potential

* Atom coordinates mostly working

Some tiling issue for image corners

* Projected potential now working with bugs

projection algebra definitely has a bug

* minor tweak

* Projected potentials fixed?

* adding figsize

* update docstring

* Adding thickness projection

* Fourier method makes boundary conditions difficult

* Updated plotting

* Adding robust fitting to ACOM strain mapping

* Updating matching

* Fixing thickness projection in 2D potentials

* black

* Remove testing lines.

* Trying (and failing) to figure out the potential units

* Black formatting

* Black again

* Versioning to 0.14.10

* Revert "Versioning to 0.14.10"

* Update pypi_upload.yml

* Update pypi_upload.yml

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Stephanie Ribet <[email protected]>
Co-authored-by: Georgios Varnavides <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: gvarnavi <[email protected]>
Co-authored-by: bsavitzky <[email protected]>
Co-authored-by: SE Zeltmann <[email protected]>
Co-authored-by: Steve Zeltmann <[email protected]>
Co-authored-by: Steven Zeltmann <[email protected]>
Co-authored-by: alex-rakowski <[email protected]>
Co-authored-by: Stephanie Ribet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants