Skip to content

Commit

Permalink
Fix code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpre committed Feb 13, 2024
1 parent 3760f36 commit f7b3041
Show file tree
Hide file tree
Showing 14 changed files with 5,013 additions and 4,376 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: ruff
args: [ --fix ]
# Run the formatter.
#- id: ruff-format
- id: ruff-format
ci:
# Don't run automatically on PRs, instead add the comment
# "pre-commit.ci autofix" on a pull request to manually trigger auto-fixing
Expand Down
4 changes: 1 addition & 3 deletions exspy/components/eels_cl_edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ class EELSCLEdge(Component):
fine_structure_components : set, default ``set()``
A set containing components to model the fine structure region
of the EELS ionization edge.
""".format(
_GOSH_DOI
)
""".format(_GOSH_DOI)

_fine_structure_smoothing = 0.3
_fine_structure_coeff_free = True
Expand Down
4 changes: 3 additions & 1 deletion exspy/components/eels_vignetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def function(self, x):
x = np.array(x)
v1 = A * np.cos((x - x0) / (2 * np.pi * period)) ** 4
v2 = np.where(
x < left, 1.0 - (left - x) * la, np.where(x < right, 1.0, 1.0 - (x - right) * ra)
x < left,
1.0 - (left - x) * la,
np.where(x < right, 1.0, 1.0 - (x - right) * ra),
)
self.gaussian.sigma.value = sigma
self.gaussian.origin.value = (x[-1] + x[0]) / 2
Expand Down
18 changes: 3 additions & 15 deletions exspy/components/volume_plasmon_drude.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ def grad_plasmon_energy(self, x):
* intensity
* (
(x**4 + (x * fwhm) ** 2 - plasmon_energy**4)
/ (
x**4
+ x**2 * (fwhm**2 - 2 * plasmon_energy**2)
+ plasmon_energy**4
)
/ (x**4 + x**2 * (fwhm**2 - 2 * plasmon_energy**2) + plasmon_energy**4)
** 2
),
0,
Expand All @@ -117,16 +113,8 @@ def grad_fwhm(self, x):
* plasmon_energy
* intensity
* (
(
x**4
- x**2 * (2 * plasmon_energy**2 + fwhm**2)
+ plasmon_energy**4
)
/ (
x**4
+ x**2 * (fwhm**2 - 2 * plasmon_energy**2)
+ plasmon_energy**4
)
(x**4 - x**2 * (2 * plasmon_energy**2 + fwhm**2) + plasmon_energy**4)
/ (x**4 + x**2 * (fwhm**2 - 2 * plasmon_energy**2) + plasmon_energy**4)
** 2
),
0,
Expand Down
2 changes: 2 additions & 0 deletions exspy/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# along with exSpy. If not, see <https://www.gnu.org/licenses/#GPL>.

import importlib

try:
# Set traits toolkit to work in a headless system
# Capture error when toolkit is already previously set which typically
Expand All @@ -39,6 +40,7 @@
# Use matplotlib fixture to clean up figure, setup backend, etc.
from matplotlib.testing.conftest import mpl_test_settings # noqa: F401


@pytest.fixture(autouse=True)
def add_np(doctest_namespace):
doctest_namespace["np"] = np
Expand Down
8 changes: 2 additions & 6 deletions exspy/docstrings/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
gos_file_path : str, None
Only with GOS='gosh'. Specify the file path of the gosh file
to use. If None, use the file from doi:{}""".format(
_GOSH_DOI
)
to use. If None, use the file from doi:{}""".format(_GOSH_DOI)

