mmg_toolbox example¶
Load NeXus files as XAS Spectra and calculate XMCD¶
This short notebook describes an example of spectroscopy data analysis.
Notebook Notes¶
This notebook will run with any modern version of python and requires mmg_toolbox, which can be installed easily using:
python -m pip install mmg_toolbox
In [1]:
Copied!
import os
import numpy as np
import matplotlib.pyplot as plt
from mmg_toolbox import Experiment, module_info
print(module_info())
import os
import numpy as np
import matplotlib.pyplot as plt
from mmg_toolbox import Experiment, module_info
print(module_info())
Python version 3.14.5 (main, Jun 2 2026, 22:25:17) [Clang 22.1.3 ]
at: /scratch/grp66007/python/mmg_toolbox/.venv/bin/python
mmg_toolbox version 0.7.1 (17/09/2026): /scratch/grp66007/python/mmg_toolbox/mmg_toolbox/__init__.py
numpy version: 2.5.3
h5py version: 3.16.0
matplotlib version: 3.11.2
hdfmap version: 1.4.0 (2026/08/28)
tkinter version: 9.0
In [2]:
Copied!
# Create experiment object looking at a particular folder
exp = Experiment('/dls/science/groups/das/ExampleData/hdfmap_tests/i10', instrument='i10-1')
print(exp)
print(exp.all_scans_str())
# Create experiment object looking at a particular folder
exp = Experiment('/dls/science/groups/das/ExampleData/hdfmap_tests/i10', instrument='i10-1')
print(exp)
print(exp.all_scans_str())
Instrument: i10-1
/dls/science/groups/das/ExampleData/hdfmap_tests/i10
Files: 12
Scans: 207-921636
i10/i10-1-207.nxs : 2024-04-10 18:20:22.094000 : cvscan energye 695 740 0.1 mcse16 0.28 mcse17 0.28 mcse18 0.28
i10/i10-1-26851.nxs : 2025-03-26 10:59:09.009000 : cvscan energy 925 940 0.1 mcsh16 0.2 mcsh17 0.2 mcsh18 0.2 mcsh19 0.2
i10/i10-1-28428.nxs : 2025-03-30 21:07:49.143000 : scan ips_field 7 -7.1 0.2 pol ('pc', 'nc') energy (701, 707.15, 708.33, 709.05, 773, 778.29) checkbeam macj216 macj217 macj218 5
i10/i10-1-37436.nxs : 2025-06-23 13:23:58.236000 : cvscan energy 690 750 0.1 mcse16 0.2 mcse17 0.2 mcse18 0.2
i10/i10-1-37437.nxs : 2025-06-23 13:26:27.759000 : cvscan energy 690 750 0.1 mcse16 0.2 mcse17 0.2 mcse18 0.2
i10/i10-1-37438.nxs : 2025-06-23 13:30:18.476000 : cvscan energy 690 750 0.1 mcse16 0.2 mcse17 0.2 mcse18 0.2
i10/i10-1-37439.nxs : 2025-06-23 13:32:47.677000 : cvscan energy 690 750 0.1 mcse16 0.2 mcse17 0.2 mcse18 0.2
i10/i10-1-49472.nxs : 2026-01-20 08:22:12.862000 : cvscan energy 695 740 0.1 mcsh16 0.2 mcsh17 0.2 mcsh18 0.2 mcsh19 0.2
i10/i10-608314.nxs : 2026-01-20 08:22:12.862000 : scan ips_field 7 -7.1 0.2 pol ('pc', 'nc') energy (701, 707.15, 708.33, 709.05, 773, 778.29) checkbeam macj216 macj217 macj218 5
i10/i10-618365.nxs : 2026-01-20 08:22:12.862000 : scan ips_field 7 -7.1 0.2 pol ('pc', 'nc') energy (701, 707.15, 708.33, 709.05, 773, 778.29) checkbeam macj216 macj217 macj218 5
i10/i10-854741.nxs : 2025-01-29 16:04:01.928000 : scan dummy 1 1 1 pimtetiff 0.01
i10/i10-921636.nxs : 2026-01-13 12:16:24.680000 : scan ds 1 5 1 pimte 0.1
In [3]:
Copied!
# Load scan files as Spectra objects, automatically loading and normalising the data, finding the edge
spectra = exp.load_xas(37436, 37437, 37438, 37439, dls_loader=True, mode='tey')
for spectrum in spectra:
m = spectrum.metadata
print(spectrum.label())
#print(f"Spectrum: {spectrum.name} T={m.temp:.1f} K, B={m.mag_field:+3.1f} T, pol='{m.pol}'")
# Load scan files as Spectra objects, automatically loading and normalising the data, finding the edge
spectra = exp.load_xas(37436, 37437, 37438, 37439, dls_loader=True, mode='tey')
for spectrum in spectra:
m = spectrum.metadata
print(spectrum.label())
#print(f"Spectrum: {spectrum.name} T={m.temp:.1f} K, B={m.mag_field:+3.1f} T, pol='{m.pol}'")
37436 FeL3, L2 T=10K 'pc' B=+1T 37437 FeL3, L2 T=10K 'pc' B=-1T 37438 FeL3, L2 T=10K 'nc' B=-1T 37439 FeL3, L2 T=10.1K 'nc' B=+1T
In [4]:
Copied!
# Plot the spectra
fig, ax = plt.subplots()
for spectrum in spectra:
spectrum.plot('tey', axes=ax, label=spectrum.label())
ax.legend()
ax.set_xlabel('Energy (eV)')
ax.set_ylabel('Signal / monitor')
# Plot the spectra
fig, ax = plt.subplots()
for spectrum in spectra:
spectrum.plot('tey', axes=ax, label=spectrum.label())
ax.legend()
ax.set_xlabel('Energy (eV)')
ax.set_ylabel('Signal / monitor')
Out[4]:
Text(0, 0.5, 'Signal / monitor')
In [5]:
Copied!
# Process each spectra by applying a series of actions
# in this case, divide by the pre-edge region, then remove a linearly fitted background
spectra = [
spectrum.divide_by_preedge(ev_from_start=5).remove_background('linear')
for spectrum in spectra
]
# Plot the processed spectra
fig, ax = plt.subplots()
for spectrum in spectra:
spectrum.plot('tey', axes=ax, label=spectrum.label())
ax.legend()
ax.set_xlabel('Energy (eV)')
ax.set_ylabel('Signal / monitor')
# Process each spectra by applying a series of actions
# in this case, divide by the pre-edge region, then remove a linearly fitted background
spectra = [
spectrum.divide_by_preedge(ev_from_start=5).remove_background('linear')
for spectrum in spectra
]
# Plot the processed spectra
fig, ax = plt.subplots()
for spectrum in spectra:
spectrum.plot('tey', axes=ax, label=spectrum.label())
ax.legend()
ax.set_xlabel('Energy (eV)')
ax.set_ylabel('Signal / monitor')
Out[5]:
Text(0, 0.5, 'Signal / monitor')
In [6]:
Copied!
# separate the spectra into individual Spectra objects and calculate the subtractions
up_right, down_right, down_left, up_left = spectra
xmcd_field1 = up_right - down_right
xmcd_field2 = up_left - down_left
xmcd_pol1 = up_left - up_right
xmcd_pol2 = down_left - down_right
av_pol1 = up_right + down_left
av_pol2 = up_left + down_left
xmcd_av = av_pol1 - av_pol2
# Create Sum Rules plot
xmcd_av.create_sum_rules_figure(split_energy=717)
plt.tight_layout()
plt.show()
# separate the spectra into individual Spectra objects and calculate the subtractions
up_right, down_right, down_left, up_left = spectra
xmcd_field1 = up_right - down_right
xmcd_field2 = up_left - down_left
xmcd_pol1 = up_left - up_right
xmcd_pol2 = down_left - down_right
av_pol1 = up_right + down_left
av_pol2 = up_left + down_left
xmcd_av = av_pol1 - av_pol2
# Create Sum Rules plot
xmcd_av.create_sum_rules_figure(split_energy=717)
plt.tight_layout()
plt.show()
In [7]:
Copied!
# Determine the Sum Rules
print(xmcd_av.sum_rules_report(mode='tey', split_energy=717, n_holes=None))
# Determine the Sum Rules
print(xmcd_av.sum_rules_report(mode='tey', split_energy=717, n_holes=None))
=== Sum Rules === tey signal = 3.20% Split energy between Fe L3, L2 edges: 717 eV Fe n_holes = 4, energy split = 717 eV L = 0.007 μB S = -0.044 μB
In [8]:
Copied!
# Plot XMCD as ratio to XAS peak
s = xmcd_av.spectra['tey']
s.plot_sum_rules_ratio(split_energy=717)
# Plot XMCD as ratio to XAS peak
s = xmcd_av.spectra['tey']
s.plot_sum_rules_ratio(split_energy=717)
Out[8]:
[<matplotlib.lines.Line2D at 0x7fd4da8e7380>]
In [9]:
Copied!
# Write output NeXus file
xmcd_av.write_nexus('xmcd.nxs')
# Write output NeXus file
xmcd_av.write_nexus('xmcd.nxs')
Created xmcd.nxs
In [10]:
Copied!
# Write data as CSV for VirtualBeamline App
spectra = exp.load_xas(37436, 37437, 37438, 37439, dls_loader=True, mode='tey')
for spectrum in spectra:
spectrum.write_csv(f"{spectrum.label()}.csv", 'tey')
print('\nOpening file:')
with open("37436 FeL3, L2 T=10K 'pc' B=+1T.csv") as f:
print(f.read())
# Write data as CSV for VirtualBeamline App
spectra = exp.load_xas(37436, 37437, 37438, 37439, dls_loader=True, mode='tey')
for spectrum in spectra:
spectrum.write_csv(f"{spectrum.label()}.csv", 'tey')
print('\nOpening file:')
with open("37436 FeL3, L2 T=10K 'pc' B=+1T.csv") as f:
print(f.read())
Saved 37436 FeL3, L2 T=10K 'pc' B=+1T.csv Saved 37437 FeL3, L2 T=10K 'pc' B=-1T.csv Saved 37438 FeL3, L2 T=10K 'nc' B=-1T.csv Saved 37439 FeL3, L2 T=10.1K 'nc' B=+1T.csv Opening file: # 37436 raw # energy, tey 6.903443000000000893e+02, 1.360528726338575134e-01 6.905007000000000517e+02, 1.360358056265984772e-01 6.906035000000000537e+02, 1.360550479828780412e-01 6.907003000000000839e+02, 1.360113853834774011e-01 6.908006000000000313e+02, 1.359833490819010726e-01 6.909010000000000673e+02, 1.359819286334167099e-01 6.909918000000000120e+02, 1.359827725217639671e-01 6.910917000000000598e+02, 1.359583346085962985e-01 6.911861000000000104e+02, 1.359557752964845045e-01 6.912780000000000200e+02, 1.359363333579668709e-01 6.913654000000000224e+02, 1.359676280899706768e-01 6.914565000000000055e+02, 1.360118645665840120e-01 6.915518000000000711e+02, 1.359814202696301988e-01 6.916499999999999773e+02, 1.358996799487103835e-01 6.917475000000000591e+02, 1.358664422397266314e-01 6.918413000000000466e+02, 1.358919737865607880e-01 6.919333000000000311e+02, 1.359113494554650414e-01 6.920289000000000215e+02, 1.358475521030404753e-01 6.921213999999999942e+02, 1.358171673427528425e-01 6.922108000000000629e+02, 1.357843684365392656e-01 6.922998000000000047e+02, 1.358298727292560348e-01 6.923942000000000689e+02, 1.357693877499283885e-01 6.924827000000000226e+02, 1.358142364631920451e-01 6.925763000000000602e+02, 1.358360113948560988e-01 6.926711000000000240e+02, 1.357935261638214819e-01 6.927613000000000056e+02, 1.358154753161767980e-01 6.928526000000000522e+02, 1.357810657177422331e-01 6.929455000000000382e+02, 1.358076867596109683e-01 6.930356000000000449e+02, 1.358290231484761690e-01 6.931186999999999898e+02, 1.357793989354304509e-01 6.932082000000000335e+02, 1.357549439883528053e-01 6.932878000000000611e+02, 1.357730132211811824e-01 6.933765000000000782e+02, 1.357633626351419653e-01 6.934719999999999800e+02, 1.357436472346786327e-01 6.935700000000000500e+02, 1.357311776122680225e-01 6.936637000000000626e+02, 1.357087728325186426e-01 6.937504000000000133e+02, 1.357172936729480750e-01 6.938518000000000256e+02, 1.357350149138576711e-01 6.939360000000000355e+02, 1.356924720562000530e-01 6.940280999999999949e+02, 1.356869878042943067e-01 6.941233000000000857e+02, 1.356833031904442766e-01 6.942055000000000291e+02, 1.356406209488424663e-01 6.942973000000000638e+02, 1.356970400376635577e-01 6.943885999999999967e+02, 1.356649901750378029e-01 6.944750000000000227e+02, 1.356215642587348946e-01 6.945740000000000691e+02, 1.355670660142397899e-01 6.946716999999999871e+02, 1.355821485011946825e-01 6.947634000000000469e+02, 1.355593442491230538e-01 6.948650999999999840e+02, 1.355626686750768806e-01 6.949632000000000289e+02, 1.355360992122941199e-01 6.950654000000000678e+02, 1.354922682609982221e-01 6.951592000000000553e+02, 1.355483710769277150e-01 6.952539000000000442e+02, 1.355249832041473257e-01 6.953457000000000789e+02, 1.354628281983130678e-01 6.954401000000000295e+02, 1.354528198887169355e-01 6.955416999999999916e+02, 1.354468878681302224e-01 6.956482000000000880e+02, 1.354318612279415690e-01 6.957418000000000120e+02, 1.354097122724897406e-01 6.958464000000000169e+02, 1.353682979372116679e-01 6.959395000000000664e+02, 1.353656799766132790e-01 6.960414000000000669e+02, 1.353950688216632170e-01 6.961371000000000322e+02, 1.353717460515637683e-01 6.962296000000000049e+02, 1.353957312308226302e-01 6.963181000000000722e+02, 1.353632793201020035e-01 6.964059000000000879e+02, 1.353239439429952395e-01 6.964972000000000207e+02, 1.353237428008676468e-01 6.965963000000000420e+02, 1.352825529560977014e-01 6.966824000000000296e+02, 1.352959638128070075e-01 6.967826999999999771e+02, 1.352219727928403170e-01 6.968754000000000133e+02, 1.352094315730815177e-01 6.969659000000000333e+02, 1.352358307549966776e-01 6.970559000000000651e+02, 1.352077662179463347e-01 6.971475000000000364e+02, 1.351914211513848552e-01 6.972282999999999902e+02, 1.351723349755652726e-01 6.973154000000000678e+02, 1.352231025906684148e-01 6.974020000000000437e+02, 1.352285232373566237e-01 6.974890000000000327e+02, 1.352344718144589397e-01 6.975769999999999982e+02, 1.352278003013999974e-01 6.976733000000000402e+02, 1.352185651328066118e-01 6.977625000000000455e+02, 1.352040436708515370e-01 6.978564000000000078e+02, 1.351358048553240321e-01 6.979496000000000322e+02, 1.351858964034837740e-01 6.980468000000000757e+02, 1.352258307558093509e-01 6.981363000000000056e+02, 1.352218938941715798e-01 6.982287000000000035e+02, 1.352319248686762176e-01 6.983188000000000102e+02, 1.352457494299147966e-01 6.984080000000000155e+02, 1.352812727461786546e-01 6.985072999999999865e+02, 1.352356307194474139e-01 6.986008000000000493e+02, 1.352297766160283632e-01 6.986942999999999984e+02, 1.351929845375093864e-01 6.987937000000000580e+02, 1.352115877294187141e-01 6.988910000000000764e+02, 1.351800458262552851e-01 6.989903000000000475e+02, 1.352073182170485111e-01 6.990874999999999773e+02, 1.352036913662496564e-01 6.991865999999999985e+02, 1.351932600674782547e-01 6.992788000000000466e+02, 1.352409891134382647e-01 6.993807000000000471e+02, 1.352240093671042143e-01 6.994804000000000315e+02, 1.352287121051568008e-01 6.995774000000000115e+02, 1.352104905370390409e-01 6.996778000000000475e+02, 1.352161774915434378e-01 6.997821000000000140e+02, 1.351826706418317314e-01 6.998819000000000869e+02, 1.352155555063728476e-01 6.999821000000000595e+02, 1.352385260652787524e-01 7.000738999999999805e+02, 1.352256669247121623e-01 7.001714000000000624e+02, 1.352630531315965889e-01 7.002608999999999924e+02, 1.352778890114506583e-01 7.003534000000000788e+02, 1.353188980729787272e-01 7.004243999999999915e+02, 1.353324199702420350e-01 7.005163000000000011e+02, 1.353828405925162348e-01 7.006403999999999996e+02, 1.353609182997718985e-01 7.007436000000000149e+02, 1.353826238535258963e-01 7.008451999999999771e+02, 1.354283108783903011e-01 7.009478000000000293e+02, 1.354449982112841122e-01 7.010456000000000358e+02, 1.354442934283510147e-01 7.011449999999999818e+02, 1.354619216036616058e-01 7.012395999999999958e+02, 1.354775566131222464e-01 7.013358000000000629e+02, 1.355841371918542204e-01 7.014234999999999900e+02, 1.355280912059761145e-01 7.015212000000000216e+02, 1.356056920605973326e-01 7.016150999999999840e+02, 1.355893703287577579e-01 7.017112000000000762e+02, 1.356852898504706806e-01 7.018092000000000326e+02, 1.357215057596429519e-01 7.019107999999999947e+02, 1.357737843912987241e-01 7.020078000000000884e+02, 1.358726424303955682e-01 7.021028000000000020e+02, 1.359129501317458688e-01 7.021997000000000071e+02, 1.359866925530980875e-01 7.022927000000000817e+02, 1.360035490208504894e-01 7.023810000000000855e+02, 1.360446928463183991e-01 7.024761000000000877e+02, 1.361176596656665239e-01 7.025665999999999940e+02, 1.361139973281876303e-01 7.026585000000000036e+02, 1.362879591856604455e-01 7.027567000000000235e+02, 1.363417446255782983e-01 7.028548000000000684e+02, 1.364815990387866218e-01 7.029486000000000558e+02, 1.365493572246298803e-01 7.030441000000000713e+02, 1.366704339689136793e-01 7.031392000000000735e+02, 1.367984934086629023e-01 7.032273999999999887e+02, 1.369153305627545669e-01 7.033007000000000062e+02, 1.370654167020850245e-01 7.034043000000000347e+02, 1.371522889460653483e-01 7.034775000000000773e+02, 1.373283789654561604e-01 7.035792999999999893e+02, 1.374992416429048070e-01 7.036728000000000520e+02, 1.376889639246278996e-01 7.037622999999999820e+02, 1.378440283584802806e-01 7.038600000000000136e+02, 1.380263403314221093e-01 7.039592000000000098e+02, 1.382583554094041767e-01 7.040565000000000282e+02, 1.384834391712443658e-01 7.041683000000000447e+02, 1.387397241709762419e-01 7.042477000000000089e+02, 1.389517728438059430e-01 7.043410999999999831e+02, 1.392894982559180206e-01 7.044340000000000828e+02, 1.395225182113042917e-01 7.045279000000000451e+02, 1.398582307350354770e-01 7.046417000000000144e+02, 1.402611768172365991e-01 7.047270000000000891e+02, 1.406411781884532031e-01 7.048203000000000884e+02, 1.411468528767870489e-01 7.049264000000000578e+02, 1.416747703422365223e-01 7.050239000000000260e+02, 1.422620382899995872e-01 7.051470000000000482e+02, 1.429374279415524529e-01 7.052243000000000848e+02, 1.436854908900659922e-01 7.053213000000000648e+02, 1.444330920412156549e-01 7.054129000000000360e+02, 1.453213838296232019e-01 7.055063999999999851e+02, 1.462766085561651996e-01 7.056202000000000680e+02, 1.473578753184951184e-01 7.056965000000000146e+02, 1.485915628642717479e-01 7.057929000000000315e+02, 1.499660644919060259e-01 7.058978000000000748e+02, 1.516492560479941187e-01 7.059936999999999898e+02, 1.536483577278795476e-01 7.061127999999999929e+02, 1.560156116611317312e-01 7.061990000000000691e+02, 1.588404264269317190e-01 7.063043000000000120e+02, 1.622010615573512560e-01 7.063971999999999980e+02, 1.664524189963597911e-01 7.064977999999999838e+02, 1.719991926725422116e-01 7.066037000000000035e+02, 1.796806520480967173e-01 7.066816999999999780e+02, 1.913402556869335525e-01 7.067798999999999978e+02, 2.094584378337513431e-01 7.068789000000000442e+02, 2.363676926730621242e-01 7.069761000000000877e+02, 2.723181532648256131e-01 7.070922000000000480e+02, 3.133450925317906033e-01 7.071723000000000638e+02, 3.538966794264333249e-01 7.072717999999999847e+02, 3.912208984693241742e-01 7.073573999999999842e+02, 4.294133995227462086e-01 7.074541000000000395e+02, 4.742771859301297965e-01 7.075674999999999955e+02, 5.238628853834439436e-01 7.076337000000000899e+02, 5.659335398344480517e-01 7.077303000000000566e+02, 5.826378254211331820e-01 7.078281000000000631e+02, 5.706391790045526324e-01 7.079229000000000269e+02, 5.477252367927570864e-01 7.080382000000000744e+02, 5.361605000465570203e-01 7.081157000000000608e+02, 5.454000863967999324e-01 7.082094000000000733e+02, 5.759954007962729827e-01 7.083129999999999882e+02, 6.254215836529225525e-01 7.084062999999999874e+02, 6.924182476880541559e-01 7.085185000000000173e+02, 7.703296284474256961e-01 7.085966000000000804e+02, 8.524804115363547874e-01 7.086954000000000633e+02, 9.319558035246736649e-01 7.087884000000000242e+02, 1.005053485096501609e+00 7.088840000000000146e+02, 1.070493878269641597e+00 7.089953000000000429e+02, 1.128494303993150538e+00 7.090789000000000897e+02, 1.176710494712335242e+00 7.091802000000000135e+02, 1.207255622477550583e+00 7.092794000000000096e+02, 1.212999486731046961e+00 7.093785000000000309e+02, 1.188495465924367167e+00 7.094968000000000075e+02, 1.136964472309299978e+00 7.095711000000000013e+02, 1.064943232518843486e+00 7.096716000000000122e+02, 9.840041781903212659e-01 7.097694000000000187e+02, 8.997088436084409446e-01 7.098694000000000415e+02, 8.199370190105766953e-01 7.100029000000000678e+02, 7.504227610267697468e-01 7.100845000000000482e+02, 6.928359858375011671e-01 7.101935000000000855e+02, 6.465848515719396783e-01 7.102984999999999900e+02, 6.099991470730389276e-01 7.104059000000000879e+02, 5.804411399074150824e-01 7.105279000000000451e+02, 5.561914549019236764e-01 7.106082000000000107e+02, 5.351554547649596261e-01 7.106983000000000175e+02, 5.163013886718842427e-01 7.107966000000000122e+02, 4.978436192184036435e-01 7.108925000000000409e+02, 4.800078497946522194e-01 7.110011000000000649e+02, 4.628431333145773818e-01 7.110978000000000065e+02, 4.469119765711721537e-01 7.111990000000000691e+02, 4.330255596261364248e-01 7.113018000000000711e+02, 4.205866037179109007e-01 7.114034000000000333e+02, 4.096635184949190545e-01 7.115099999999999909e+02, 4.000169910702486287e-01 7.115977000000000317e+02, 3.910608861308637052e-01 7.116956999999999880e+02, 3.835411341966029064e-01 7.117945000000000846e+02, 3.765491595242527745e-01 7.118894000000000233e+02, 3.700601030607342246e-01 7.119995000000000118e+02, 3.638268468795099464e-01 7.120868000000000393e+02, 3.578814075934351191e-01 7.121901000000000295e+02, 3.518884902664235481e-01 7.122952000000000226e+02, 3.459699590093575083e-01 7.123958000000000084e+02, 3.399064100424703527e-01 7.125249000000000024e+02, 3.339064221174691260e-01 7.126043000000000802e+02, 3.280938410911798386e-01 7.126997000000000071e+02, 3.223131767809283565e-01 7.128016999999999825e+02, 3.169834442994112211e-01 7.129005000000000791e+02, 3.115049768746540604e-01 7.130148000000000366e+02, 3.062343589851839742e-01 7.130927000000000362e+02, 3.007875788106363912e-01 7.131893999999999778e+02, 2.953678218807462841e-01 7.132946000000000595e+02, 2.903862729299780954e-01 7.133997000000000526e+02, 2.854161060476652634e-01 7.135121000000000322e+02, 2.809471517779583150e-01 7.135957000000000789e+02, 2.763610077223780381e-01 7.136936000000000604e+02, 2.721015407931295926e-01 7.137918000000000802e+02, 2.681728811261072654e-01 7.138860000000000809e+02, 2.644830680363035036e-01 7.139916000000000622e+02, 2.610941837316460012e-01 7.140821000000000822e+02, 2.578932858591380661e-01 7.141743999999999915e+02, 2.547339819604474420e-01 7.142802000000000362e+02, 2.520256709451575428e-01 7.143799999999999955e+02, 2.496890496470451082e-01 7.144895999999999958e+02, 2.475381694523097476e-01 7.145780000000000882e+02, 2.456992605991664136e-01 7.146870999999999867e+02, 2.442339825079408722e-01 7.147793000000000347e+02, 2.430739047565789179e-01 7.148761000000000649e+02, 2.422252413699887974e-01 7.149879000000000815e+02, 2.412865823845777857e-01 7.150658000000000811e+02, 2.406737832206092831e-01 7.151607999999999947e+02, 2.400260619669804252e-01 7.152521000000000413e+02, 2.395862428542167022e-01 7.153505999999999858e+02, 2.390090458995644540e-01 7.154749000000000478e+02, 2.384575483876970325e-01 7.155543000000000120e+02, 2.377333150546154239e-01 7.156546000000000731e+02, 2.371448287719770953e-01 7.157527000000000044e+02, 2.361909580628465399e-01 7.158559000000000196e+02, 2.354627810977846514e-01 7.159590000000000600e+02, 2.344707094331217323e-01 7.160429000000000315e+02, 2.335151893476157259e-01 7.161383000000000720e+02, 2.323235837067134102e-01 7.162393000000000711e+02, 2.310201186394709172e-01 7.163427000000000362e+02, 2.296229344828385477e-01 7.164655999999999949e+02, 2.281306185242164275e-01 7.165587000000000444e+02, 2.264963698051158658e-01 7.166639000000000124e+02, 2.248088741623782971e-01 7.167715000000000600e+02, 2.231477777032605525e-01 7.168783000000000811e+02, 2.215123578826157236e-01 7.169922000000000253e+02, 2.197903017445582141e-01 7.170801999999999907e+02, 2.183183731590663812e-01 7.171766000000000076e+02, 2.167009037195534726e-01 7.172828000000000657e+02, 2.150959608441875004e-01 7.173786000000000058e+02, 2.134821601751193676e-01 7.175080000000000382e+02, 2.119076302440330295e-01 7.175872000000000526e+02, 2.103789275062108999e-01 7.176922000000000708e+02, 2.089583895278736558e-01 7.177921999999999798e+02, 2.077759486491347063e-01 7.179039000000000215e+02, 2.065454746482636716e-01 7.180234000000000378e+02, 2.056517662345441477e-01 7.181032999999999902e+02, 2.048359470684114059e-01 7.181928000000000338e+02, 2.042733252142763523e-01 7.182936000000000831e+02, 2.037508655932160628e-01 7.183794000000000324e+02, 2.034649856143070368e-01 7.184930000000000518e+02, 2.033655073443677019e-01 7.185688000000000102e+02, 2.034017514422966355e-01 7.186765000000000327e+02, 2.037204727123965164e-01 7.187735000000000127e+02, 2.041162166444315251e-01 7.188747000000000753e+02, 2.048611669280814562e-01 7.189818999999999960e+02, 2.057050268405699878e-01 7.190738000000000056e+02, 2.067983206201493562e-01 7.191648999999999887e+02, 2.079725287706991887e-01 7.192587000000000899e+02, 2.094999942646738333e-01 7.193496000000000095e+02, 2.112133503621684838e-01 7.194536000000000513e+02, 2.134387804939568145e-01 7.195415000000000418e+02, 2.160698778009206844e-01 7.196413000000000011e+02, 2.194463154132702820e-01 7.197362000000000535e+02, 2.236970516139378251e-01 7.198404000000000451e+02, 2.291943479734992462e-01 7.199659000000000333e+02, 2.362223835179202425e-01 7.200429000000000315e+02, 2.451526969131055667e-01 7.201394000000000233e+02, 2.563501412413225489e-01 7.202373000000000047e+02, 2.698289945133642287e-01 7.203367000000000644e+02, 2.853010185646790986e-01 7.204551999999999907e+02, 3.017837915686529815e-01 7.205298000000000229e+02, 3.180164669460697202e-01 7.206326000000000249e+02, 3.309970484223223597e-01 7.207427999999999884e+02, 3.394121246997141017e-01 7.208503000000000611e+02, 3.434610906932681895e-01 7.209885000000000446e+02, 3.444230848260966815e-01 7.210711000000000013e+02, 3.438303195204682194e-01 7.211781000000000859e+02, 3.421900473123182795e-01 7.212812000000000126e+02, 3.403789156901190216e-01 7.213866000000000440e+02, 3.378133831707539336e-01 7.214950999999999794e+02, 3.350658469141881701e-01 7.215831000000000586e+02, 3.323531421542946784e-01 7.216847999999999956e+02, 3.309201839457269201e-01 7.217956000000000358e+02, 3.317017224076842519e-01 7.219035000000000082e+02, 3.349993857521805785e-01 7.220226000000000113e+02, 3.404352603167887237e-01 7.221138000000000829e+02, 3.469395640611859788e-01 7.222154000000000451e+02, 3.539647221660344734e-01 7.223244000000000824e+02, 3.601199468417405902e-01 7.224242000000000417e+02, 3.648275000283997538e-01 7.225433000000000447e+02, 3.671193820129072805e-01 7.226253000000000384e+02, 3.672673538364457091e-01 7.227264999999999873e+02, 3.648665816685345287e-01 7.228259000000000469e+02, 3.605376283105540813e-01 7.229292000000000371e+02, 3.546430417864690487e-01 7.230523000000000593e+02, 3.478387049234222261e-01 7.231366000000000440e+02, 3.408290380927772034e-01 7.232355000000000018e+02, 3.341472751447993605e-01 7.233383000000000038e+02, 3.283297517985041547e-01 7.234329000000000178e+02, 3.232397298716346845e-01 7.235514000000000578e+02, 3.189398997385960999e-01 7.236281000000000176e+02, 3.146953113160388948e-01 7.237232000000000198e+02, 3.105825896996368130e-01 7.238161999999999807e+02, 3.061025201688099551e-01 7.239214000000000624e+02, 3.011379820147300213e-01 7.240387000000000626e+02, 2.958245237153033225e-01 7.241315000000000737e+02, 2.899595743671207759e-01 7.242316000000000713e+02, 2.840306210062995551e-01 7.243359000000000378e+02, 2.780801337445073518e-01 7.244360000000000355e+02, 2.723501221787106297e-01 7.245460000000000491e+02, 2.671187711429978129e-01 7.246276000000000295e+02, 2.621782777080644000e-01 7.247189000000000760e+02, 2.576516855707204345e-01 7.248086000000000695e+02, 2.533247634834184803e-01 7.249012000000000171e+02, 2.492624037967031414e-01 7.250230999999999995e+02, 2.453265812738574803e-01 7.250953000000000657e+02, 2.416845644692747486e-01 7.252010000000000218e+02, 2.383369607829883829e-01 7.253025999999999840e+02, 2.351301763825260904e-01 7.254094999999999800e+02, 2.323960629690761670e-01 7.255292000000000598e+02, 2.297474009736642508e-01 7.256118999999999915e+02, 2.274041588003789249e-01 7.257096000000000231e+02, 2.251975693460533390e-01 7.258118000000000620e+02, 2.232442656243323331e-01 7.259092000000000553e+02, 2.212919466858465634e-01 7.260285000000000082e+02, 2.195731041210557399e-01 7.261100000000000136e+02, 2.178485765875832203e-01 7.262148000000000820e+02, 2.163839777143755638e-01 7.263197000000000116e+02, 2.149690363185901010e-01 7.264247000000000298e+02, 2.136157982778170705e-01 7.265388000000000375e+02, 2.124331166732502663e-01 7.266354999999999791e+02, 2.113053701966873255e-01 7.267420000000000755e+02, 2.103363982955819556e-01 7.268389000000000806e+02, 2.094212078069123129e-01 7.269378000000000384e+02, 2.086835456092404339e-01 7.270525999999999840e+02, 2.078541958778126753e-01 7.271437000000000808e+02, 2.072028289949587876e-01 7.272513000000000147e+02, 2.066367439818672103e-01 7.273591000000000122e+02, 2.060538633560394239e-01 7.274680000000000746e+02, 2.056719005099469921e-01 7.275923000000000229e+02, 2.052515852828431242e-01 7.276811000000000149e+02, 2.048653076571858300e-01 7.277889999999999873e+02, 2.045886490370731892e-01 7.278875000000000455e+02, 2.042000138643839668e-01 7.279879000000000815e+02, 2.039693188425242554e-01 7.281222999999999956e+02, 2.036967072568223458e-01 7.281908000000000811e+02, 2.034826537911301747e-01 7.282963000000000875e+02, 2.032640087266744666e-01 7.284051000000000613e+02, 2.030007149879345663e-01 7.285099999999999909e+02, 2.027728823099758104e-01 7.286339000000000397e+02, 2.025409158907718887e-01 7.287255000000000109e+02, 2.023174158870890416e-01 7.288286000000000513e+02, 2.021569660493275911e-01 7.289352999999999838e+02, 2.019444903132517344e-01 7.290330999999999904e+02, 2.018123638830375821e-01 7.291446000000000822e+02, 2.015913049101657473e-01 7.292250000000000227e+02, 2.014580639407856644e-01 7.293249000000000706e+02, 2.013431495139831606e-01 7.294234000000000151e+02, 2.011954188980484282e-01 7.295181999999999789e+02, 2.012130131335429228e-01 7.296284000000000560e+02, 2.010557252707830533e-01 7.297200000000000273e+02, 2.009614463574860843e-01 7.298133000000000266e+02, 2.008833119521060417e-01 7.299089000000000169e+02, 2.008235236479113395e-01 7.300115000000000691e+02, 2.006584072687450093e-01 7.301186000000000149e+02, 2.005796159487872321e-01 7.302026000000000749e+02, 2.004330102444972506e-01 7.302960000000000491e+02, 2.002593001120817062e-01 7.303917000000000144e+02, 2.000649085056817045e-01 7.304950999999999794e+02, 1.999257550093139768e-01 7.306289000000000442e+02, 1.997155587160142631e-01 7.307019999999999982e+02, 1.994997456522077106e-01 7.308131000000000768e+02, 1.993075250572435564e-01 7.309179000000000315e+02, 1.990754925599797498e-01 7.310289000000000215e+02, 1.988874978913068581e-01 7.311547000000000480e+02, 1.987520975947580093e-01 7.312336999999999989e+02, 1.985432940722318407e-01 7.313390000000000555e+02, 1.983729703714710857e-01 7.314447999999999865e+02, 1.982354532432804017e-01 7.315525000000000091e+02, 1.981200673938104118e-01 7.316809000000000651e+02, 1.979926380476864922e-01 7.317812000000000126e+02, 1.978675138126442801e-01 7.318903999999999996e+02, 1.978621591085314158e-01 7.320018000000000029e+02, 1.977780385367290117e-01 7.321086999999999989e+02, 1.978275552799707571e-01 7.322246000000000095e+02, 1.978500717233074302e-01 7.323136000000000649e+02, 1.978725146690689107e-01 7.324195000000000846e+02, 1.978778338506740064e-01 7.325122000000000071e+02, 1.979462931099305878e-01 7.326162000000000489e+02, 1.980157080565702332e-01 7.327287999999999784e+02, 1.981847662825756695e-01 7.328232000000000426e+02, 1.982341068511260240e-01 7.329329000000000178e+02, 1.984248765150945781e-01 7.330452000000000226e+02, 1.985672433806865422e-01 7.331484000000000378e+02, 1.987499364355722054e-01 7.332889000000000124e+02, 1.988385762394265233e-01 7.333665000000000873e+02, 1.990397765812422781e-01 7.334712000000000671e+02, 1.992159114753012106e-01 7.335783999999999878e+02, 1.994371411719745857e-01 7.336818000000000666e+02, 1.996017413879886682e-01 7.338072000000000799e+02, 1.999394792119928432e-01 7.338902000000000498e+02, 2.000975784214813757e-01 7.339930000000000518e+02, 2.004098333506305341e-01 7.341067000000000462e+02, 2.005625165446042468e-01 7.342128000000000156e+02, 2.009424280212322167e-01 7.343363000000000511e+02, 2.012135386787873570e-01 7.344365000000000236e+02, 2.015299818185027625e-01 7.345394000000000005e+02, 2.017473835555418371e-01 7.346453999999999951e+02, 2.020571277381516817e-01 7.347436999999999898e+02, 2.022429329984356816e-01 7.348546000000000049e+02, 2.025576630758046393e-01 7.349497000000000071e+02, 2.028657434219363342e-01 7.350557000000000016e+02, 2.032383331240817659e-01 7.351589000000000169e+02, 2.034944514521323522e-01 7.352646000000000868e+02, 2.038636198543218037e-01 7.353781999999999925e+02, 2.041983220797056187e-01 7.354682000000000244e+02, 2.045210969117721433e-01 7.355736000000000558e+02, 2.048514910313654624e-01 7.356671000000000049e+02, 2.051221137792911264e-01 7.357692000000000689e+02, 2.054643270326267090e-01 7.358830000000000382e+02, 2.057677421624854730e-01 7.359618000000000393e+02, 2.060847805723282355e-01 7.360525000000000091e+02, 2.064047001809622417e-01 7.361618000000000848e+02, 2.066666813193575869e-01 7.362601000000000795e+02, 2.069508775938898038e-01 7.363988000000000511e+02, 2.071551676820901355e-01 7.364782000000000153e+02, 2.074842103183401898e-01 7.365844000000000733e+02, 2.077693135167175131e-01 7.366955000000000382e+02, 2.080007374356115657e-01 7.367960000000000491e+02, 2.082810264153593660e-01 7.369220000000000255e+02, 2.084124485294440166e-01 7.370035000000000309e+02, 2.087589640123686807e-01 7.371055000000000064e+02, 2.089827214865048743e-01 7.372135000000000673e+02, 2.092133506102841767e-01 7.373208000000000766e+02, 2.094161892530430891e-01 7.374388999999999896e+02, 2.096925164461065361e-01 7.375379000000000360e+02, 2.098757856535498068e-01 7.376485999999999876e+02, 2.102171439096428840e-01 7.377536999999999807e+02, 2.102689004584252230e-01 7.378573000000000093e+02, 2.105612614961860085e-01 7.379770000000000891e+02, 2.107024143714882614e-01 7.380633000000000266e+02, 2.109719612249278398e-01 7.381659000000000788e+02, 2.110975892696892453e-01 7.382703999999999951e+02, 2.113234637507332148e-01 7.383799999999999955e+02, 2.115072401615634701e-01 7.385084000000000515e+02, 2.117310380890078114e-01 7.385939000000000760e+02, 2.118556610869146983e-01 7.387038000000000011e+02, 2.122091178973574688e-01 7.388129999999999882e+02, 2.123087817768131713e-01 7.389259000000000697e+02, 2.126489318893573788e-01 7.390626000000000886e+02, 2.128168810900840646e-01 7.391433000000000675e+02, 2.130195745945449859e-01 7.392390000000000327e+02, 2.133371218744535835e-01 7.393451000000000022e+02, 2.135291406453078411e-01 7.394517000000000735e+02, 2.139074367520900632e-01 7.395921000000000731e+02, 2.141389949915651902e-01 7.396793000000000120e+02, 2.144053930659955975e-01 7.397974000000000387e+02, 2.146517154314570019e-01 7.399069000000000642e+02, 2.148885357270718943e-01 7.400237000000000762e+02, 2.151965610816262697e-01 7.401428000000000793e+02, 2.155282527385909419e-01 7.402375000000000682e+02, 2.158028108145862156e-01 7.403455000000000155e+02, 2.161117950598527848e-01 7.404453000000000884e+02, 2.163414974652508038e-01 7.405443999999999960e+02, 2.166367118315782048e-01 7.406605000000000700e+02, 2.169624085075941844e-01 7.407576999999999998e+02, 2.173288978567922691e-01 7.408659999999999854e+02, 2.176080386230717922e-01 7.409682000000000244e+02, 2.179080530431351526e-01 7.410733000000000175e+02, 2.183231574356737925e-01 7.411962000000000899e+02, 2.186689978570198478e-01 7.412767999999999802e+02, 2.190445047578561955e-01 7.413862000000000307e+02, 2.193751076479655282e-01 7.414832000000000107e+02, 2.196475252701289571e-01 7.415828000000000202e+02, 2.201663450952178469e-01 7.416996000000000322e+02, 2.205312582443578751e-01 7.417861000000000331e+02, 2.209579271085519991e-01 7.418840999999999894e+02, 2.213102066532807444e-01 7.419972999999999956e+02, 2.217246656754293666e-01 7.421031000000000404e+02, 2.220957936336666327e-01 7.422359000000000151e+02, 2.224020704574220797e-01 7.423170999999999822e+02, 2.227657646669338465e-01 7.424293999999999869e+02, 2.231733208488028974e-01 7.425321999999999889e+02, 2.235658165220724136e-01 7.426344000000000278e+02, 2.239436037106946886e-01 7.427536000000000058e+02, 2.243736606442845449e-01 7.428482000000000198e+02, 2.247720103365473676e-01 7.429580000000000837e+02, 2.251034770914123739e-01 7.430747000000000071e+02, 2.255048575601834582e-01 7.431841000000000577e+02, 2.259004081632653149e-01 7.433108000000000857e+02, 2.263428697096845077e-01 7.434112000000000080e+02, 2.267118948140761647e-01 7.435208999999999833e+02, 2.271306703719594144e-01 7.436299999999999955e+02, 2.272884493646791515e-01 7.437436000000000149e+02, 2.277065074543729584e-01 7.438668000000000120e+02, 2.280128804856291214e-01 7.439554000000000542e+02, 2.283163626001440127e-01 7.440640000000000782e+02, 2.286663576962995326e-01 7.441777000000000726e+02, 2.288095062109505862e-01 7.442904000000000906e+02, 2.291478679848755196e-01 7.444302999999999884e+02, 2.293676709088616483e-01 7.445202000000000453e+02, 2.296529707771732265e-01 7.446304000000000087e+02, 2.298004060569436291e-01 7.447431000000000267e+02, 2.300654845246067060e-01 7.448558000000000447e+02, 2.301934199401417525e-01 7.449855000000000018e+02, 2.304716382077400261e-01 7.450751000000000204e+02, 2.306130081583662450e-01 7.451865000000000236e+02, 2.308261207194704789e-01 7.452956000000000358e+02, 2.309793957956285670e-01 7.454067000000000007e+02, 2.311265742360548991e-01 7.455405000000000655e+02, 2.312038499527893365e-01 7.456394999999999982e+02, 2.313809407707981269e-01 7.457500000000000000e+02, 2.314120266097390577e-01 7.458635000000000446e+02, 2.314127445519738313e-01 7.459696000000000140e+02, 2.314861143138082500e-01 7.460863000000000511e+02, 2.315603469662217140e-01 7.461810000000000400e+02, 2.315861141866479844e-01 7.462818000000000893e+02, 2.315379462732270743e-01 7.463867999999999938e+02, 2.315331767979824373e-01 7.464953000000000429e+02, 2.315522181688530190e-01 7.466329000000000633e+02, 2.315494023367350995e-01 7.467064000000000306e+02, 2.316250358886017824e-01 7.468200000000000500e+02, 2.315306798796057941e-01 7.469273000000000593e+02, 2.315837987430134082e-01 7.470332000000000789e+02, 2.314619092826775137e-01 7.471642000000000507e+02, 2.315507916814240064e-01 7.472461000000000695e+02, 2.315663446453637142e-01 7.473401999999999816e+02, 2.316264111172680606e-01 7.474429999999999836e+02, 2.316016328516898870e-01 7.475448999999999842e+02, 2.315978533996164712e-01 7.476778000000000475e+02, 2.316056054142811294e-01 7.477608000000000175e+02, 2.317239340998933084e-01 7.478726000000000340e+02, 2.317801335040353405e-01 7.479758000000000493e+02, 2.317081913153418438e-01 7.480887000000000171e+02, 2.318189718854560544e-01 7.482098000000000866e+02, 2.317668344153376025e-01 7.483061000000000149e+02, 2.318448373224447356e-01 7.484039999999999964e+02, 2.319806164911937529e-01 7.485067000000000235e+02, 2.320119388200639898e-01 7.486039000000000669e+02, 2.321093843330183926e-01 7.487207000000000789e+02, 2.321729932603695257e-01 7.488213000000000648e+02, 2.323023173958953524e-01 7.489308000000000902e+02, 2.322866449511400699e-01 7.490403000000000020e+02, 2.323902362738326510e-01 7.491491000000000895e+02, 2.323701981622938173e-01 7.492751000000000658e+02, 2.325474340656715766e-01 7.493681000000000267e+02, 2.326712245465286100e-01 7.494779000000000906e+02, 2.329007678381650182e-01 7.495855999999999995e+02, 2.328873620228754937e-01 7.496915000000000191e+02, 2.331435525229258177e-01 7.498196000000000367e+02, 2.332189325976931626e-01 7.499068000000000893e+02, 2.334509919841421532e-01 7.500255000000000791e+02, 2.335594008522622334e-01 7.501345000000000027e+02, 2.337719927484251392e-01 7.502510000000000900e+02, 2.339259590951280610e-01 7.503946000000000822e+02, 2.341994336200033944e-01 7.504778000000000020e+02, 2.343440536210048830e-01 7.505828000000000202e+02, 2.345891900354881432e-01 7.506632000000000744e+02, 2.346209304749661273e-01 7.507415000000000873e+02, 2.348370236438895586e-01
In [19]:
Copied!
# Write data as CSV for VirtualBeamline App
spectra = exp.load_xas(37436, 37437, 37438, 37439, dls_loader=True, mode='tey')
for spectrum in spectra:
# spectrum.write_csv(f"{spectrum.label()}.csv", 'tey')
m = spectrum.metadata
tey = m.raw_signals['tey']
en = m.energy
mon = m.monitor
filename = f"VBA_{m.scan_no}_{m.pol}_{m.mag_field:.0f}T.csv"
np.savetxt(filename, np.array([en, tey, mon]).T, delimiter=',', header='energy, TEY, monitor')
print(f"Saved {filename}")
# Write data as CSV for VirtualBeamline App
spectra = exp.load_xas(37436, 37437, 37438, 37439, dls_loader=True, mode='tey')
for spectrum in spectra:
# spectrum.write_csv(f"{spectrum.label()}.csv", 'tey')
m = spectrum.metadata
tey = m.raw_signals['tey']
en = m.energy
mon = m.monitor
filename = f"VBA_{m.scan_no}_{m.pol}_{m.mag_field:.0f}T.csv"
np.savetxt(filename, np.array([en, tey, mon]).T, delimiter=',', header='energy, TEY, monitor')
print(f"Saved {filename}")
Saved VBA_37436_pc_1T.csv Saved VBA_37437_pc_-1T.csv Saved VBA_37438_nc_-1T.csv Saved VBA_37439_nc_1T.csv
In [22]:
Copied!
# Load CSV files and plot them
c1 = np.loadtxt('VBA_37436_pc_1T.csv', delimiter=',')
c2 = np.loadtxt('VBA_37439_nc_1T.csv', delimiter=',')
fig, ax = plt.subplots()
ax.plot(c1[:, 0], c1[:, 1] / c1[:, 2], label='pc')
ax.plot(c2[:, 0], c2[:, 1] / c2[:, 2], label='nc')
ax.legend()
ax.set_xlabel('Energy (eV)')
ax.set_ylabel('Signal / monitor')
# Load CSV files and plot them
c1 = np.loadtxt('VBA_37436_pc_1T.csv', delimiter=',')
c2 = np.loadtxt('VBA_37439_nc_1T.csv', delimiter=',')
fig, ax = plt.subplots()
ax.plot(c1[:, 0], c1[:, 1] / c1[:, 2], label='pc')
ax.plot(c2[:, 0], c2[:, 1] / c2[:, 2], label='nc')
ax.legend()
ax.set_xlabel('Energy (eV)')
ax.set_ylabel('Signal / monitor')
Out[22]:
Text(0, 0.5, 'Signal / monitor')
In [23]:
Copied!
# plot RAW xmcd (no processing)
fig, ax = plt.subplots()
ax.plot(c1[:, 0], (c1[:, 1] / c1[:, 2]) - (c2[:, 1] / c2[:, 2]), label='pc - nc')
ax.legend()
ax.set_xlabel('Energy (eV)')
ax.set_ylabel('Signal / monitor')
# plot RAW xmcd (no processing)
fig, ax = plt.subplots()
ax.plot(c1[:, 0], (c1[:, 1] / c1[:, 2]) - (c2[:, 1] / c2[:, 2]), label='pc - nc')
ax.legend()
ax.set_xlabel('Energy (eV)')
ax.set_ylabel('Signal / monitor')
Out[23]:
Text(0, 0.5, 'Signal / monitor')
In [ ]:
Copied!