Skip to content

Commit

Permalink
Add test for glued spectrum
Browse files Browse the repository at this point in the history
  • Loading branch information
pietsjoh committed Sep 1, 2022
1 parent 80e9fa6 commit ac69371
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 45 deletions.
263 changes: 263 additions & 0 deletions rsciio/tests/jobin_yvon_data/jobinyvon_test_spec_range.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
<?xml version="1.0" encoding="UTF-8"?>
<LSX_Data>
<LSX_Tree Format="9" ID="0x69746164" Size="9">
<LSX Format="7" ID="0x6D707974">Spectrum</LSX>
<LSX Format="8" ID="0x6C7469D9">jobinyvon_test_spec_range</LSX>
<LSX Format="4" ID="0x6DD6C7D0">65601</LSX>
<LSX Format="9" ID="0x7A74D9D6" Size="1">
<LSX Format="9" ID="0x7B697861" Size="2">
<LSX Format="9" ID="0x0" Size="4">
<LSX Format="7" ID="0x6D707974">Intens</LSX>
<LSX Format="7" ID="0x7C696E75">Cnt/sec</LSX>
<LSX Format="9" ID="0x6D6174E3" Size="2">
<LSX Format="9" ID="0x6E61656D" Size="2">
<LSX Format="5" ID="0x0">181.123260498047</LSX>
<LSX Format="5" ID="0x1">312.61328125</LSX>
</LSX>
<LSX Format="9" ID="0x696DDCE0" Size="4">
<LSX Format="5" ID="0x0">181.123260498047</LSX>
<LSX Format="5" ID="0x1">312.61328125</LSX>
<LSX Format="5" ID="0x2">181.123260498047</LSX>
<LSX Format="5" ID="0x3">312.61328125</LSX>
</LSX>
</LSX>
</LSX>
<LSX Format="9" ID="0x1" Size="5">
<LSX Format="6" ID="0x7D6CD4DB" Size="105">
720.924 722.474 724.023 725.571 727.119 728.667 730.214 731.76 733.307 734.852 736.398 737.942 739.487 741.03 742.574
744.117 745.659 747.2 748.742 750.283 751.823 753.363 754.902 756.44 757.978 759.516 761.053 762.59 764.126 765.661
767.196 768.73 770.264 771.797 773.065 774.605 776.145 777.685 779.224 780.762 782.3 783.838 785.375 786.912 788.448
789.983 791.518 793.053 794.587 796.12 797.653 799.185 800.717 802.248 803.779 805.309 806.839 808.368 809.896 811.424
812.952 814.478 816.005 817.53 819.055 820.211 821.743 823.276 824.807 826.338 827.869 829.399 830.929 832.458 833.986
835.515 837.042 838.569 840.095 841.621 843.147 844.671 846.195 847.719 849.242 850.765 852.286 853.808 855.329 856.849
858.368 859.887 861.405 862.923 864.44 865.956 867.137 868.662 870.186 871.709 873.232 874.754 876.276 877.798 879.318
</LSX>
<LSX Format="7" ID="0x6D707974">Spectr</LSX>
<LSX Format="7" ID="0x7C696E75">nm</LSX>
<LSX Format="9" ID="0x6D6174E3" Size="1">
<LSX Format="9" ID="0x696DDCE0" Size="2">
<LSX Format="5" ID="0x0">720.924255371094</LSX>
<LSX Format="5" ID="0x1">879.318420410156</LSX>
</LSX>
</LSX>
</LSX>
</LSX>
</LSX>
<LSX Format="9" ID="0x6C62D4D9" Size="3">
<LSX Format="9" ID="0x8716361" Size="32">
<LSX Format="9" ID="0x6F707865" Size="3">
<LSX Format="5" ID="0x7D6C61DB">1</LSX>
<LSX Format="7" ID="0x6D6D616E">Acq. time (s)</LSX>
<LSX Format="7" ID="0x7C696E75">s</LSX>
</LSX>
<LSX Format="9" ID="0x7D6363CE" Size="2">
<LSX Format="4" ID="0x7D6C61DB">2</LSX>
<LSX Format="7" ID="0x6D6D616E">Accumulations</LSX>
</LSX>
<LSX Format="9" ID="0x6F6E61D7" Size="2">
<LSX Format="7" ID="0x7D6C61DB">720...880</LSX>
<LSX Format="7" ID="0x6D6D616E">Range (nm)</LSX>
</LSX>
<LSX Format="9" ID="0x6CE1E0E6" Size="2">
<LSX Format="4" ID="0x7D6C61DB">4</LSX>
<LSX Format="7" ID="0x6D6D616E">Windows</LSX>
</LSX>
<LSX Format="9" ID="0x3F415756" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Off</LSX>
<LSX Format="7" ID="0x6D6D616E">Auto scanning</LSX>
</LSX>
<LSX Format="9" ID="0xECD7E53A" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Off</LSX>
<LSX Format="7" ID="0x6D6D616E">Autofocus</LSX>
</LSX>
<LSX Format="9" ID="0x4C576339" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Off</LSX>
<LSX Format="7" ID="0x6D6D616E">AutoExposure</LSX>
</LSX>
<LSX Format="9" ID="0x4F350544" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Multiple accum.</LSX>
<LSX Format="7" ID="0x6D6D616E">Spike filter</LSX>
</LSX>
<LSX Format="9" ID="0x696C65DD" Size="3">
<LSX Format="5" ID="0x7D6C61DB">0</LSX>
<LSX Format="7" ID="0x6D6D616E">Delay time (s)</LSX>
<LSX Format="7" ID="0x7C696E75">s</LSX>
</LSX>
<LSX Format="9" ID="0x6ED5D7CB" Size="2">
<LSX Format="4" ID="0x7D6C61DB">30</LSX>
<LSX Format="7" ID="0x6D6D616E">Binning</LSX>
</LSX>
<LSX Format="9" ID="0xEA3A4A4E" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Signal</LSX>
<LSX Format="7" ID="0x6D6D616E">Readout mode</LSX>
</LSX>
<LSX Format="9" ID="0x6FD3D8CD" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Off</LSX>
<LSX Format="7" ID="0x6D6D616E">DeNoise</LSX>
</LSX>
<LSX Format="9" ID="0xFC5AA4A0" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Off</LSX>
<LSX Format="7" ID="0x6D6D616E">ICS correction</LSX>
</LSX>
<LSX Format="9" ID="0x5AB3995F" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Off</LSX>
<LSX Format="7" ID="0x6D6D616E">Dark correction</LSX>
</LSX>
<LSX Format="9" ID="0x5A48F279" Size="2">
<LSX Format="7" ID="0x7D6C61DB">Off</LSX>
<LSX Format="7" ID="0x6D6D616E">Inst. Process</LSX>
</LSX>
<LSX Format="9" ID="0x6EDE5114" Size="2">
<LSX Format="5" ID="0x7D6C61DB">-129.09</LSX>
<LSX Format="7" ID="0x6D6D616E">Detector temperature (°C)</LSX>
</LSX>
<LSX Format="9" ID="0xD9E15849" Size="6">
<LSX Format="7" ID="0x6D6D616E">Instrument</LSX>
<LSX Format="7" ID="0x7D6C61DB">LabRAM HR Evol</LSX>
<LSX Format="5" ID="0x8736F70">-825338570</LSX>
<LSX Format="4" ID="0x6A6DE7D3">5</LSX>
<LSX Format="7" ID="0xDCDCE5D6">LabRAM HR Evol</LSX>
</LSX>
<LSX Format="9" ID="0xDFE3D9C7" Size="6">
<LSX Format="7" ID="0x6D6D616E">Detector</LSX>
<LSX Format="7" ID="0x7D6C61DB">Symphony VIS</LSX>
<LSX Format="5" ID="0x8736F70">2037017759</LSX>
<LSX Format="4" ID="0x6A6DE7D3">2</LSX>
<LSX Format="7" ID="0xDCDCE5D6">Symphony VIS</LSX>
</LSX>
<LSX Format="9" ID="0xDBD3D737" Size="5">
<LSX Format="7" ID="0x6D6D616E">Objective</LSX>
<LSX Format="7" ID="0x7D6C61DB">x50</LSX>
<LSX Format="5" ID="0x8736F70">50</LSX>
<LSX Format="4" ID="0x6A6DE7D3">1</LSX>
</LSX>
<LSX Format="9" ID="0x7CC8E0D0" Size="5">
<LSX Format="7" ID="0x6D6D616E">Grating</LSX>
<LSX Format="7" ID="0x7D6C61DB">600 gr/mm</LSX>
<LSX Format="5" ID="0x8736F70">600</LSX>
<LSX Format="4" ID="0x6A6DE7D3">3</LSX>
</LSX>
<LSX Format="9" ID="0x7C6CDBCB" Size="5">
<LSX Format="7" ID="0x6D6D616E">ND Filter</LSX>
<LSX Format="7" ID="0x7D6C61DB">1%</LSX>
<LSX Format="5" ID="0x8736F70">1</LSX>
<LSX Format="4" ID="0x6A6DE7D3">6</LSX>
</LSX>
<LSX Format="9" ID="0x6D7361DE" Size="5">
<LSX Format="7" ID="0x6D6D616E">Laser (nm)</LSX>
<LSX Format="7" ID="0x7D6C61DB">633 </LSX>
<LSX Format="5" ID="0x8736F70">632.817</LSX>
<LSX Format="4" ID="0x6A6DE7D3">0</LSX>
</LSX>
<LSX Format="9" ID="0x6D6C6F68" Size="4">
<LSX Format="7" ID="0x6D6D616E">Hole</LSX>
<LSX Format="5" ID="0x7D6C61DB">100.02125</LSX>
<LSX Format="5" ID="0x8736F70">100.02125</LSX>
</LSX>
<LSX Format="9" ID="0x7D7369EC" Size="5">
<LSX Format="7" ID="0x6D6D616E">Range</LSX>
<LSX Format="7" ID="0x7D6C61DB">Visible</LSX>
<LSX Format="5" ID="0x8736F70">1</LSX>
<LSX Format="4" ID="0x6A6DE7D3">1</LSX>
</LSX>
<LSX Format="9" ID="0x7B9DDBD5" Size="5">
<LSX Format="7" ID="0x6D6D616E">Laser. Pol.</LSX>
<LSX Format="7" ID="0x7D6C61DB">No</LSX>
<LSX Format="5" ID="0x8736F70">6</LSX>
<LSX Format="4" ID="0x6A6DE7D3">6</LSX>
</LSX>
<LSX Format="9" ID="0x7B9EDBD5" Size="5">
<LSX Format="7" ID="0x6D6D616E">Raman. Pol.</LSX>
<LSX Format="7" ID="0x7D6C61DB">No</LSX>
<LSX Format="5" ID="0x8736F70">3</LSX>
<LSX Format="4" ID="0x6A6DE7D3">3</LSX>
</LSX>
<LSX Format="9" ID="0x396C6F70" Size="4">
<LSX Format="7" ID="0x6D6D616E">Laser Pol. (°)</LSX>
<LSX Format="5" ID="0x7D6C61DB">0</LSX>
<LSX Format="5" ID="0x8736F70">0</LSX>
<LSX Format="7" ID="0x7C696E75">°</LSX>
</LSX>
<LSX Format="9" ID="0x3A6C6F70" Size="4">
<LSX Format="7" ID="0x6D6D616E">Raman Pol. (°)</LSX>
<LSX Format="5" ID="0x7D6C61DB">0</LSX>
<LSX Format="5" ID="0x8736F70">0</LSX>
<LSX Format="7" ID="0x7C696E75">°</LSX>
</LSX>
<LSX Format="9" ID="0x6FDAECD8" Size="6">
<LSX Format="7" ID="0x6D6D616E">StageXY</LSX>
<LSX Format="7" ID="0x7D6C61DB">Märzhauser B</LSX>
<LSX Format="5" ID="0x8736F70">1775232737</LSX>
<LSX Format="4" ID="0x6A6DE7D3">3</LSX>
<LSX Format="7" ID="0xDCDCE5D6">Märzhauser B</LSX>
</LSX>
<LSX Format="9" ID="0x8000078" Size="4">
<LSX Format="7" ID="0x6D6D616E">X (µm)</LSX>
<LSX Format="5" ID="0x7D6C61DB">-1263.95</LSX>
<LSX Format="5" ID="0x8736F70">-1263.95</LSX>
<LSX Format="7" ID="0x7C696E75">µm</LSX>
</LSX>
<LSX Format="9" ID="0x8000079" Size="4">
<LSX Format="7" ID="0x6D6D616E">Y (µm)</LSX>
<LSX Format="5" ID="0x7D6C61DB">2849.4</LSX>
<LSX Format="5" ID="0x8736F70">2849.4</LSX>
<LSX Format="7" ID="0x7C696E75">µm</LSX>
</LSX>
<LSX Format="9" ID="0xD9D9DEDA" Size="2">
<LSX Format="5" ID="0x7D6C61DB">20</LSX>
<LSX Format="7" ID="0x6D6D616E">Full time(s)</LSX>
</LSX>
</LSX>
<LSX Format="9" ID="0x7C73E2D2" Size="6">
<LSX Format="9" ID="0x6AE3D5D5" Size="2">
<LSX Format="7" ID="0x6D6D616E">Project</LSX>
<LSX Format="8" ID="0x7D6C61DB">A</LSX>
</LSX>
<LSX Format="9" ID="0x786DC6DF" Size="2">
<LSX Format="7" ID="0x6D6D616E">Sample</LSX>
<LSX Format="8" ID="0x7D6C61DB">test</LSX>
</LSX>
<LSX Format="9" ID="0x6D746973" Size="2">
<LSX Format="7" ID="0x6D6D616E">Site</LSX>
<LSX Format="8" ID="0x7D6C61DB">C</LSX>
</LSX>
<LSX Format="9" ID="0x6C7469D9" Size="2">
<LSX Format="7" ID="0x6D6D616E">Title</LSX>
<LSX Format="8" ID="0x7D6C61DB">test_3s</LSX>
</LSX>
<LSX Format="9" ID="0x696DD0E4" Size="2">
<LSX Format="7" ID="0x6D6D616E">Remark</LSX>
<LSX Format="8" ID="0x7D6C61DB">PL</LSX>
</LSX>
<LSX Format="9" ID="0x6D746164" Size="2">
<LSX Format="7" ID="0x6D6D616E">Date</LSX>
<LSX Format="7" ID="0x7D6C61DB">19.08.2022 09:24</LSX>
</LSX>
</LSX>
<LSX Format="9" ID="0x7CECDBD7" Size="1">
<LSX Format="9" ID="0x0" Size="3">
<LSX Format="7" ID="0x6D6D616E">Acquired</LSX>
<LSX Format="7" ID="0x7D6C61DB">19.08.2022 09:24:10</LSX>
</LSX>
</LSX>
</LSX>
<LSX Format="4" ID="0xCADCE2DA">1</LSX>
<LSX Format="8" ID="0x6D6C6966">D:\Data\Jonas\jobinyvon_test_spec_range.l6s</LSX>
<LSX Format="9" ID="0x6D6174E3" Size="2">
<LSX Format="4" ID="0xD9DED343">1916375368</LSX>
<LSX Format="4" ID="0xCF4E3E44">0</LSX>
</LSX>
</LSX_Tree>
<LSX_Matrix Format="6" ID="0x7D6CD4DB" Size="105">
<LSX_Row Format="6" Index="0" Size="105">
238 231.63 234.26 237.89 234.521 234.151 236.781 231.411 212.041 209.671 212.301 220.932 199.562 194.192 199.822
220.452 208.082 211.712 197.342 190.973 203.603 198.233 199.863 195.493 181.123 203.753 182.384 193.014 196.644 195.274
227.904 246.639 265.497 269.555 232.11 241.674 245.237 239.801 242.365 230.929 230.493 229.056 234.62 221.184 234.748
218.312 210.875 212.439 210.003 190.567 207.131 186.695 197.258 196.822 186.386 200.95 190.514 186.077 190.641 213.205
198.769 224.333 257.375 298.006 312.613 281.488 276.214 280.94 285.666 281.392 254.119 285.845 258.571 275.297 291.023
282.75 288.476 290.202 291.928 292.654 272.381 288.107 282.833 293.559 288.286 282.651 279.017 260.383 257.749 251.114
245.48 254.846 268.212 267.4 305.312 302.855 300.383 287.118 281.853 298.589 277.324 273.059 250.794 277.53 254.265

