Flat Ewald’s Sphere Assumption#

In most cases, the Ewald’s sphere is assumed to be flat for diffraction patterns when doing 4D STEM. This is almost always a good assumption. That being said there are a couple of common units used with 4D STEM (e.g. nm-1, mrad, pixel coordinates) and it is important to understand how these units relate to each other. These units are also related to the camera length, pixel size, and beam energy (wavelength) of the microscope. In reality the beam energy is really the only thing that you need to know.

Let’s look at an example of this using the ZrNb Precipitate dataset.

from pyxem.data import pdnip_glass

g = pdnip_glass(allow_download=True)
g.calibration.beam_energy = "200 kV"
g.calibration.convergance_angle = "1 mrad"  # set the convergence angle
Downloading file 'PdNiP.zspy' from 'https://zenodo.org/records/15490547/files/PdNiP.zspy' to '/home/runner/.cache/pyxem/0.21.0'.

  0%|                                               | 0.00/305M [00:00<?, ?B/s]
  0%|                                      | 14.3k/305M [00:00<54:18, 93.5kB/s]
  0%|                                       | 45.1k/305M [00:00<32:18, 157kB/s]
  0%|                                        | 114k/305M [00:00<17:25, 291kB/s]
  0%|                                        | 251k/305M [00:00<09:32, 532kB/s]
  0%|                                        | 517k/305M [00:00<05:13, 971kB/s]
  0%|▏                                     | 1.06M/305M [00:00<02:44, 1.85MB/s]
  1%|▎                                     | 2.14M/305M [00:01<01:24, 3.56MB/s]
  1%|▍                                     | 3.85M/305M [00:01<00:44, 6.76MB/s]
  2%|▊                                     | 6.76M/305M [00:01<00:26, 11.1MB/s]
  3%|█▏                                    | 9.22M/305M [00:01<00:23, 12.8MB/s]
  4%|█▌                                    | 12.0M/305M [00:01<00:20, 14.6MB/s]
  5%|█▉                                    | 15.5M/305M [00:01<00:17, 17.0MB/s]
  6%|██▎                                   | 18.8M/305M [00:01<00:15, 18.5MB/s]
  7%|██▋                                   | 21.7M/305M [00:02<00:15, 18.8MB/s]
  8%|███▏                                  | 25.1M/305M [00:02<00:14, 19.7MB/s]
  9%|███▌                                  | 28.8M/305M [00:02<00:13, 21.2MB/s]
 11%|███▉                                  | 32.0M/305M [00:02<00:12, 21.2MB/s]
 12%|████▍                                 | 35.5M/305M [00:02<00:12, 21.6MB/s]
 13%|████▉                                 | 39.1M/305M [00:02<00:11, 22.3MB/s]
 14%|█████▎                                | 42.6M/305M [00:02<00:11, 22.6MB/s]
 15%|█████▋                                | 45.8M/305M [00:03<00:11, 22.0MB/s]
 16%|██████                                | 49.0M/305M [00:03<00:11, 21.7MB/s]
 17%|██████▌                               | 52.9M/305M [00:03<00:10, 23.0MB/s]
 18%|██████▉                               | 55.9M/305M [00:03<00:10, 24.4MB/s]
 19%|███████▎                              | 58.4M/305M [00:03<00:11, 22.0MB/s]
 20%|███████▌                              | 60.6M/305M [00:03<00:11, 21.8MB/s]
 21%|███████▊                              | 62.9M/305M [00:03<00:12, 19.8MB/s]
 22%|████████▏                             | 65.5M/305M [00:04<00:12, 19.5MB/s]
 23%|████████▌                             | 69.0M/305M [00:04<00:11, 20.6MB/s]
 24%|█████████                             | 72.6M/305M [00:04<00:10, 21.4MB/s]
 25%|█████████▍                            | 76.0M/305M [00:04<00:10, 21.8MB/s]
 26%|█████████▉                            | 79.4M/305M [00:04<00:10, 22.0MB/s]
 27%|██████████▎                           | 82.8M/305M [00:04<00:10, 22.1MB/s]
 28%|██████████▊                           | 86.3M/305M [00:04<00:09, 22.4MB/s]
 29%|███████████▏                          | 89.6M/305M [00:05<00:09, 22.2MB/s]
 31%|███████████▌                          | 93.2M/305M [00:05<00:09, 22.4MB/s]
 32%|████████████                          | 96.4M/305M [00:05<00:09, 22.1MB/s]
 33%|████████████▊                          | 100M/305M [00:05<00:08, 22.8MB/s]
 34%|█████████████▏                         | 103M/305M [00:05<00:08, 22.5MB/s]
 35%|█████████████▋                         | 107M/305M [00:05<00:08, 24.6MB/s]
 36%|█████████████▉                         | 109M/305M [00:05<00:08, 24.2MB/s]
 37%|██████████████▎                        | 112M/305M [00:06<00:08, 21.8MB/s]
 37%|██████████████▌                        | 114M/305M [00:06<00:08, 22.1MB/s]
 38%|██████████████▉                        | 116M/305M [00:06<00:08, 22.1MB/s]
 39%|███████████████▏                       | 118M/305M [00:06<00:08, 21.9MB/s]
 40%|███████████████▍                       | 121M/305M [00:06<00:08, 22.3MB/s]
 40%|███████████████▊                       | 123M/305M [00:06<00:08, 22.2MB/s]
 41%|████████████████                       | 125M/305M [00:06<00:08, 22.0MB/s]
 42%|████████████████▎                      | 128M/305M [00:06<00:07, 23.0MB/s]
 43%|████████████████▋                      | 130M/305M [00:06<00:07, 22.5MB/s]
 43%|████████████████▉                      | 132M/305M [00:07<00:07, 22.3MB/s]
 44%|█████████████████▏                     | 135M/305M [00:07<00:08, 20.0MB/s]
 45%|█████████████████▋                     | 138M/305M [00:07<00:07, 23.8MB/s]
 46%|█████████████████▉                     | 141M/305M [00:07<00:07, 23.1MB/s]
 47%|██████████████████▎                    | 143M/305M [00:07<00:07, 22.5MB/s]
 48%|██████████████████▌                    | 145M/305M [00:07<00:07, 20.3MB/s]
 49%|███████████████████                    | 149M/305M [00:07<00:07, 21.5MB/s]
 50%|███████████████████▌                   | 152M/305M [00:07<00:06, 22.0MB/s]
 51%|███████████████████▉                   | 156M/305M [00:08<00:06, 21.6MB/s]
 52%|████████████████████▎                  | 159M/305M [00:08<00:06, 21.6MB/s]
 53%|████████████████████▊                  | 163M/305M [00:08<00:06, 22.2MB/s]
 55%|█████████████████████▎                 | 166M/305M [00:08<00:06, 22.2MB/s]
 56%|█████████████████████▋                 | 169M/305M [00:08<00:06, 22.0MB/s]
 57%|██████████████████████▏                | 173M/305M [00:08<00:05, 22.3MB/s]
 58%|██████████████████████▌                | 177M/305M [00:09<00:05, 22.5MB/s]
 59%|███████████████████████                | 180M/305M [00:09<00:05, 22.0MB/s]
 60%|███████████████████████▍               | 183M/305M [00:09<00:05, 21.9MB/s]
 61%|███████████████████████▉               | 187M/305M [00:09<00:05, 22.1MB/s]
 62%|████████████████████████▎              | 190M/305M [00:09<00:05, 22.4MB/s]
 63%|████████████████████████▊              | 193M/305M [00:09<00:04, 22.3MB/s]
 65%|█████████████████████████▏             | 197M/305M [00:09<00:04, 22.0MB/s]
 66%|█████████████████████████▋             | 200M/305M [00:10<00:04, 22.8MB/s]
 67%|██████████████████████████             | 204M/305M [00:10<00:04, 22.4MB/s]
 68%|██████████████████████████▌            | 207M/305M [00:10<00:04, 22.4MB/s]
 69%|██████████████████████████▉            | 211M/305M [00:10<00:04, 22.7MB/s]
 70%|███████████████████████████▍           | 214M/305M [00:10<00:04, 22.6MB/s]
 71%|███████████████████████████▊           | 218M/305M [00:10<00:03, 22.8MB/s]
 72%|████████████████████████████▎          | 221M/305M [00:10<00:03, 24.9MB/s]
 73%|████████████████████████████▌          | 223M/305M [00:11<00:03, 24.7MB/s]
 74%|████████████████████████████▉          | 226M/305M [00:11<00:03, 22.2MB/s]
 75%|█████████████████████████████▏         | 228M/305M [00:11<00:03, 22.1MB/s]
 76%|█████████████████████████████▍         | 230M/305M [00:11<00:03, 22.1MB/s]
 76%|█████████████████████████████▊         | 233M/305M [00:11<00:03, 22.0MB/s]
 77%|██████████████████████████████         | 235M/305M [00:11<00:03, 21.9MB/s]
 78%|██████████████████████████████▎        | 237M/305M [00:11<00:03, 22.0MB/s]
 79%|██████████████████████████████▋        | 239M/305M [00:11<00:03, 21.7MB/s]
 79%|██████████████████████████████▉        | 241M/305M [00:11<00:02, 21.1MB/s]
 80%|███████████████████████████████▎       | 244M/305M [00:12<00:02, 20.4MB/s]
 81%|███████████████████████████████▋       | 247M/305M [00:12<00:02, 20.4MB/s]
 82%|████████████████████████████████▏      | 251M/305M [00:12<00:02, 24.5MB/s]
 83%|████████████████████████████████▍      | 254M/305M [00:12<00:02, 22.0MB/s]
 84%|████████████████████████████████▊      | 256M/305M [00:12<00:02, 23.1MB/s]
 85%|█████████████████████████████████      | 259M/305M [00:12<00:02, 21.6MB/s]
 86%|█████████████████████████████████▍     | 261M/305M [00:12<00:02, 20.1MB/s]
 87%|█████████████████████████████████▊     | 264M/305M [00:12<00:01, 22.7MB/s]
 88%|██████████████████████████████████▏    | 267M/305M [00:13<00:01, 21.3MB/s]
 89%|██████████████████████████████████▌    | 270M/305M [00:13<00:01, 21.7MB/s]
 90%|███████████████████████████████████    | 274M/305M [00:13<00:01, 21.8MB/s]
 91%|███████████████████████████████████▌   | 277M/305M [00:13<00:01, 22.4MB/s]
 92%|███████████████████████████████████▉   | 281M/305M [00:13<00:01, 22.2MB/s]
 93%|████████████████████████████████████▎  | 284M/305M [00:13<00:00, 22.0MB/s]
 94%|████████████████████████████████████▊  | 287M/305M [00:14<00:00, 21.6MB/s]
 95%|█████████████████████████████████████▏ | 291M/305M [00:14<00:00, 22.1MB/s]
 96%|█████████████████████████████████████▋ | 294M/305M [00:14<00:00, 24.1MB/s]
 97%|█████████████████████████████████████▉ | 296M/305M [00:14<00:00, 22.0MB/s]
 98%|██████████████████████████████████████▎| 299M/305M [00:14<00:00, 21.2MB/s]
 99%|██████████████████████████████████████▋| 303M/305M [00:14<00:00, 21.3MB/s]
  0%|                                               | 0.00/305M [00:00<?, ?B/s]
100%|███████████████████████████████████████| 305M/305M [00:00<00:00, 2.41TB/s]

Changing to mrad#

Now we can change the units to mrad. This will automatically calculate the camera length based on the beam energy and pixel size.

  • PdNiP Navigator
  • PdNiP Signal

Changing back to nm-1#

We can change back to nm-1, now that the camera length is (accurately) set, and the new scale will be automatically calculated.

  • PdNiP Navigator
  • PdNiP Signal

Changing to pixel coordinates#

We can also change to pixel coordinates. This will set the scale to 1 and the units to “px”. But we won’t lose the calibration information, so we can switch back to nm-1 or mrad easily.

  • PdNiP Navigator
  • PdNiP Signal
[0.83765017 0.83765017]
after [0.83765017 0.83765017]

Rebinning#

We can also rebin the data in pyxem and the calibration will automatically adjust

g.calibration.convert_signal_units("nm^-1")
g_rebinned = g.rebin(scale=(1, 1, 2, 2))
g_rebinned.plot()
  • flat ewalds sphere assumption
  • Signal

sphinx_gallery_thumbnail_number = 2

Total running time of the script: (0 minutes 25.711 seconds)

Gallery generated by Sphinx-Gallery