EELS curve fitting#

Performs curve fitting to an EELS spectrum, plots the result and saves it as png file.

coreloss_spectrum Signal
  0%|                                              | 0.00/42.3M [00:00<?, ?B/s]
  0%|                                      | 16.4k/42.3M [00:00<07:00, 101kB/s]
  0%|                                      | 49.2k/42.3M [00:00<03:24, 207kB/s]
  0%|                                       | 109k/42.3M [00:00<02:26, 288kB/s]
  1%|▏                                      | 241k/42.3M [00:00<01:22, 510kB/s]
  1%|▍                                      | 515k/42.3M [00:00<00:43, 953kB/s]
  3%|▉                                    | 1.07M/42.3M [00:00<00:22, 1.81MB/s]
  5%|█▉                                   | 2.17M/42.3M [00:01<00:11, 3.45MB/s]
 10%|███▊                                 | 4.36M/42.3M [00:01<00:05, 6.66MB/s]
 15%|█████▌                               | 6.39M/42.3M [00:01<00:04, 8.48MB/s]
 20%|███████▌                             | 8.63M/42.3M [00:01<00:03, 10.1MB/s]
 27%|█████████▉                           | 11.4M/42.3M [00:01<00:02, 12.1MB/s]
 33%|████████████▏                        | 13.9M/42.3M [00:01<00:02, 13.0MB/s]
 38%|██████████████▏                      | 16.2M/42.3M [00:02<00:01, 13.5MB/s]
 44%|████████████████▍                    | 18.8M/42.3M [00:02<00:01, 14.1MB/s]
 50%|██████████████████▋                  | 21.3M/42.3M [00:02<00:01, 14.5MB/s]
 56%|████████████████████▊                | 23.8M/42.3M [00:02<00:01, 14.8MB/s]
 63%|███████████████████████▏             | 26.5M/42.3M [00:02<00:01, 15.3MB/s]
 69%|█████████████████████████▌           | 29.2M/42.3M [00:02<00:00, 15.6MB/s]
 75%|███████████████████████████▉         | 31.9M/42.3M [00:03<00:00, 15.8MB/s]
 81%|██████████████████████████████       | 34.4M/42.3M [00:03<00:00, 15.8MB/s]
 88%|████████████████████████████████▍    | 37.1M/42.3M [00:03<00:00, 15.9MB/s]
 94%|██████████████████████████████████▊  | 39.7M/42.3M [00:03<00:00, 16.0MB/s]
  0%|                                              | 0.00/42.3M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 42.3M/42.3M [00:00<00:00, 220GB/s]

  0%|                                              | 0.00/66.1M [00:00<?, ?B/s]
  0%|                                      | 18.4k/66.1M [00:00<09:50, 112kB/s]
  0%|                                      | 55.3k/66.1M [00:00<06:11, 178kB/s]
  0%|                                       | 123k/66.1M [00:00<03:51, 285kB/s]
  0%|▏                                      | 296k/66.1M [00:00<01:51, 588kB/s]
  1%|▎                                     | 612k/66.1M [00:00<01:01, 1.07MB/s]
  2%|▋                                    | 1.25M/66.1M [00:00<00:32, 2.02MB/s]
  4%|█▍                                   | 2.53M/66.1M [00:01<00:16, 3.90MB/s]
  8%|██▊                                  | 4.98M/66.1M [00:01<00:07, 8.47MB/s]
 10%|███▊                                 | 6.78M/66.1M [00:01<00:06, 9.48MB/s]
 14%|█████▏                               | 9.31M/66.1M [00:01<00:04, 11.5MB/s]
 18%|██████▋                              | 12.0M/66.1M [00:01<00:04, 13.1MB/s]
 22%|████████▏                            | 14.6M/66.1M [00:01<00:03, 13.8MB/s]
 26%|█████████▌                           | 17.1M/66.1M [00:02<00:03, 14.4MB/s]
 30%|███████████                          | 19.8M/66.1M [00:02<00:03, 15.0MB/s]
 34%|████████████▋                        | 22.6M/66.1M [00:02<00:02, 15.4MB/s]
 38%|██████████████▏                      | 25.3M/66.1M [00:02<00:02, 15.7MB/s]
 42%|███████████████▋                     | 27.9M/66.1M [00:02<00:02, 15.9MB/s]
 46%|█████████████████                    | 30.5M/66.1M [00:02<00:02, 15.8MB/s]
 50%|██████████████████▌                  | 33.2M/66.1M [00:03<00:02, 16.0MB/s]
 54%|████████████████████▏                | 36.0M/66.1M [00:03<00:01, 16.2MB/s]
 59%|█████████████████████▋               | 38.7M/66.1M [00:03<00:01, 16.3MB/s]
 63%|███████████████████████▏             | 41.4M/66.1M [00:03<00:01, 16.5MB/s]
 67%|████████████████████████▊            | 44.3M/66.1M [00:03<00:01, 16.7MB/s]
 72%|██████████████████████████▍          | 47.3M/66.1M [00:03<00:01, 17.1MB/s]
 76%|████████████████████████████         | 50.0M/66.1M [00:04<00:00, 17.1MB/s]
 80%|█████████████████████████████▌       | 52.8M/66.1M [00:04<00:00, 17.0MB/s]
 84%|███████████████████████████████      | 55.6M/66.1M [00:04<00:00, 16.9MB/s]
 88%|████████████████████████████████▋    | 58.3M/66.1M [00:04<00:00, 16.8MB/s]
 92%|██████████████████████████████████▏  | 61.1M/66.1M [00:04<00:00, 16.9MB/s]
 97%|███████████████████████████████████▊ | 64.0M/66.1M [00:04<00:00, 17.2MB/s]
  0%|                                              | 0.00/66.1M [00:00<?, ?B/s]
100%|██████████████████████████████████████| 66.1M/66.1M [00:00<00:00, 372GB/s]

import hyperspy.api as hs

s = hs.load("coreloss_spectrum.msa", signal_type="EELS")
ll = hs.load("lowloss_spectrum.msa", signal_type="EELS")

s.add_elements(("Mn", "O"))
s.set_microscope_parameters(
    beam_energy=300, convergence_angle=24.6, collection_angle=13.6
)

m = s.create_model(low_loss=ll)
m.enable_fine_structure()
m.multifit(kind="smart")
m.plot()

# one can also use the Dirac GOS by specifying the GOS parameter
m = s.create_model(low_loss=ll, GOS="dirac")
m.enable_fine_structure()
m.multifit(kind="smart")
m.plot()

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

Gallery generated by Sphinx-Gallery