Spectrometer: Difference between revisions

From SweepMe! Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
}}
}}


* The peak wavelength of highest intensity is calculated.
* The peak wavelength related to the point of highest intensity is calculated.


* CIE coordinates are calculated based on the CIE standard from 1931 [https://en.wikipedia.org/wiki/CIE_1931_color_space] in case the measured spectrum covers the wavelength range from 360 nm to 830 nm.
* CIE coordinates are calculated based on the CIE standard from 1931 [https://en.wikipedia.org/wiki/CIE_1931_color_space] in case the measured spectrum covers the wavelength range from 360 nm to 830 nm.


* Boxcar smoothing can be used to reduce the noise of a spectrum which is done prior calculating total intensity, the peak wavelength, and the CIE coordinates.
* Boxcar smoothing can be used to reduce the noise of a spectrum which is done prior calculating total intensity, the peak wavelength, and the CIE coordinates. Use 0 Pixels to switch off. Please note that the raw spectrum is not saved if smoothing is used.


* Take reference spectrum reads a spectrum during [[initialize]], i.e. before all measurements start. The reference spectrum is subtracted from all spectra being measured. The integration time must be constant during the measurement.
* Take reference spectrum reads a spectrum during [[initialize]], i.e. before all measurements start. The reference spectrum is subtracted from all spectra being measured. The integration time must be constant during the measurement.


* Automatic integration time: Depending on the Device Class, the integration time is automatically found. However, this feature depends on either the spectrometer or the Device Class. Please check the description of the Device Class whether this feature is supported. A maximum integration must be given. Otherwise, very long integration times might be applied during finding the optimum conditions.




=== Device Classes specifics ===
 
=== Device Class specifics ===


* Device Class must return wavelengths and spectrum during [[call]] as first and second value
* Device Class must return wavelengths and spectrum during [[call]] as first and second value


* Device Class needs a function read_Wavelengths() which returns a list of wavelengths
* Device Class needs a function read_Wavelengths() which returns a list of wavelengths
* Function get_CalibrationFile_properties can be used to find appropriate calibration files.
{{syntaxhighlight|lang=python|code=
def get_CalibrationFile_properties(self, port):
    # returns two string
    # 1 file ending
    # 2 substring in file_name
    serialno = str(port[str(port).find(":")+1:-1]) # use the port string to identify the serial number if possible
       
    if serialno == "":
        serialno = "noserialnumber" # if no serial number is found, the string prevents finding any calibration file
           
    return [".IrradCal", serialno] # example as used for an OceanOptics spectrometer
}}
The module searches in the subfolder "Calibrations" of each Spectrometer-DeviceClass. The port string can be used to filter for appropriate calibration files.
* Most spectrometer cannot be connected by GPIB or COM port, but have to be interfaced via a dll library. In such a case, the Device Class has to provide all ports using the function
{{syntaxhighlight|lang=python|code=
def find_Ports(self):
   
    ports = ... # insert your code to generate a list of strings with all possible port names
   
    return ports
}}

Revision as of 21:50, 6 May 2018

Spectrometer is a Module to interface spectrometer devices. It allows for loading corresponding Device Classes.


Features

  • The module calculates the total intensity by summing over all values of the intensities using numpy function trapz:
total_intensity = np.trapz(y = self.spectrum, x = self.wavelengths)
  • The peak wavelength related to the point of highest intensity is calculated.
  • CIE coordinates are calculated based on the CIE standard from 1931 [1] in case the measured spectrum covers the wavelength range from 360 nm to 830 nm.
  • Boxcar smoothing can be used to reduce the noise of a spectrum which is done prior calculating total intensity, the peak wavelength, and the CIE coordinates. Use 0 Pixels to switch off. Please note that the raw spectrum is not saved if smoothing is used.
  • Take reference spectrum reads a spectrum during initialize, i.e. before all measurements start. The reference spectrum is subtracted from all spectra being measured. The integration time must be constant during the measurement.
  • Automatic integration time: Depending on the Device Class, the integration time is automatically found. However, this feature depends on either the spectrometer or the Device Class. Please check the description of the Device Class whether this feature is supported. A maximum integration must be given. Otherwise, very long integration times might be applied during finding the optimum conditions.


Device Class specifics

  • Device Class must return wavelengths and spectrum during call as first and second value
  • Device Class needs a function read_Wavelengths() which returns a list of wavelengths
  • Function get_CalibrationFile_properties can be used to find appropriate calibration files.
def get_CalibrationFile_properties(self, port):
    # returns two string
    # 1 file ending
    # 2 substring in file_name

    serialno = str(port[str(port).find(":")+1:-1]) # use the port string to identify the serial number if possible
        
    if serialno == "":
        serialno = "noserialnumber" # if no serial number is found, the string prevents finding any calibration file
            
    return [".IrradCal", serialno] # example as used for an OceanOptics spectrometer

The module searches in the subfolder "Calibrations" of each Spectrometer-DeviceClass. The port string can be used to filter for appropriate calibration files.

  • Most spectrometer cannot be connected by GPIB or COM port, but have to be interfaced via a dll library. In such a case, the Device Class has to provide all ports using the function
def find_Ports(self):
    
    ports = ... # insert your code to generate a list of strings with all possible port names
    
    return ports