Skip to content

Improved backend implementation#87

Open
pzeiger wants to merge 14 commits intomainfrom
backend-clean
Open

Improved backend implementation#87
pzeiger wants to merge 14 commits intomainfrom
backend-clean

Conversation

@pzeiger
Copy link
Copy Markdown
Collaborator

@pzeiger pzeiger commented Mar 29, 2026

This PR introduces a new backend implementation, which allows for a very clean handling of the arrays without relying on global module variables. Backends can now be freely mixed and matched in the same process. Furthermore the backend is easily testable as shown in the script tests/test_backend.py.

Most of the rewriting was done using Github Copilot and Claude Code. Most testing has focused on the Jupyter notebook tests/test_pyslice_abtem.ipynb. It runs successfully and compares favorably with an abTEM calculation.

We will need to test this more rigorously than I was able to do. Specifically, we should make sure all of the tests in the tests directory work. I could not verify a lot of them due to memory issues. Will try on a cluster in the near future.

Paul Zeiger added 14 commits March 25, 2026 19:09
…ith PySlice logic and preallocation of arrays
…ice_abtem.ipynb looks good for NumPy and PyTorch CPU backend.
…ntial problems overloading default Python operators
Claude and Github Copilot made the majority of changes. The
backend is now much more compartmentalized and fully testable.

Need to verify the correctness of calculations more.
… functions to trajectory deleted by mistake
1. Removed parameter store_all_slices from MultisliceCalculator
2. Added force_rerun parameter to MultisliceCalculator.run in order to
   force recalculation even if tacaw.npy exists.
3. Fixed bug regarding chunk_size_time handling in TACAWData if chunkFFT=True
4. Added force_rerun parameter to TACAWData class to force recalculation
   even if tacaw.npy exists in the cache.

Now tests/test_pyslice_abtem.ipynb runs successfully!
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.

1 participant