Skip to content

Strain mapping improvements: adding independent optimizers for model fitting and multipeak fitting for cepstral calculation#235

Draft
mitis1 wants to merge 102 commits into
electronmicroscopy:fitting_models_cleanfrom
mitis1:strain-fitting-multi-optimizer
Draft

Strain mapping improvements: adding independent optimizers for model fitting and multipeak fitting for cepstral calculation#235
mitis1 wants to merge 102 commits into
electronmicroscopy:fitting_models_cleanfrom
mitis1:strain-fitting-multi-optimizer

Conversation

@mitis1
Copy link
Copy Markdown
Collaborator

@mitis1 mitis1 commented May 27, 2026

What problem this PR addressees

This PR updates the fitting-models to allow for strain mapping and independent optimizers for each component. This allows each component to have a different learning rate, which improves model fitting.

It also updates strain_autocorrelation to support multipeak cepstral transform fitting for improved strain mapping. This is controlled by the refine_all_peaks option in choose_lattice_vector() and fit_lattice_vectors().

It adds a StrainFitting class in strain_visualization. This takes the u and v arrays from different strain calculation algorithms and uses them to calculate and plot the strain. The goal is to make the final plots look consistent regardless of which algorithm was used, and the results can be saved using Autoserialize.

What should the reviewer(s) do

See the test notebooks and verify they work. Also see the StrainFitting class and if it is usable for multiple different strain calculation methods.

Test notebook for multi-peak cepstral fitting and strain plotting using StrainFitting:
20260527-pmos-cepstral-strain.ipynb

Test notebook for model fitting and strain plotting using StrainFitting:
20260512-pmos.ipynb

@bobleesj
Copy link
Copy Markdown
Collaborator

bobleesj commented Jun 2, 2026

@mitis1

I'm thinking electronmicroscopy:fitting_models_clean probalby need to be synced with dev so that this PR doesn'have to have 30k lines of code.

@bobleesj
Copy link
Copy Markdown
Collaborator

bobleesj commented Jun 2, 2026

We want each PR should be meaningful and useful both for future us and this PR reviewers, I hope.

@bobleesj
Copy link
Copy Markdown
Collaborator

bobleesj commented Jun 3, 2026

@mitis1 Please merge commits from upstream/dev into electronmicroscopy:fitting_models_clean

@bobleesj
Copy link
Copy Markdown
Collaborator

bobleesj commented Jun 3, 2026

I saw #195 - if unsure, pls DM, etc. The goal is having this PR containing ideally mostly miti's commits.

@mitis1
Copy link
Copy Markdown
Collaborator Author

mitis1 commented Jun 3, 2026

I just merged dev into fitting_models_clean, but I have some commits from nanobeam which I am working on removing so it is just additions to fitting_models_clean.

@bobleesj
Copy link
Copy Markdown
Collaborator

bobleesj commented Jun 3, 2026

Screenshot 2026-06-02 at 6 15 12 PM

Seems like MAPED/polar stuff got in the way in this branch - meaning it has nanobeam stuff in this branch. This isn't a hygine PR but better tha 30ks and mostly relevant to fitting, so seems OK

@bobleesj
Copy link
Copy Markdown
Collaborator

bobleesj commented Jun 3, 2026

Screenshot 2026-06-02 at 6 21 35 PM

But my second thought is that your branch contains upstream/nanobeam (like MAPED/PDF code being updated)

This is going to be an issue predicted if your changes need to be merged to upstream/dev eventually.

A clean case would be

  1. Close this PR - make a backup of your files
  2. Miti makes a new branch from electronmicroscopy:fitting_models_clean
  3. Miti call it mitis1:strain-fitting-multi-optimizer
  4. Commit a few ONLY related to your strain/optimization changes.
  5. Make a new PR

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.

5 participants