EELSMODEL_PARAMETERS = """ll : None or EELSSpectrum
If an EELSSpectrum is provided, it will be assumed that it is
Expand All @@ -49,6 +47,4 @@
{}
dictionary : None or dict
A dictionary to be used to recreate a model. Usually generated using
:meth:`~.model.BaseModel.as_dictionary`""".format(
GOS_PARAMETER
)
:meth:`~.model.BaseModel.as_dictionary`""".format(GOS_PARAMETER)
2 changes: 2 additions & 0 deletions exspy/misc/eds/ffast_mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from hyperspy.misc import utils

# fmt: off

ffast_mac = {'Ru': {'mass_absorption_coefficient (cm2/g)': [199360.0, 198330.0, 196750.0, 194530.0, 191680.0, 188160.0, 184010.0, 179240.0, 173900.0, 168030.0, 161720.0, 155050.0, 148080.0, 140920.0, 133640.0, 126320.0, 119050.0, 111890.0, 104900.0, 97628.0, 88273.0, 83018.0, 81057.0, 80545.0, 137480.0, 136560.0, 130800.0, 109930.0, 90227.0, 75783.0, 64664.0, 55753.0, 48403.0, 42219.0, 37562.0, 36946.0, 36449.0, 36161.0, 36630.0, 35616.0, 33344.0, 29474.0, 26109.0, 23171.0, 20599.0, 18343.0, 16360.0, 14614.0, 13075.0, 11715.0, 10512.0, 9444.8, 8496.1, 7649.7, 6892.5, 6213.3, 5602.6, 5052.5, 4555.9, 4278.7, 4180.5, 4178.8, 4152.7, 7745.7, 7761.5, 7815.4, 7874.5, 10454.0, 10911.0, 12318.0, 15520.0, 18498.0, 20594.0, 21565.0, 21450.0, 20470.0, 20339.0, 20012.0, 19922.0, 22293.0, 21909.0, 21719.0, 21356.0, 21298.0, 21185.0, 22047.0, 21606.0, 20374.0, 18244.0, 16804.0, 16331.0, 16208.0, 16850.0, 16729.0, 16268.0, 14825.0, 12973.0, 11310.0, 9838.6, 8535.4, 7382.2, 6377.9, 5506.7, 4716.8, 4026.6, 3408.9, 2890.5, 2454.9, 2088.2, 1779.2, 1518.4, 1298.1, 1105.5, 938.86, 798.41, 679.61, 578.54, 493.06, 466.46, 449.9, 445.63, 1595.9, 1538.7, 1525.6, 1521.9, 1466.0, 1451.6, 1995.6, 1946.9, 1782.6, 1678.5, 1592.8, 1571.1, 1780.3, 1700.5, 1653.6, 1391.4, 1212.5, 1030.3, 866.03, 727.75, 611.86, 514.7, 433.08, 362.71, 303.45, 253.57, 212.08, 177.55, 148.78, 124.42, 103.21, 85.697, 71.222, 59.217, 49.218, 40.811, 33.786, 27.923, 23.098, 19.124, 15.848, 13.145, 10.912, 10.668, 10.227, 10.114, 67.868, 65.103, 61.789, 51.765, 43.567, 36.492, 30.434, 25.355, 21.127, 17.605, 14.672, 12.229, 10.18, 8.4239, 6.9713, 5.7697, 4.7756, 3.9528, 3.2718, 2.7068, 2.2387, 1.8492, 1.523, 1.2543, 1.0321, 0.84874, 0.69797, 0.57402, 0.4721, 0.38829, 0.31938, 0.2627, 0.2161, 0.17777, 0.14624, 0.12031, 0.098979, 0.081433, 0.067001, 0.055128, 0.04536, 0.037324, 0.030713, 0.025274, 0.020798, 0.017116, 0.014085, 0.0],
'energies (keV)': [0.01069, 0.01142761, 0.01221612, 0.01305903, 0.0139601, 0.01492335, 0.01595306, 0.01705382, 0.01823053, 0.01948844, 0.02083314, 0.02227063, 0.0238073, 0.02545001, 0.02720606, 0.02908327, 0.03109002, 0.03323523, 0.03552846, 0.03797993, 0.04060054, 0.042238, 0.0428845, 0.0430569, 0.0433155, 0.04340198, 0.043962, 0.04639671, 0.04959809, 0.05302035, 0.05667876, 0.06058959, 0.06477028, 0.06923942, 0.073402, 0.07401695, 0.0745255, 0.0748251, 0.0752745, 0.076398, 0.07912411, 0.08458368, 0.09041995, 0.09665893, 0.1033284, 0.1104581, 0.1180797, 0.1262272, 0.1349368, 0.1442475, 0.1542005, 0.1648404, 0.1762144, 0.1883732, 0.2013709, 0.2152655, 0.2301188, 0.245997, 0.2629708, 0.273812, 0.277928, 0.278003, 0.2791206, 0.280797, 0.2811158, 0.282182, 0.2833164, 0.285018, 0.289272, 0.3005128, 0.3212482, 0.3434143, 0.3671099, 0.3924405, 0.4195189, 0.4484657, 0.451388, 0.458297, 0.4601394, 0.462903, 0.469812, 0.473144, 0.4794098, 0.480386, 0.4823172, 0.485214, 0.492456, 0.5124891, 0.5478508, 0.5733, 0.582075, 0.584415, 0.5856525, 0.587925, 0.5967, 0.6260625, 0.6692609, 0.7154399, 0.7648052, 0.8175768, 0.8739896, 0.9342948, 0.9987612, 1.067676, 1.141345, 1.220098, 1.304285, 1.394281, 1.490486, 1.593329, 1.703269, 1.820795, 1.94643, 2.080733, 2.224304, 2.377781, 2.541848, 2.717235, 2.781142, 2.82371, 2.835062, 2.852089, 2.894658, 2.904724, 2.907562, 2.952066, 2.963933, 2.981735, 3.026238, 3.10515, 3.15952, 3.20788, 3.220776, 3.24012, 3.28848, 3.319406, 3.548445, 3.793288, 4.055024, 4.334821, 4.633924, 4.953664, 5.295467, 5.660855, 6.051453, 6.469004, 6.915365, 7.392525, 7.902609, 8.44789, 9.030794, 9.653919, 10.32004, 11.03212, 11.79334, 12.60708, 13.47697, 14.40688, 15.40095, 16.46362, 17.59961, 18.81398, 20.11215, 21.49988, 21.67486, 22.00661, 22.09508, 22.22779, 22.55954, 22.98338, 24.56923, 26.2645, 28.07676, 30.01405, 32.08502, 34.29889, 36.66551, 39.19543, 41.89992, 44.79101, 47.88159, 51.18542, 54.71721, 58.4927, 62.5287, 66.84318, 71.45536, 76.38578, 81.6564, 87.29069, 93.31374, 99.75239, 106.6353, 113.9931, 121.8587, 130.2669, 139.2553, 148.864, 159.1356, 170.1159, 181.8539, 194.4018, 207.8156, 222.1548, 237.4835, 253.8699, 271.3869, 290.1126, 310.1304, 331.5294, 354.4049, 378.8588, 405.0001, 432.9451, 0.0]},
'Re': {'mass_absorption_coefficient (cm2/g)': [12574.0, 12380.0, 11100.0, 11011.0, 10992.0, 50183.0, 49391.0, 72464.0, 79935.0, 87210.0, 93764.0, 99067.0, 102640.0, 104140.0, 103380.0, 100380.0, 95333.0, 88613.0, 80669.0, 71997.0, 63066.0, 54267.0, 45970.0, 38422.0, 31754.0, 29930.0, 28604.0, 28261.0, 56187.0, 54035.0, 53089.0, 44443.0, 39056.0, 37365.0, 36924.0, 41471.0, 40847.0, 39026.0, 33631.0, 30574.0, 29084.0, 28704.0, 38917.0, 37638.0, 37387.0, 31553.0, 26528.0, 22170.0, 18547.0, 15680.0, 13540.0, 12064.0, 11178.0, 10981.0, 10896.0, 10878.0, 11042.0, 10999.0, 10996.0, 11076.0, 11536.0, 12319.0, 13355.0, 14586.0, 15934.0, 17315.0, 18651.0, 19871.0, 20906.0, 21641.0, 22028.0, 22071.0, 21799.0, 21253.0, 20484.0, 19981.0, 19742.0, 19677.0, 20266.0, 20174.0, 20020.0, 19840.0, 19575.0, 19504.0, 19900.0, 19629.0, 19500.0, 18216.0, 16910.0, 15622.0, 14377.0, 13192.0, 12079.0, 11487.0, 11254.0, 11193.0, 11860.0, 11797.0, 11633.0, 10808.0, 10223.0, 10156.0, 10089.0, 10022.0, 9955.6, 9889.6, 9824.0, 9773.6, 9758.7, 9894.0, 9850.8, 9786.3, 9722.1, 9658.3, 9594.8, 9531.7, 9469.0, 9406.6, 9344.5, 9282.8, 9221.4, 9160.4, 9099.7, 9039.4, 8979.3, 8919.6, 8860.3, 8801.2, 8742.5, 8684.1, 8626.1, 8568.3, 8510.8, 8453.7, 8396.9, 8340.3, 8284.1, 8228.2, 8172.5, 8117.2, 8062.2, 8007.4, 7952.9, 7898.8, 7844.9, 7791.3, 7738.0, 7715.0, 7877.4, 7874.9, 7824.1, 7771.0, 7718.2, 7665.6, 7613.4, 7561.4, 7509.7, 7458.2, 7407.0, 7356.0, 7305.4, 7254.9, 7204.8, 7154.9, 7105.3, 7055.9, 7006.8, 6958.0, 6909.4, 6861.1, 6813.0, 6765.2, 6717.6, 6670.2, 6623.1, 6576.3, 6529.7, 6483.3, 6437.2, 6391.3, 6345.7, 6300.3, 6255.1, 6210.2, 6165.5, 6121.1, 6076.7, 6032.4, 5988.3, 5941.6, 5891.2, 5841.1, 5791.4, 5742.0, 5692.9, 5644.1, 5595.7, 5547.7, 5499.9, 5452.5, 5405.5, 5358.7, 5312.3, 5266.3, 5220.5, 5175.1, 5130.1, 5085.3, 5040.9, 4996.8, 4953.1, 4909.7, 4866.6, 4823.8, 4781.3, 4739.2, 4697.4, 4655.8, 4614.5, 4573.6, 4532.9, 4492.6, 4452.6, 4412.9, 4373.5, 4334.4, 4295.7, 4257.2, 4219.0, 4181.2, 4143.6, 4106.4, 4069.5, 4032.8, 3996.5, 3960.4, 3924.7, 3889.3, 3854.1, 3819.2, 3784.7, 3750.4, 3716.4, 3682.6, 3644.1, 3606.0, 3568.3, 3531.0, 3494.1, 3457.7, 3421.7, 3386.0, 3348.4, 3311.3, 3274.6, 3238.2, 3202.3, 3166.9, 3131.8, 3097.3, 3063.1, 3029.3, 2994.7, 2960.4, 2926.5, 2893.0, 2860.0, 2827.3, 2795.1, 2763.3, 2731.9, 2700.9, 2670.2, 2640.0, 2610.1, 2580.6, 2551.5, 2522.8, 2494.4, 2466.3, 2438.6, 2411.3, 2384.3, 2357.6, 2331.3, 2305.2, 2279.5, 2254.2, 2229.1, 2204.3, 2179.9, 2155.7, 2131.9, 2108.3, 2085.1, 2062.1, 2039.4, 2017.0, 1994.8, 1972.9, 1951.3, 1929.9, 1908.9, 1888.0, 1867.4, 1847.1, 1827.0, 1807.2, 1787.5, 1768.2, 1749.0, 1730.1, 1711.4, 1693.0, 1674.8, 1656.7, 1638.9, 1621.3, 1604.0, 1586.8, 1569.8, 1553.0, 1536.5, 1520.1, 1503.9, 1487.9, 1472.1, 1456.5, 1441.1, 1425.9, 1410.8, 1395.9, 1381.2, 1366.6, 1352.2, 1338.0, 1324.0, 1310.1, 1296.4, 1282.8, 1269.4, 1256.2, 1243.1, 1230.1, 1217.3, 1204.7, 1192.2, 1179.8, 1167.6, 1155.5, 1143.6, 1131.8, 1120.2, 1108.6, 1097.2, 1086.0, 1074.8, 1063.8, 1052.9, 1042.0, 1031.1, 1020.4, 1009.7, 999.2, 988.8, 978.52, 968.36, 958.32, 948.39, 938.57, 930.67, 3066.5, 3062.7, 3026.1, 2989.9, 2954.1, 2918.8, 2884.0, 2849.5, 2826.2, 4180.9, 4172.8, 4122.3, 4072.5, 4023.3, 3974.7, 3926.7, 3879.3, 3832.5, 3786.2, 3740.6, 3695.4, 3650.9, 3606.9, 3563.3, 3520.2, 3477.7, 3435.7, 3394.3, 3353.3, 3312.8, 3272.9, 3233.4, 3194.4, 3155.9, 3117.9, 3080.3, 3043.2, 3006.6, 2970.4, 2934.6, 2899.3, 2864.4, 2829.9, 2795.9, 2762.3, 2729.1, 2696.3, 2663.9, 2631.9, 2614.2, 3051.7, 3050.0, 3012.4, 2975.4, 2938.8, 2902.7, 2867.0, 2831.8, 2796.6, 2761.5, 2726.9, 2693.6, 2661.3, 2629.6, 2598.3, 2567.1, 2536.3, 2505.8, 2475.8, 2446.2, 2417.1, 2388.3, 2359.9, 2331.8, 2304.2, 2276.9, 2263.7, 2405.5, 2405.0, 2376.3, 2347.6, 2319.2, 2291.2, 2263.5, 2236.2, 2209.2, 2182.6, 2156.2, 2130.9, 2106.3, 2082.1, 2058.3, 2034.8, 2011.6, 1988.8, 1966.2, 1961.1, 2030.6, 2029.9, 2007.8, 1985.2, 1962.9, 1940.8, 1917.9, 1894.9, 1872.2, 1849.8, 1827.6, 1805.6, 1783.8, 1762.2, 1740.9, 1719.9, 1699.1, 1678.5, 1658.2, 1638.2, 1618.4, 1598.8, 1579.5, 1560.3, 1541.5, 1522.8, 1504.4, 1486.1, 1468.1, 1450.3, 1432.8, 1415.4, 1398.2, 1381.3, 1364.5, 1348.0, 1331.6, 1315.4, 1299.5, 1283.7, 1268.1, 1252.7, 1237.4, 1222.4, 1207.6, 1192.9, 1178.5, 1164.2, 1150.1, 1136.1, 1122.4, 1108.7, 1094.8, 1081.1, 1067.6, 1054.3, 1041.1, 1028.1, 1015.2, 1002.3, 989.48, 976.89, 964.46, 952.2, 940.11, 928.18, 916.42, 904.82, 893.37, 882.08, 870.94, 859.95, 849.11, 838.42, 827.87, 817.46, 807.2, 797.07, 787.08, 777.22, 767.5, 757.91, 748.44, 739.1, 729.89, 720.8, 711.84, 702.99, 694.26, 685.65, 677.15, 668.76, 660.49, 652.33, 644.27, 636.33, 628.48, 620.69, 612.84, 605.1, 597.46, 589.92, 582.49, 575.15, 567.87, 560.68, 553.59, 546.59, 539.69, 532.88, 526.17, 519.54, 513.0, 506.55, 500.17, 493.86, 487.64, 481.5, 475.44, 469.47, 463.58, 457.76, 452.0, 446.24, 440.57, 434.97, 429.44, 423.99, 418.61, 413.31, 408.07, 402.91, 397.81, 392.78, 387.82, 382.93, 378.1, 373.34, 368.63, 364.0, 359.41, 354.86, 350.37, 345.95, 341.58, 337.27, 333.02, 328.83, 324.69, 320.6, 316.57, 312.59, 308.67, 304.79, 300.97, 297.2, 293.48, 289.8, 286.18, 282.6, 279.07, 275.59, 272.15, 268.76, 265.41, 262.11, 258.85, 255.63, 252.45, 249.32, 246.22, 243.17, 240.16, 237.18, 234.25, 231.35, 228.49, 225.67, 222.88, 220.14, 217.42, 214.74, 212.1, 209.49, 206.92, 204.37, 201.86, 199.39, 196.94, 194.53, 192.15, 189.8, 187.48, 185.18, 182.92, 180.69, 178.49, 176.31, 174.16, 172.04, 169.95, 167.88, 165.84, 163.83, 161.84, 159.88, 157.94, 155.99, 154.07, 152.18, 150.31, 148.46, 146.63, 144.82, 143.01, 141.23, 122.4, 102.1, 85.275, 85.171, 81.694, 80.801, 215.03, 206.47, 192.12, 162.68, 159.87, 155.98, 154.26, 211.96, 203.57, 200.05, 191.94, 189.86, 216.47, 215.7, 208.44, 181.84, 152.93, 128.55, 107.92, 90.543, 75.994, 63.816, 53.585, 44.958, 37.732, 31.639, 26.324, 21.86, 18.169, 15.114, 12.583, 10.484, 8.7415, 7.2943, 6.0809, 5.0699, 4.2218, 3.5035, 2.9089, 2.4151, 2.1041, 2.0173, 2.0065, 1.9949, 10.048, 9.6829, 8.6629, 7.2598, 6.089, 5.1151, 4.2756, 3.5744, 2.9885, 2.4991, 2.0901, 1.7482, 1.4597, 1.2173, 1.0153, 0.84684, 0.70641, 0.58933, 0.49169, 0.41027, 0.34236, 0.28571, 0.23846, 0.19903, 0.16744, 0.1409, 0.11858, 0.0998, 0.084002, 0.0],
Expand Down
4 changes: 1 addition & 3 deletions exspy/misc/eels/electron_inelastic_mean_free_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ def iMFP_TPP2M(electron_energy, density, M, N_v, E_g):
D = 534 - 208 * U
beta = -1 + 9.44 / math.sqrt(E_p**2 + E_g**2) + 0.69 * rho**0.1
iMFP = (
alpha
* E
/ (E_p**2 * (beta * math.log(gamma * alpha * E) - C / E + D / E**2))
alpha * E / (E_p**2 * (beta * math.log(gamma * alpha * E) - C / E + D / E**2))
)
return iMFP

Expand Down
Loading

0 comments on commit f7b3041

Please sign in to comment.