diff --git a/orangecontrib/spectroscopy/datasets/NeaReaderMultichannelTXT/NFS_Interferograms_TEST.txt b/orangecontrib/spectroscopy/datasets/NeaReaderMultichannelTXT/NFS_Interferograms_TEST.txt new file mode 100644 index 000000000..d086dd318 --- /dev/null +++ b/orangecontrib/spectroscopy/datasets/NeaReaderMultichannelTXT/NFS_Interferograms_TEST.txt @@ -0,0 +1,41 @@ +# www.neaspec.com +# Scan:   Fourier Scan +# Project:   TestUser +# Description:   TestData +# Date:   02/07/2024 16:46:20 +# Scanner Center Position (X, Y): [µm] 49.99 49.78   +# Rotation: [°] 0     +# Scan Area (X, Y, Z): [µm] 0.000 0.000 0.000 +# Pixel Area (X, Y, Z): [px] 1 1 10 +# Interferometer Center/Distance: [µm] 700.000 489.670   +# Averaging:   1     +# Integration time: [ms] 20     +# Wavenumber Scaling:   0.979340     +# Laser Source:   Synchrotron +# Detector:   R +# Target Wavelength: [µm]     +# Demodulation Mode:   Fourier +# Tip Frequency: [Hz] 316,118.625     +# Tip Amplitude: [mV] 103.000     +# Tapping Amplitude: [nm] 94.597     +# Modulation Frequency: [Hz] 0.000     +# Modulation Amplitude: [mV] 0.000     +# Modulation Offset: [mV] 0.000     +# Setpoint: [%] 79.87     +# Regulator (P, I, D):   2.836886 4.959321 1.000000 +# Tip Potential: [mV] 0.000     +# M1A Scaling: [nm/V] 0.362     +# M1A Cantilever Factor:   1,000     +# Q-Factor:   519.0     +# Version:   2.1.11145.0 +Row Column Run Depth Z M O0A O0P O1A O1P O2A O2P O3A O3P O4A O4P O5A O5P +0 0 0 0 8.193912E-07 0.00045522494 140.16705 0 1.1184127 0.8966701 0.77391213 1.7504326 0.34323475 2.7573385 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 1 8.1936906E-07 0.0004555936 140.43907 0 1.1000535 0.9228538 0.7743518 1.8250732 0.30965033 2.759982 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 2 8.194301E-07 0.00045585245 140.47395 0 1.0244486 0.9274044 0.76109225 1.7798556 0.33938086 2.8322315 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 3 8.194135E-07 0.00045609957 140.4921 0 1.0089604 0.8929525 0.7926713 1.7868199 0.2920987 2.7409368 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 4 8.1938305E-07 0.0004563434 140.53168 0 0.95951015 0.9136275 0.70618 1.810575 0.3380124 2.8208117 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 5 8.193491E-07 0.00045658214 140.41396 0 0.8746408 0.9455583 0.7150825 1.7821139 0.31469348 2.8081262 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 6 8.193168E-07 0.00045682746 140.24849 0 0.84308344 0.8996506 0.7347842 1.7863272 0.36219594 2.7252293 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 7 8.194471E-07 0.00045706533 140.41663 0 0.85696256 0.9378485 0.70264626 1.7614058 0.30351338 2.7491233 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 8 8.1940897E-07 0.00045731207 140.39293 0 0.8842956 0.92963934 0.8015541 1.7758378 0.30675378 2.7052984 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 +0 0 0 9 8.193525E-07 0.0004575631 140.48709 0 0.901413 0.8900109 0.7502556 1.8009464 0.3114518 2.7401989 5.1248026E-08 2.2158213 8.329598E-08 2.2957401 diff --git a/orangecontrib/spectroscopy/tests/test_readers.py b/orangecontrib/spectroscopy/tests/test_readers.py index d14fe3da1..0c3878455 100644 --- a/orangecontrib/spectroscopy/tests/test_readers.py +++ b/orangecontrib/spectroscopy/tests/test_readers.py @@ -10,7 +10,7 @@ from Orange.tests import named_file from Orange.widgets.data.owfile import OWFile from orangecontrib.spectroscopy.data import getx, build_spec_table -from orangecontrib.spectroscopy.io.neaspec import NeaReader, NeaReaderGSF +from orangecontrib.spectroscopy.io.neaspec import NeaReader, NeaReaderGSF, NeaReaderMultiChannelTXT from orangecontrib.spectroscopy.io.soleil import SelectColumnReader, HDF5Reader_HERMES from orangecontrib.spectroscopy.preprocess import features_with_interpolation from orangecontrib.spectroscopy.io import SPAReader @@ -415,6 +415,18 @@ def test_read(self): self.assertEqual(n_ifg, len(data.domain.attributes)) check_attributes(data) +class TestNeaMultichannelTXT(unittest.TestCase): + def test_read(self): + fn = 'NeaReaderMultichannelTXT/NFS_Interferograms_TEST.txt' + absolute_filename = FileFormat.locate(fn, dataset_dirs) + data = NeaReaderMultiChannelTXT(absolute_filename).read() + self.assertEqual(len(data.X), 5) + self.assertEqual(data.X[0, 0], 1.00284722755027) + px = data.attributes['Pixel Area (X, Y, Z)'] + self.assertEqual(px[1], '1') + self.assertEqual(px[2], '1') + self.assertEqual(px[3], '10') + check_attributes(data) class TestEnvi(unittest.TestCase):