From 9d06fabde0413419e0c27b854ce126a94eb81082 Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sun, 17 Mar 2024 19:33:58 +0000 Subject: [PATCH] Fix restoring Gosh and Hartree Slater GOS: `subshell_factor` was missing from the `whitelist` and therefore its value wasn't restored --- exspy/misc/eels/gosh_gos.py | 1 + exspy/misc/eels/hartree_slater_gos.py | 1 + exspy/tests/components/coreloss_spectrum.msa | 2062 +++++++++++++++++ exspy/tests/components/lowloss_spectrum.msa | 2064 ++++++++++++++++++ exspy/tests/components/test_ceels_cl_edge.py | 21 - exspy/tests/components/test_eels_cl_edge.py | 51 + pyproject.toml | 3 +- 7 files changed, 4181 insertions(+), 22 deletions(-) create mode 100644 exspy/tests/components/coreloss_spectrum.msa create mode 100644 exspy/tests/components/lowloss_spectrum.msa delete mode 100644 exspy/tests/components/test_ceels_cl_edge.py create mode 100644 exspy/tests/components/test_eels_cl_edge.py diff --git a/exspy/misc/eels/gosh_gos.py b/exspy/misc/eels/gosh_gos.py index 122d2e794..74f355df6 100644 --- a/exspy/misc/eels/gosh_gos.py +++ b/exspy/misc/eels/gosh_gos.py @@ -76,6 +76,7 @@ class GoshGOS(TabulatedGOS): "qaxis": None, "element": None, "subshell": None, + "subshell_factor": None, } def __init__(self, element_subshell, gos_file_path=None): diff --git a/exspy/misc/eels/hartree_slater_gos.py b/exspy/misc/eels/hartree_slater_gos.py index 8c891afd7..8439136fa 100644 --- a/exspy/misc/eels/hartree_slater_gos.py +++ b/exspy/misc/eels/hartree_slater_gos.py @@ -107,6 +107,7 @@ class HartreeSlaterGOS(TabulatedGOS): "qaxis": None, "element": None, "subshell": None, + "subshell_factor": None, } def read_elements(self): diff --git a/exspy/tests/components/coreloss_spectrum.msa b/exspy/tests/components/coreloss_spectrum.msa new file mode 100644 index 000000000..7ed567b70 --- /dev/null +++ b/exspy/tests/components/coreloss_spectrum.msa @@ -0,0 +1,2062 @@ +#FORMAT : EMSA/MAS Spectral Data File +#VERSION : 1.0 +#TITLE : +#OWNER : +#NPOINTS : 2048.00 +#NCOLUMNS : 1.00000 +#XUNITS : eV +#YUNITS : Counts +#DATATYPE : Y +#XPERCHAN : 0.200000 +#OFFSET : 360.000 +#SIGNALTYPE : ELS +#SPECTRUM : +47179 +47304 +47325 +47353 +46918 +46638 +46882 +47240 +47058 +46843 +46758 +46682 +47022 +46769 +46742 +46499 +46512 +46774 +46622 +46676 +46409 +46261 +46162 +45879 +45988 +46177 +46387 +46233 +46035 +45543 +45580 +45597 +45662 +45441 +45727 +45299 +45132 +45164 +45099 +45321 +45184 +45156 +45098 +45302 +45166 +45239 +45028 +44930 +44999 +45088 +44914 +45095 +45294 +44934 +44805 +44695 +44196 +44029 +44030 +43885 +43630 +43950 +44364 +43746 +43513 +44164 +44216 +44140 +43968 +43544 +43621 +43839 +43577 +43350 +42967 +43322 +42955 +43098 +42762 +42720 +42718 +42516 +42526 +42329 +42417 +42105 +41838 +41619 +41644 +42048 +42055 +41894 +42438 +42711 +42551 +42319 +42196 +42401 +41957 +41528 +41749 +41348 +41322 +40803 +40960 +40991 +41251 +41188 +41038 +41291 +41170 +40849 +40934 +41205 +41510 +40884 +40811 +40439 +40207 +40365 +40544 +40425 +40318 +40218 +40402 +40551 +40296 +40030 +40440 +40520 +39982 +39847 +39795 +39848 +39693 +39517 +39671 +39361 +39661 +39545 +39358 +39304 +39242 +39171 +39549 +39133 +39133 +39033 +39175 +39319 +39569 +40025 +39436 +39112 +38948 +39016 +38945 +38660 +38730 +38577 +38371 +38333 +37951 +37618 +37447 +37530 +38008 +38008 +37408 +37740 +37805 +37675 +37657 +37622 +37637 +37555 +37650 +37853 +38001 +38375 +38199 +37555 +37831 +37948 +37799 +37635 +37012 +36803 +37438 +37467 +37511 +37566 +37526 +37588 +37572 +37150 +37006 +37028 +36980 +36628 +36788 +36417 +36056 +36113 +36151 +36040 +36238 +36394 +36495 +36160 +36057 +35959 +35789 +35772 +35761 +35471 +35810 +36020 +35529 +35797 +35782 +35564 +35645 +35288 +35365 +35718 +35786 +35931 +35822 +35739 +35656 +35462 +35637 +35414 +35218 +35512 +35583 +34873 +34755 +34878 +35298 +34842 +34890 +34941 +34906 +34886 +35032 +35194 +35071 +35168 +35101 +34622 +34544 +34308 +34179 +34038 +34233 +34181 +34124 +33967 +33581 +33702 +33927 +34053 +33987 +33976 +33893 +33611 +33230 +33432 +33406 +33423 +33391 +33328 +33221 +32997 +33104 +33332 +33385 +32884 +33141 +33244 +33253 +33233 +33241 +33052 +33382 +33022 +33358 +33424 +32814 +32661 +32660 +32501 +32440 +32515 +32924 +32909 +32878 +32623 +32362 +31985 +31793 +31430 +31536 +31998 +32225 +32344 +32256 +32178 +32243 +32338 +32475 +32079 +31972 +32118 +32039 +31940 +31807 +31667 +31544 +31879 +31830 +31863 +31712 +31997 +31594 +31563 +31489 +31663 +31542 +31174 +31169 +31263 +31311 +31487 +31586 +31373 +31071 +30529 +30863 +30846 +31108 +31309 +31147 +30649 +30522 +30541 +30426 +30210 +30053 +30829 +31130 +30871 +30788 +30507 +30019 +30203 +30344 +30023 +30613 +30506 +30280 +30109 +29726 +29956 +29758 +29833 +30206 +30226 +30061 +30116 +30087 +30000 +30017 +29938 +29683 +29591 +29699 +29568 +29843 +29540 +29584 +29306 +29181 +29458 +29405 +29444 +29319 +29202 +29093 +28913 +28848 +29230 +29090 +29172 +29466 +29492 +29097 +28782 +28872 +29020 +28947 +28940 +29026 +28716 +28708 +28823 +28686 +28726 +28650 +28824 +29105 +28361 +28585 +28305 +28464 +28453 +28373 +28255 +28653 +28600 +28393 +28008 +28169 +28470 +28753 +28595 +27946 +28000 +27857 +27196 +27690 +27853 +27818 +27631 +27509 +27310 +27485 +27541 +27543 +27349 +27416 +27623 +27450 +27284 +26930 +27368 +27048 +27181 +27103 +26909 +26486 +26934 +27283 +27245 +27168 +27242 +27098 +26975 +27095 +27103 +26916 +27378 +27314 +27251 +26738 +26824 +26931 +27272 +26987 +26864 +26916 +26702 +26424 +26581 +26456 +26340 +26084 +26246 +26385 +26442 +26480 +26504 +26339 +26386 +26419 +26550 +26219 +26341 +26221 +26043 +25575 +25442 +25918 +25556 +26132 +25939 +26011 +25832 +25959 +25725 +25733 +26069 +25609 +25744 +25816 +25911 +25919 +26178 +25863 +25584 +25218 +25106 +25310 +25411 +25492 +25652 +25348 +25432 +25480 +25498 +25600 +25215 +25158 +25316 +25291 +25326 +25176 +25061 +25176 +25135 +25214 +24929 +25018 +24773 +24732 +24832 +24599 +24662 +24643 +24677 +24728 +24956 +24803 +24885 +24882 +24469 +24645 +24728 +24627 +24460 +24732 +24657 +24870 +25109 +25044 +24796 +24674 +24552 +24593 +24471 +24097 +24034 +24024 +24034 +24037 +24023 +24036 +23963 +23646 +24196 +24160 +24005 +23766 +23408 +23944 +23933 +23861 +24111 +24125 +23843 +23965 +24335 +24232 +24348 +24070 +24003 +24066 +24023 +23657 +23997 +23735 +23897 +23657 +23556 +23302 +23270 +23361 +23146 +23237 +23226 +23150 +23314 +23173 +23235 +23266 +23352 +23243 +23177 +23042 +23024 +23146 +22973 +22710 +22716 +22863 +22765 +23067 +23049 +23134 +23072 +23004 +22886 +22840 +22769 +22942 +22694 +22490 +22957 +22873 +22896 +22834 +22549 +22369 +22416 +22630 +22575 +22704 +22601 +22318 +22274 +22057 +22289 +22118 +22187 +22208 +21862 +21830 +21725 +21641 +22018 +22183 +21972 +22127 +22189 +22481 +22114 +21871 +21773 +21451 +21722 +21794 +21482 +21576 +21467 +21588 +21449 +21373 +21520 +21517 +21506 +21305 +21165 +21354 +21590 +21238 +21251 +21521 +21476 +21595 +21643 +21544 +21219 +21318 +21516 +21365 +21416 +21413 +21193 +21379 +21401 +21442 +21511 +21912 +21555 +21225 +21422 +21389 +21097 +21123 +20948 +21141 +20862 +20726 +20878 +20701 +20567 +20644 +20516 +20261 +20353 +20301 +20494 +20504 +20542 +20726 +20780 +21120 +20849 +20499 +20397 +20576 +20375 +20911 +20796 +20524 +20238 +20452 +20299 +20302 +20223 +20301 +20094 +20133 +20413 +20192 +20288 +20043 +20060 +20031 +20147 +20073 +19879 +19913 +20038 +20250 +20322 +20134 +20241 +20114 +20014 +19785 +20064 +20052 +20156 +19825 +19884 +19713 +19883 +19913 +19920 +20038 +19858 +19826 +19877 +19630 +19887 +19862 +19971 +19751 +19568 +19643 +19534 +19414 +19378 +19560 +19496 +19822 +19653 +19652 +19569 +19687 +19355 +19407 +19587 +19252 +19496 +19354 +19362 +19037 +18876 +18882 +18902 +19027 +19273 +19425 +19452 +19262 +19096 +18696 +18639 +18840 +18879 +18987 +19097 +18939 +18750 +18748 +18991 +18859 +18845 +19097 +19061 +18945 +18929 +19067 +18964 +18871 +18718 +18631 +18441 +18720 +18604 +18651 +18778 +18655 +18948 +18871 +18776 +18805 +18684 +18526 +18711 +18871 +18732 +18334 +18556 +18224 +18305 +18273 +18255 +18526 +18469 +18339 +18116 +18037 +18277 +18059 +17995 +18083 +18051 +17797 +18050 +18043 +18168 +18213 +18257 +17875 +17969 +17887 +17968 +18053 +18042 +17981 +17980 +18162 +18105 +18266 +18329 +18450 +18474 +18391 +18465 +18943 +19210 +19341 +19623 +20012 +20339 +20556 +20952 +21443 +21469 +21791 +22031 +21851 +21970 +22028 +21986 +21817 +21682 +21960 +22000 +22006 +21840 +21849 +21960 +21999 +22480 +22661 +22686 +22996 +23189 +23512 +23932 +24696 +24866 +25007 +24929 +24876 +25146 +25076 +25100 +24899 +24859 +24561 +24390 +24105 +23862 +23477 +23233 +22810 +22747 +22393 +22156 +21551 +21247 +21125 +21171 +21450 +21214 +21375 +21391 +21740 +21609 +22197 +22469 +22528 +22816 +22910 +23233 +23310 +23621 +23585 +23768 +23532 +23389 +23587 +23453 +23709 +23756 +23522 +23547 +23688 +23474 +23426 +23433 +23232 +22818 +22815 +22721 +22752 +22327 +21867 +21832 +22087 +21945 +21735 +21668 +21456 +21371 +21467 +21435 +21356 +21401 +21124 +20870 +21147 +20786 +20646 +20398 +20412 +20622 +20580 +20692 +20590 +21045 +21069 +21055 +20860 +20580 +20467 +20589 +20685 +20569 +20550 +20589 +20641 +20788 +20638 +20577 +20759 +20727 +20830 +20609 +20675 +20663 +20507 +20273 +20438 +20936 +20702 +20599 +20748 +20641 +20707 +20588 +21113 +20746 +20738 +21008 +21156 +21163 +21268 +21161 +21095 +20937 +20846 +20680 +20922 +20981 +21112 +21146 +21319 +21175 +21249 +21491 +21531 +21391 +21309 +21386 +21309 +21310 +21326 +21344 +21402 +21277 +21246 +21157 +21440 +21681 +21447 +21208 +21142 +20992 +21226 +21143 +21266 +21471 +21701 +21571 +21691 +21543 +21438 +21268 +21244 +20936 +21223 +21348 +21231 +21196 +21180 +21091 +21056 +21319 +21380 +21117 +20831 +20806 +20936 +20854 +20671 +20952 +20862 +20824 +21148 +21005 +20991 +20771 +20642 +20820 +20650 +20996 +21034 +20986 +20916 +20738 +20896 +20586 +20683 +20658 +20687 +20740 +20652 +20648 +20543 +20761 +20447 +20432 +20383 +20324 +20295 +20366 +20558 +20269 +20407 +20342 +20320 +20251 +20252 +20251 +20062 +20515 +20523 +20082 +19783 +19799 +20073 +20434 +20405 +20112 +19833 +19984 +20147 +19932 +19881 +19777 +19654 +19975 +19523 +19710 +19391 +19376 +19766 +19417 +19344 +19352 +19441 +19373 +19309 +19475 +19560 +19514 +19407 +19252 +19200 +19124 +19423 +19440 +19565 +19304 +19506 +19915 +19719 +19524 +19125 +19065 +18766 +18784 +18978 +19344 +19030 +19117 +19157 +19025 +18828 +19126 +19092 +18976 +19089 +19013 +18863 +18917 +19263 +19179 +18882 +18747 +18646 +18575 +18729 +19191 +19093 +18914 +18902 +18872 +19031 +18795 +18860 +18718 +18654 +18845 +18746 +18777 +18822 +18710 +18526 +18644 +18906 +18676 +18818 +18910 +18974 +18914 +18851 +18851 +18719 +18753 +18812 +18850 +18794 +18886 +18923 +19014 +18811 +18664 +18488 +18563 +18782 +18667 +18504 +18663 +18760 +18671 +18677 +18765 +18585 +18439 +18511 +18587 +18419 +18397 +18357 +18467 +18110 +17932 +18312 +18536 +18873 +18865 +18588 +18464 +18395 +18236 +18169 +18438 +18501 +18451 +18344 +18349 +18469 +18109 +17914 +18050 +18106 +18008 +17905 +17891 +17926 +18166 +17973 +17584 +17515 +17653 +17580 +17511 +17648 +17670 +17632 +17404 +17589 +17640 +17894 +18037 +17917 +17499 +17467 +17794 +17735 +17642 +17519 +17479 +17603 +17766 +17535 +17741 +17534 +17325 +17801 +17814 +17595 +17387 +17293 +17264 +17495 +17578 +17712 +17525 +17306 +17117 +17323 +17395 +17280 +17470 +17221 +17303 +17405 +17419 +17216 +17179 +16961 +17280 +17286 +17227 +17148 +17104 +16941 +16814 +16680 +16774 +16719 +16892 +17059 +17011 +17061 +17158 +17099 +17188 +16880 +16901 +16817 +17011 +16888 +17192 +17088 +17044 +16932 +16970 +16888 +16678 +16683 +16747 +16604 +16407 +16677 +16489 +16556 +16649 +16638 +16400 +16398 +16423 +16468 +16570 +16386 +16407 +16441 +16367 +16626 +16524 +16635 +16884 +17048 +16791 +16809 +16908 +16592 +16475 +16494 +16366 +16753 +16665 +16422 +16302 +16188 +16059 +16170 +16492 +16438 +16059 +15944 +16001 +15870 +15963 +16099 +16108 +16230 +16225 +16592 +16769 +16575 +16444 +16250 +15998 +16265 +16180 +16026 +16135 +16282 +16023 +15865 +16075 +16274 +16148 +16050 +16155 +16174 +15896 +15920 +16467 +16489 +16597 +16635 +16883 +17054 +17406 +18016 +18412 +18959 +19570 +21079 +22176 +23205 +24124 +25454 +26518 +27284 +27594 +28433 +29118 +29801 +30480 +30981 +31032 +30767 +30415 +29933 +29656 +29180 +28546 +27474 +26926 +25905 +25328 +24537 +23750 +23170 +22586 +22045 +21395 +21093 +20736 +20211 +20110 +19883 +19814 +19702 +19189 +18900 +18889 +18583 +18469 +18523 +18333 +18277 +18169 +18227 +18474 +18247 +18334 +18570 +18982 +19466 +19586 +19953 +20358 +20662 +21277 +21746 +22329 +22606 +23173 +23547 +23800 +23571 +23674 +23888 +23912 +23805 +23313 +23233 +22950 +22421 +22082 +21440 +20905 +20378 +20232 +20245 +19835 +19296 +19174 +18914 +18579 +18694 +18463 +18405 +18298 +18121 +18027 +18039 +18070 +18112 +18342 +18164 +18145 +17849 +17990 +18214 +18099 +18098 +18092 +17871 +17675 +17737 +17623 +17549 +17360 +17496 +17612 +17787 +17617 +17775 +17874 +17750 +17673 +17861 +18028 +17827 +17681 +17766 +18052 +17664 +17475 +17553 +17735 +17795 +17565 +17613 +17667 +17649 +17625 +17576 +17667 +17858 +17888 +17724 +17809 +17925 +17856 +17876 +17801 +17762 +17704 +17749 +17672 +17953 +18031 +17891 +18003 +18137 +18229 +18334 +18314 +18372 +18277 +18017 +18125 +18331 +18284 +18348 +18297 +18205 +18480 +18251 +18130 +18070 +17994 +18156 +18432 +18426 +18505 +18267 +18127 +17992 +17967 +18078 +18015 +18073 +18086 +18126 +17860 +18020 +18102 +18328 +18262 +18198 +18112 +18450 +18438 +18156 +18084 +18078 +18169 +18254 +18285 +18026 +17852 +17965 +18184 +18410 +18296 +17972 +17936 +18086 +18208 +18102 +18068 +18121 +17908 +17947 +17847 +17799 +17778 +17847 +17795 +18026 +18198 +18235 +18100 +17942 +18159 +18197 +18287 +18187 +18142 +18101 +18068 +18124 +17823 +17932 +18028 +18187 +18007 +17878 +17609 +17747 +17842 +17798 +17802 +17717 +17675 +17627 +17599 +17498 +17534 +17702 +17587 +17987 +18207 +17824 +17437 +17413 +17484 +17355 +17457 +17415 +17437 +17430 +17304 +17470 +17643 +17454 +17193 +17325 +17356 +17051 +16833 +16946 +17007 +16894 +16635 +16622 +16929 +17109 +17192 +16946 +16969 +16932 +16941 +16917 +16985 +16838 +16823 +16803 +16971 +16872 +16863 +16989 +16575 +16690 +16725 +16647 +16850 +17042 +17055 +17021 +16904 +16774 +16699 +16757 +16676 +16510 +16572 +16457 +16664 +16831 +16855 +16790 +16603 +16561 +16522 +16500 +16664 +16427 +16227 +16309 +16106 +16106 +16109 +16076 +15988 +16312 +16492 +16620 +16471 +16353 +16249 +16223 +16345 +16205 +16130 +16278 +16083 +16017 +15920 +16014 +16123 +16046 +16059 +16160 +16088 +16215 +16522 +16317 +16193 +15975 +16055 +16059 +15743 +15713 +16047 +16097 +16279 +16278 +15997 +16114 +15972 +15985 +16026 +15833 +16007 +16187 +16336 +16196 +15959 +15788 +16012 +16247 +16108 +15927 +15867 +16075 +15926 +16023 +15851 +15899 +15827 +15786 +15685 +15647 +15788 +15840 +15567 +15500 +15594 +15706 +15861 +15684 +15314 +15334 +15318 +15784 +15659 +15418 +15226 +15371 +15401 +15460 +15431 +15301 +15252 +15203 +15306 +15501 +15519 +15369 +15415 +15333 +15412 +15427 +15508 +15488 +15271 +15179 +15229 +15337 +15433 +15335 +15343 +15162 +15283 +15208 +15213 +15133 +15206 +15283 +15140 +14886 +15006 +15137 +15055 +14994 +15205 +14890 +15010 +14868 +14792 +14828 +15208 +15216 +15174 +15210 +15321 +15227 +14910 +14921 +14876 +14954 +15162 +14944 +14793 +14831 +14834 +15036 +14922 +14829 +14853 +14637 +14692 +14775 +14973 +14853 +14621 +14787 +14649 +14734 +14958 +15157 +15034 +14836 +14766 +14901 +14831 +14820 +14823 +14596 +14660 +14713 +14596 +14510 +14317 +14440 +14431 +14465 +14532 +14384 +14303 +14379 +14550 +14469 +14196 +14292 +14365 +14343 +14584 +14465 +14520 +14492 +14346 +14313 +14405 +14312 +14316 +14231 +14391 +14465 +14326 +14401 +14278 +14282 +14164 +14234 +14178 +13917 +13782 +14146 +14374 +14315 +14178 +14276 +14077 +14125 +14239 +14144 +14054 +14117 +14195 +13980 +14085 +13868 +13940 +13759 +13928 +13947 +14249 +14038 +14065 +14009 +14154 +13991 +13956 +14065 +13913 +13714 +13641 +13584 +13786 +13804 +13918 +13704 +13544 +13582 +13451 +13531 +13555 +13434 +13524 +13842 +13895 +13719 +13499 +13595 +13552 +13573 +13539 +13521 +13599 +13441 +13426 +13653 +13474 +13321 +13125 +13281 +13476 +13737 +13720 +13586 +13527 +13459 +13459 +13173 +13274 +13328 +13261 +13140 +13238 +13403 +13431 +13594 +13522 +13876 +13735 +13625 +13736 +13525 +13473 +13422 +13376 +13132 +13149 +13051 +13262 +13465 +13588 +13524 +13666 +13536 +13455 +13387 +13409 +13395 +13468 +13070 +12852 +12620 +12924 +#ENDOFDATA : diff --git a/exspy/tests/components/lowloss_spectrum.msa b/exspy/tests/components/lowloss_spectrum.msa new file mode 100644 index 000000000..99bb19e7e --- /dev/null +++ b/exspy/tests/components/lowloss_spectrum.msa @@ -0,0 +1,2064 @@ +#FORMAT : EMSA/MAS Spectral Data File +#VERSION : 1.0 +#TITLE : +#DATE : 04-SEP-2012 +#TIME : 23:14 +#OWNER : +#NPOINTS : 2048.00 +#NCOLUMNS : 1.00000 +#XUNITS : eV +#YUNITS : Counts +#DATATYPE : Y +#XPERCHAN : 0.200000 +#OFFSET : -40.0000 +#SIGNALTYPE : ELS +#SPECTRUM : +35 +23 +20 +28 +13 +22 +35 +40 +6 +36 +17 +7 +17 +22 +33 +45 +26 +24 +29 +33 +11 +22 +27 +6 +13 +31 +6 +32 +28 +23 +29 +20 +36 +32 +24 +12 +33 +38 +3 +44 +37 +36 +43 +30 +37 +38 +39 +29 +25 +24 +20 +48 +39 +25 +31 +31 +4 +35 +23 +37 +36 +40 +34 +45 +15 +35 +33 +58 +22 +30 +29 +43 +42 +42 +33 +49 +42 +52 +41 +28 +34 +52 +45 +45 +60 +40 +40 +39 +32 +36 +55 +46 +53 +44 +41 +53 +55 +62 +45 +52 +38 +66 +61 +56 +54 +59 +63 +55 +40 +47 +51 +58 +67 +68 +71 +62 +63 +61 +72 +74 +63 +75 +81 +71 +82 +79 +79 +91 +81 +77 +85 +65 +60 +74 +96 +98 +97 +98 +91 +89 +93 +93 +110 +118 +108 +108 +125 +106 +123 +120 +127 +135 +138 +134 +145 +152 +181 +164 +183 +182 +205 +195 +227 +213 +223 +217 +226 +219 +231 +244 +249 +260 +275 +284 +330 +330 +337 +386 +406 +462 +525 +609 +764 +913 +1138 +1434 +1801 +2303 +2949 +3650 +4804 +6273 +7956 +10190 +12526 +15380 +18548 +22116 +25603 +29111 +32578 +36042 +39901 +42855 +44384 +44145 +42722 +40767 +37719 +33854 +30222 +27048 +24388 +21472 +18144 +14501 +11079 +8158 +6244 +4985 +4114 +3249 +2647 +2247 +1879 +1622 +1465 +1299 +1216 +1117 +1080 +1069 +979 +916 +929 +939 +910 +904 +898 +884 +867 +924 +885 +875 +849 +819 +804 +784 +840 +848 +851 +880 +901 +914 +917 +959 +987 +1031 +1015 +1047 +1039 +1097 +1148 +1216 +1212 +1254 +1226 +1180 +1221 +1261 +1308 +1331 +1426 +1453 +1454 +1363 +1342 +1364 +1316 +1283 +1230 +1254 +1274 +1261 +1189 +1167 +1124 +1125 +1112 +1134 +1081 +1011 +1005 +995 +1047 +1035 +977 +1019 +1063 +1064 +1064 +1096 +1116 +1079 +1114 +1110 +1082 +1084 +1048 +1090 +1115 +1172 +1167 +1123 +1134 +1142 +1187 +1172 +1159 +1181 +1173 +1211 +1193 +1208 +1245 +1251 +1235 +1259 +1264 +1319 +1328 +1373 +1433 +1443 +1498 +1483 +1475 +1498 +1512 +1546 +1573 +1569 +1586 +1720 +1721 +1772 +1860 +1895 +1958 +1992 +2023 +2080 +2164 +2262 +2336 +2289 +2325 +2310 +2257 +2277 +2390 +2317 +2298 +2238 +2281 +2228 +2155 +2160 +2104 +2144 +2076 +1965 +1948 +1920 +1893 +1845 +1834 +1803 +1765 +1727 +1693 +1636 +1626 +1646 +1632 +1605 +1585 +1578 +1590 +1573 +1554 +1421 +1306 +1370 +1409 +1361 +1363 +1347 +1289 +1221 +1222 +1294 +1233 +1199 +1208 +1186 +1159 +1111 +1121 +1143 +1144 +1106 +1078 +1011 +1049 +1053 +1054 +1071 +1033 +1053 +1065 +1013 +973 +954 +953 +998 +907 +864 +887 +901 +890 +902 +925 +889 +827 +800 +766 +767 +766 +763 +777 +763 +736 +759 +789 +726 +737 +750 +750 +727 +745 +755 +740 +715 +729 +698 +677 +721 +771 +705 +700 +733 +682 +724 +718 +691 +703 +722 +762 +763 +760 +798 +781 +776 +767 +787 +801 +772 +793 +822 +837 +828 +756 +781 +774 +788 +732 +701 +706 +686 +690 +694 +723 +703 +672 +689 +678 +709 +670 +654 +656 +642 +637 +637 +639 +638 +655 +600 +640 +635 +615 +654 +579 +619 +630 +612 +601 +631 +651 +603 +594 +633 +579 +583 +570 +554 +597 +602 +583 +594 +598 +574 +624 +570 +557 +558 +589 +614 +573 +608 +572 +531 +541 +531 +551 +589 +515 +484 +457 +473 +495 +499 +474 +478 +447 +497 +488 +452 +464 +467 +459 +470 +494 +509 +516 +486 +508 +468 +437 +466 +435 +414 +447 +466 +476 +439 +402 +382 +427 +439 +412 +396 +378 +357 +402 +361 +367 +400 +387 +394 +390 +366 +387 +348 +379 +391 +390 +374 +398 +378 +380 +366 +348 +341 +344 +339 +325 +369 +379 +381 +382 +360 +324 +339 +337 +311 +342 +338 +347 +337 +334 +309 +303 +341 +334 +313 +342 +346 +307 +317 +277 +304 +357 +344 +344 +366 +349 +341 +313 +300 +313 +311 +315 +289 +283 +308 +310 +290 +343 +309 +289 +304 +313 +313 +283 +253 +269 +258 +260 +259 +230 +259 +265 +258 +281 +237 +276 +252 +229 +247 +251 +233 +258 +235 +235 +219 +210 +210 +240 +258 +277 +255 +258 +230 +216 +205 +219 +233 +250 +224 +226 +202 +232 +215 +240 +253 +252 +239 +208 +216 +197 +198 +210 +238 +205 +194 +223 +228 +220 +237 +235 +218 +221 +242 +214 +204 +193 +204 +196 +201 +229 +226 +228 +220 +214 +205 +205 +187 +181 +183 +176 +197 +184 +201 +231 +249 +209 +239 +206 +192 +215 +176 +171 +199 +194 +216 +223 +206 +203 +191 +175 +203 +205 +164 +195 +160 +160 +178 +218 +212 +214 +199 +170 +184 +209 +205 +180 +168 +177 +188 +211 +182 +160 +174 +172 +162 +184 +175 +166 +167 +164 +189 +192 +223 +240 +231 +211 +206 +202 +208 +242 +235 +246 +222 +260 +282 +278 +235 +261 +286 +271 +281 +301 +307 +298 +270 +265 +246 +295 +309 +270 +288 +280 +294 +279 +265 +278 +308 +306 +296 +305 +291 +248 +242 +257 +220 +255 +231 +243 +246 +229 +236 +227 +246 +223 +245 +223 +231 +234 +250 +231 +212 +212 +193 +186 +182 +236 +221 +234 +216 +237 +240 +213 +229 +228 +202 +207 +184 +155 +213 +232 +214 +204 +178 +192 +180 +169 +169 +209 +199 +204 +196 +183 +192 +168 +182 +188 +199 +178 +197 +195 +198 +204 +183 +176 +214 +196 +162 +196 +214 +205 +199 +179 +160 +155 +177 +195 +194 +184 +160 +160 +159 +178 +184 +181 +190 +167 +150 +146 +136 +161 +190 +173 +190 +176 +177 +162 +157 +153 +158 +163 +150 +130 +133 +143 +127 +118 +118 +127 +136 +137 +141 +183 +162 +157 +132 +118 +118 +149 +125 +147 +147 +140 +133 +174 +149 +160 +152 +146 +152 +154 +133 +114 +114 +117 +108 +116 +105 +115 +113 +129 +146 +126 +119 +123 +141 +125 +140 +144 +166 +138 +123 +120 +129 +129 +128 +115 +115 +122 +103 +118 +104 +111 +99 +100 +110 +113 +129 +135 +109 +94 +100 +114 +111 +103 +103 +96 +118 +146 +121 +106 +120 +113 +101 +125 +132 +123 +131 +122 +95 +95 +91 +107 +112 +129 +122 +119 +106 +118 +88 +92 +92 +115 +122 +95 +68 +63 +77 +63 +71 +87 +96 +67 +75 +64 +75 +81 +58 +78 +69 +78 +60 +86 +84 +71 +69 +78 +78 +90 +79 +64 +78 +90 +62 +78 +77 +98 +80 +85 +80 +68 +71 +64 +80 +75 +70 +74 +55 +63 +59 +48 +72 +50 +57 +67 +49 +56 +53 +72 +71 +72 +68 +106 +75 +85 +65 +70 +51 +55 +53 +51 +86 +72 +57 +42 +67 +60 +74 +61 +65 +63 +42 +47 +79 +66 +66 +51 +70 +45 +72 +53 +39 +74 +81 +67 +71 +62 +43 +58 +50 +42 +28 +35 +60 +77 +91 +74 +90 +70 +68 +70 +81 +78 +62 +54 +71 +77 +58 +35 +44 +43 +39 +34 +65 +41 +52 +49 +71 +45 +67 +39 +51 +55 +47 +47 +49 +65 +57 +68 +51 +39 +50 +35 +45 +54 +48 +53 +42 +58 +53 +53 +61 +48 +41 +58 +67 +50 +57 +53 +44 +64 +68 +64 +75 +65 +59 +42 +57 +40 +40 +60 +49 +53 +70 +58 +46 +46 +56 +34 +44 +50 +47 +54 +57 +45 +41 +53 +37 +30 +25 +26 +30 +41 +61 +59 +32 +29 +34 +42 +67 +49 +48 +64 +57 +52 +56 +65 +69 +70 +49 +49 +58 +56 +39 +39 +71 +65 +50 +50 +47 +15 +31 +36 +19 +24 +41 +47 +44 +70 +56 +58 +53 +47 +49 +36 +40 +49 +44 +57 +66 +37 +35 +47 +27 +44 +40 +8 +18 +23 +49 +57 +38 +48 +52 +44 +23 +54 +72 +45 +51 +50 +59 +42 +75 +34 +46 +36 +38 +35 +42 +48 +24 +44 +34 +21 +45 +21 +33 +24 +27 +22 +61 +31 +50 +63 +43 +58 +41 +34 +28 +38 +35 +26 +26 +41 +47 +26 +44 +26 +54 +36 +43 +44 +29 +26 +43 +39 +48 +40 +34 +41 +24 +17 +9 +17 +30 +34 +19 +15 +26 +37 +29 +15 +23 +33 +26 +34 +33 +47 +22 +32 +26 +35 +45 +16 +37 +41 +56 +32 +47 +16 +46 +11 +30 +16 +30 +31 +26 +18 +28 +30 +36 +17 +16 +28 +17 +29 +22 +39 +45 +26 +17 +29 +27 +14 +25 +23 +22 +25 +36 +27 +34 +39 +9 +36 +6 +11 +19 +18 +36 +17 +31 +32 +20 +35 +14 +9 +25 +31 +27 +29 +30 +34 +51 +20 +26 +44 +45 +24 +14 +43 +25 +43 +32 +35 +35 +31 +14 +31 +25 +38 +17 +20 +31 +25 +19 +39 +30 +39 +44 +30 +35 +47 +25 +39 +23 +29 +38 +45 +38 +33 +21 +34 +61 +27 +30 +54 +10 +21 +30 +37 +49 +3 +34 +24 +25 +27 +24 +35 +31 +11 +4 +10 +42 +28 +10 +8 +29 +10 +31 +26 +36 +5 +15 +30 +22 +14 +10 +21 +27 +31 +-1 +19 +34 +46 +18 +31 +36 +34 +22 +37 +40 +40 +39 +24 +40 +27 +38 +34 +15 +27 +48 +-5 +13 +37 +24 +18 +11 +36 +24 +47 +32 +27 +24 +22 +3 +10 +21 +7 +3 +10 +17 +34 +9 +13 +-2 +11 +31 +26 +0 +37 +30 +14 +20 +10 +23 +12 +21 +14 +15 +14 +16 +2 +26 +8 +10 +14 +20 +31 +20 +6 +-2 +21 +24 +26 +27 +21 +22 +18 +16 +36 +26 +14 +18 +18 +20 +34 +7 +22 +16 +19 +46 +26 +21 +25 +31 +26 +11 +15 +6 +14 +26 +25 +28 +19 +24 +31 +6 +10 +14 +13 +28 +35 +35 +19 +17 +34 +34 +24 +13 +2 +47 +30 +21 +7 +12 +34 +27 +20 +9 +33 +40 +38 +25 +22 +22 +44 +26 +24 +22 +17 +-6 +13 +12 +12 +33 +17 +17 +15 +5 +7 +19 +20 +21 +38 +25 +12 +8 +26 +33 +20 +33 +16 +29 +26 +32 +23 +43 +48 +22 +18 +23 +19 +21 +21 +12 +18 +12 +28 +23 +23 +9 +-6 +44 +37 +23 +13 +17 +20 +25 +37 +17 +18 +10 +16 +17 +29 +24 +15 +12 +-1 +23 +23 +21 +16 +24 +16 +-1 +10 +25 +11 +25 +34 +5 +10 +9 +25 +16 +22 +17 +6 +19 +27 +37 +30 +17 +11 +14 +9 +12 +15 +7 +25 +9 +35 +20 +26 +1 +24 +0 +14 +13 +13 +7 +17 +17 +15 +35 +17 +19 +20 +11 +26 +12 +29 +19 +10 +25 +16 +14 +17 +3 +6 +20 +26 +14 +21 +8 +31 +23 +23 +3 +27 +26 +17 +13 +16 +18 +19 +16 +16 +31 +11 +29 +8 +14 +10 +45 +-5 +14 +17 +0 +-3 +21 +13 +20 +21 +20 +6 +1 +23 +0 +18 +18 +19 +12 +7 +17 +21 +17 +18 +15 +19 +-4 +3 +10 +6 +13 +29 +18 +-5 +3 +10 +20 +-6 +22 +35 +14 +9 +1 +17 +5 +-2 +7 +18 +23 +17 +11 +21 +20 +13 +19 +15 +27 +27 +22 +26 +17 +35 +37 +33 +37 +31 +24 +20 +45 +34 +17 +14 +20 +21 +9 +7 +4 +16 +21 +17 +10 +6 +17 +13 +16 +4 +24 +7 +-2 +22 +20 +12 +13 +12 +-1 +14 +2 +7 +18 +21 +14 +2 +24 +49 +27 +20 +14 +10 +12 +14 +13 +7 +17 +14 +17 +7 +21 +14 +6 +15 +27 +20 +28 +16 +2 +-7 +18 +16 +2 +14 +7 +6 +6 +-4 +5 +9 +11 +16 +11 +-11 +35 +-2 +10 +25 +8 +-2 +12 +-5 +-2 +-3 +19 +26 +13 +21 +3 +28 +7 +-15 +6 +6 +15 +5 +6 +-4 +-8 +-6 +15 +8 +18 +15 +-3 +3 +4 +5 +12 +4 +5 +5 +5 +9 +11 +14 +12 +9 +9 +11 +6 +0 +6 +-3 +9 +-15 +11 +11 +1 +21 +2 +10 +8 +8 +6 +15 +-3 +-3 +10 +9 +4 +7 +4 +0 +-4 +25 +-3 +8 +-7 +-2 +19 +45 +26 +17 +-7 +4 +18 +13 +25 +30 +28 +2 +9 +31 +18 +22 +1 +29 +34 +19 +8 +-2 +4 +2 +3 +-2 +24 +9 +8 +8 +21 +10 +11 +12 +6 +5 +-13 +7 +8 +12 +6 +-5 +6 +10 +18 +24 +7 +0 +13 +18 +18 +28 +9 +13 +17 +#ENDOFDATA : diff --git a/exspy/tests/components/test_ceels_cl_edge.py b/exspy/tests/components/test_ceels_cl_edge.py deleted file mode 100644 index dccad8723..000000000 --- a/exspy/tests/components/test_ceels_cl_edge.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2007-2024 The eXSpy developers -# -# This file is part of eXSpy. -# -# eXSpy is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# eXSpy is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with eXSpy. If not, see . - - -def test_eels_cl_edge(): - pass diff --git a/exspy/tests/components/test_eels_cl_edge.py b/exspy/tests/components/test_eels_cl_edge.py new file mode 100644 index 000000000..88eb9e111 --- /dev/null +++ b/exspy/tests/components/test_eels_cl_edge.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2007-2024 The eXSpy developers +# +# This file is part of eXSpy. +# +# eXSpy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# eXSpy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with eXSpy. If not, see . + +from pathlib import Path + +import hyperspy.api as hs +import numpy as np + + +TEST_DATA_DIR = Path(__file__).parent + + +def test_restore_EELS_model(tmp_path): + s = hs.load(TEST_DATA_DIR / "coreloss_spectrum.msa", signal_type="EELS") + ll = hs.load(TEST_DATA_DIR / "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") + + model_name = "fit1" + m.store(model_name) + fname = tmp_path / "test_save_eelsmodel.hspy" + s.save(tmp_path / fname) + m2 = s.models.restore(model_name) + + np.testing.assert_allclose(m.as_signal(), m2.as_signal()) + + s2 = hs.load(fname) + m3 = s2.models.restore(model_name) + np.testing.assert_allclose(m.as_signal(), m3.as_signal()) diff --git a/pyproject.toml b/pyproject.toml index f57cff804..7ac9c9dcf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,7 +120,8 @@ include = ["exspy*"] [tool.setuptools.package-data] "*" = [ "*hspy", - "*.yaml" + "*.yaml", + "*.msa", ] [tool.setuptools_scm]