</LSX_Row>
</LSX_Matrix>
</LSX_Data>
63 changes: 18 additions & 45 deletions rsciio/tests/test_jobin_yvon.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
testfile_spec_energy_path = (testfile_dir / "jobinyvon_test_spec_3s_eV.xml").resolve()
testfile_linescan_path = (testfile_dir / "jobinyvon_test_linescan.xml").resolve()
testfile_map_path = (testfile_dir / "jobinyvon_test_map_x3-y2.xml").resolve()
testfile_glue_path = (testfile_dir / "jobinyvon_test_spec_range.xml").resolve()


class TestSpec:
Expand Down Expand Up @@ -906,51 +907,23 @@ def test_axes(self):

assert map_axes == self.s.axes_manager.as_dictionary()

non_uniform_axis_values = np.array(
[
537.361,
536.918,
536.474,
536.031,
535.586,
535.142,
534.697,
534.252,
533.807,
533.361,
532.915,
532.468,
532.022,
531.575,
531.128,
530.68,
530.232,
529.784,
529.336,
528.887,
528.438,
527.988,
527.539,
527.089,
526.639,
526.188,
525.737,
525.286,
524.835,
524.383,
523.931,
523.479,
523.027,
522.574,
]
)

non_uniform_axis_manager = deepcopy(
self.s_non_uniform.axes_manager.as_dictionary()
class TestGlue:
@classmethod
def setup_class(cls):
cls.s = hs.load(
testfile_glue_path, reader="Jobin Yvon", use_uniform_wavelength_axis=True
)

np.testing.assert_allclose(
non_uniform_axis_values, non_uniform_axis_manager["axis-2"].pop("axis")
cls.s_non_uniform = hs.load(
testfile_glue_path, reader="Jobin Yvon", use_uniform_wavelength_axis=False
)
assert map_axes_non_uniform == non_uniform_axis_manager
assert map_axes == self.s.axes_manager.as_dictionary()

@classmethod
def teardown_class(cls):
del cls.s
del cls.s_non_uniform
gc.collect()

def test_data(self):
assert np.isclose(self.s.isig[0].data, 238)
assert np.isclose(self.s.isig[-1].data, 254.265)

0 comments on commit ac69371

Please sign in to comment.