Skip to content

Commit a5569b1

Browse files
authored
Merge pull request Quasars#37 from ngergihun/fixes
[FIX][ENH] - NeaSpectrum
2 parents 310f977 + 0bb72cf commit a5569b1

File tree

6 files changed

+127
-5
lines changed

6 files changed

+127
-5
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# www.neaspec.com
2+
# Scan:   Fourier Scan
3+
# Project:   nanoFTIR-QualityControl
4+
# Description:   NeaSpec-Slow-Arrowhead-Clean-REV2-45avg
5+
# Date:   05/19/2024 16:59:10
6+
# Scanner Center Position (X, Y): [µm] 46.77 49.79  
7+
# Rotation: [°] 0    
8+
# Scan Area (X, Y, Z): [µm] 1.000 0.000 0.000
9+
# Pixel Area (X, Y, Z): [px] 2 1 2
10+
# Interferometer Center/Distance: [µm] 470.000 490.000  
11+
# Averaging:   45    
12+
# Integration time: [ms] 20    
13+
# Wavenumber Scaling:   1.003656    
14+
# Laser Source:  
15+
# Detector:   R
16+
# Target Wavelength: [µm]    
17+
# Demodulation Mode:   Fourier
18+
# Tip Frequency: [Hz] 68,263.500    
19+
# Tip Amplitude: [mV] 339.702    
20+
# Tapping Amplitude: [nm] 76.233    
21+
# Modulation Frequency: [Hz] 0.000    
22+
# Modulation Amplitude: [mV] 0.000    
23+
# Modulation Offset: [mV] 0.000    
24+
# Setpoint: [%] 80.49    
25+
# Regulator (P, I, D):   3.767854 6.228756 1.000000
26+
# Tip Potential: [mV] 0.000    
27+
# M1A Scaling: [nm/V] 1.520    
28+
# M1A Cantilever Factor:   2.066    
29+
# Q-Factor:   221.1    
30+
# Version:   2.1.11508.0
31+
Row Column Omega Wavenumber O0A O0P O1A O1P O2A O2P O3A O3P O4A O4P O5A O5P
32+
0 0 0 0 37.119324 3.1415927 1.738142 -3.1415913 0.1600194 8.742275E-08 0.12289047 -2.6534444E-10 0.03433025 -3.1415925 0.044003725 -3.1415925
33+
0 0 1 2.560346956632653 35.434025 2.681263 4.94985 0.9037826 0.43971792 -2.300659 0.16032808 -0.58963114 0.053768463 1.7078916 0.08377697 1.4515767
34+
0 0 2 5.120693913265306 32.58373 2.3122003 8.926398 -0.2935503 0.8658856 2.7100954 0.26857227 -1.3153769 0.09340307 0.8722349 0.14734396 0.52470887
35+
0 0 3 7.681040869897961 33.03119 2.0073247 12.101863 -1.3972439 1.3369256 1.5798267 0.43721926 -2.1214292 0.15267329 0.18834925 0.21037804 -0.2551048
36+
0 1 0 0 37.119324 3.1415927 1.738142 -3.1415913 0.1600194 8.742275E-08 0.12289047 -2.6534444E-10 0.03433025 -3.1415925 0.044003725 -3.1415925
37+
0 1 1 2.560346956632653 35.434025 2.681263 4.94985 0.9037826 0.43971792 -2.300659 0.16032808 -0.58963114 0.053768463 1.7078916 0.08377697 1.4515767
38+
0 1 2 5.120693913265306 32.58373 2.3122003 8.926398 -0.2935503 0.8658856 2.7100954 0.26857227 -1.3153769 0.09340307 0.8722349 0.14734396 0.52470887
39+
0 1 3 7.681040869897961 33.03119 2.0073247 12.101863 -1.3972439 1.3369256 1.5798267 0.43721926 -2.1214292 0.15267329 0.18834925 0.21037804 -0.2551048
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# www.neaspec.com
2+
# Scan:   AFM-Raman/PL Scan (Tapping Mode)
3+
# Project:   KJK - Wiegner RCP - SM007
4+
# Description:   Area2
5+
# Date:   05/14/2025 17:07:02
6+
# Scanner Center Position (X, Y): [µm] 52.83 53.80  
7+
# Rotation: [°] 0    
8+
# Scan Area (X, Y, Z): [µm] 5.000 5.000 0.000
9+
# Pixel Area (X, Y, Z): [px] 2 1 1
10+
# Averaging:   1    
11+
# Integration time: [ms] 10    
12+
# Laser Source:   532 nm visible laser
13+
# Detector:   VIS
14+
# Target Wavelength: [µm]    
15+
# Demodulation Mode:   Fourier
16+
# Tip Frequency: [Hz] 56,332.262    
17+
# Tip Amplitude: [mV] 10.000    
18+
# Tapping Amplitude: [nm] 44.401    
19+
# Modulation Frequency: [Hz] 0.000    
20+
# Modulation Amplitude: [mV] 0.000    
21+
# Modulation Offset: [mV] 0.000    
22+
# Setpoint: [%] 80.28    
23+
# Regulator (P, I, D):   6.394934 13.411389 1.000000
24+
# Tip Potential: [mV] 0.000    
25+
# M1A Scaling: [nm/V] 1.800    
26+
# M1A Cantilever Factor:   2.449    
27+
# Q-Factor:   157.5    
28+
# Version:   2.3.13115.0
29+
# CCD Pixels: [px] 1340    
30+
# Spectral Range: [nm] 533.186 792.054  
31+
# Exposure Time: [s] 0.100    
32+
# Input slit:   Direct Input    
33+
# Output slit:   Direct    
34+
# Shutter:   Open    
35+
# Grating Offset:   0    
36+
# Focus Mirror: [nm] 0    
37+
# Camera:   CCD    
38+
# Temperature: [°C] -75.0    
39+
# Grating: [l/mm] 300.000 750nm  
40+
Row Column Wavelength Index Data Z
41+
0 0 533186.4014 0 11.0000 0.0000
42+
0 0 533383.8501 1 -5.0000 0.0000
43+
0 0 533581.2988 2 -2.0000 0.0000
44+
0 0 533778.7476 3 7.0000 0.0000
45+
0 1 533186.4014 0 5.0000 0.0000
46+
0 1 533383.8501 1 -4.0000 0.0000
47+
0 1 533581.2988 2 3.0000 0.0000
48+
0 1 533778.7476 3 -1.0000 0.0000

pySNOM/defaults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def __init__(self) -> None:
1717
self.spectral_mode_defs = {
1818
"Fourier Scan": "nanoFTIR",
1919
"Pointspectroscopy PTE+": "PTE",
20+
"AFM-Raman/PL Scan (Tapping Mode)": "nanoRaman",
2021
}
2122

2223

pySNOM/spectra.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from pySNOM.images import type_from_channelname
44
from pySNOM.defaults import Defaults
55

6-
MeasurementModes = Enum("MeasurementModes", ["None", "nanoFTIR", "PsHet", "PTE"])
6+
MeasurementModes = Enum(
7+
"MeasurementModes", ["None", "nanoFTIR", "PsHet", "PTE", "nanoRaman"]
8+
)
79
DataTypes = Enum("DataTypes", ["Amplitude", "Phase", "Complex", "Topography"])
810
ChannelTypes = Enum("ChannelTypes", ["None", "Optical", "Mechanical"])
911
ScanTypes = Enum("ScanTypes", ["Point", "LineScan", "HyperScan"])
@@ -219,19 +221,29 @@ def reshape_spectrum_data(data, params):
219221
if params["Scan"] == "Fourier Scan":
220222
n = 2
221223

222-
for channel in list(data.keys()):
224+
allchannels = list(data.keys())
225+
if "Depth" in allchannels:
226+
spectral_depth = len(np.unique(data["Depth"]))
227+
elif "Index" in allchannels:
228+
spectral_depth = len(np.unique(data["Index"]))
229+
elif "Omega" in allchannels:
230+
spectral_depth = len(np.unique(data["Omega"]))
231+
else:
232+
spectral_depth = params["PixelArea"][2] * n
233+
234+
for channel in allchannels:
223235
# Point spectrum
224236
if params["PixelArea"][1] == 1 and params["PixelArea"][0] == 1:
225-
data[channel] = np.reshape(data[channel], (params["PixelArea"][2] * n))
237+
data[channel] = np.reshape(data[channel], (spectral_depth))
226238

227239
# Linescan and HyperScan
228240
else:
229-
data[data[channel]] = np.reshape(
241+
data[channel] = np.reshape(
230242
data[channel],
231243
(
232244
params["PixelArea"][0],
233245
params["PixelArea"][1],
234-
params["PixelArea"][2] * n,
246+
spectral_depth,
235247
),
236248
)
237249

pySNOM/tests/test_readers.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ def test_general_reader_spectrum(self):
5454
np.testing.assert_almost_equal(data["O2A"][0], 0.1600194)
5555
np.testing.assert_string_equal(params["Scan"], "Fourier Scan")
5656

57+
def test_general_reader_nanoraman(self):
58+
f = "datasets/testspectrum_nanoraman.txt"
59+
file_reader = readers.NeaSpectralReader(os.path.join(pySNOM.__path__[0], f))
60+
data, params = file_reader.read()
61+
62+
np.testing.assert_almost_equal(data["Data"][0], 11.0)
63+
np.testing.assert_string_equal(
64+
params["Scan"], "AFM-Raman/PL Scan (Tapping Mode)"
65+
)
66+
5767
def test_legacy_nea_reader(self):
5868
f = "datasets/neafile_test_ifg.nea"
5969
file_reader = readers.NeaFileLegacyReader(os.path.join(pySNOM.__path__[0], f))

pySNOM/tests/test_spectra.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ def test_pointspectrum_object(self):
2020
np.testing.assert_string_equal(s.scantype, "Point")
2121
np.testing.assert_equal(np.shape(s.data["O2A"])[0], 2048)
2222

23+
def test_multipointspectrum_object(self):
24+
f = "datasets/testspectrum_multipoint.txt"
25+
file_reader = readers.NeaSpectralReader(os.path.join(pySNOM.__path__[0], f))
26+
data, params = file_reader.read()
27+
28+
s = spectra.NeaSpectrum(data, params)
29+
30+
np.testing.assert_almost_equal(s.data["O2A"][1, 0, 0], 0.1600194)
31+
np.testing.assert_string_equal(s.parameters["Scan"], "Fourier Scan")
32+
np.testing.assert_string_equal(s.scantype, "LineScan")
33+
np.testing.assert_equal(np.shape(s.data["O2A"])[2], 4)
34+
2335
def test_transfromations(self):
2436
f = "datasets/testspectrum_singlepoint.txt"
2537
file_reader = readers.NeaSpectralReader(os.path.join(pySNOM.__path__[0], f))

0 commit comments

Comments
 (0)