Exemplo n.º 1
0
Arquivo: FlameS.py Projeto: NREL/QIS
    def animate(i):
        spec = Spectrometer.from_first_available()
        spec.integration_time_micros(integ)
        a = spec.wavelengths()
        b = spec.intensities()
        a = a[30:]  # delete the first pseudo peak
        b = b[30:]
        if b.max() > 65500:
            msg = "Flame is saturated, please reduce integration time"
            print(msg)

        step = abs(a[1] - a[0])
        if wavelength1 is not None:
            p = np.where(abs(a - wavelength1) < step)[0][0]  # define baseline
            a = a[p:]
            b = b[p:]

        if wavelength2 is not None:
            q = np.where(abs(a - wavelength2) < step)[0][0]
            a = a[:q]
            b = b[:q]

        # for i in range(len(b)):  #filter out peaks
        #     if b[i]>3000:
        #         b[i]=2400

        ax1.clear()
        ax1.plot(a, b)
        plt.title(title)
        plt.xlabel('Wavelength, nm')
        plt.ylabel('Signal Amplitude, AU')
        print(i)
Exemplo n.º 2
0
    def __init__(self, device_obj=None, **kwargs):

        # Yes, I am aware that having a self._device inside the
        # Device class can be somewhat confusing
        if device_obj is None:
            self._device = Spectrometer.from_first_available()
        else:
            self._device = Spectrometer(device_obj)
def open_spect(t_integracion,logger):
  try:
      spec = Spectrometer.from_first_available()
      #spec = Spectrometer.from_serial_number("S05507")
      spec.integration_time_micros(t_integracion)
      return spec
  except SeaBreezeError as e: # Spectrometer.CalledProcessError as err:
      #logger.error("Error conectando el espectrometro",e) 
      return 0
Exemplo n.º 4
0
def open_spect():
    try:
        spec = Spectrometer.from_first_available()
        print("conectando")

        return spec

    except:  #excepcion en caso de que el espectrometro no este conectada
        #logger.error("Error conectando el espectrometro")
        print("no se pudo conectar")
        return 0
Exemplo n.º 5
0
Arquivo: FlameS.py Projeto: NREL/QIS
def FlameS_save(wavelength1, wavelength2, integ, folder, filename, title):
    spec = Spectrometer.from_first_available()
    spec.integration_time_micros(integ)  #us
    a = spec.wavelengths()
    b = spec.intensities()
    a = a[30:]  # delete the first pseudo peak
    b = b[30:]
    msg = ''

    if b.max() > 65500:
        msg = "Flame is saturated, please reduce integration time."
        print(msg)

    step = abs(a[1] - a[0])

    if (wavelength1 is not None) and (wavelength2 is not None):
        msg = msg + "\nPart of the spectrum is plotted."
        print(msg)

    if wavelength1 is not None:
        p = np.where(abs(a - wavelength1) < step)[0][0]  # define baseline
        a = a[p:]
        b = b[p:]

    if wavelength2 is not None:
        q = np.where(abs(a - wavelength2) < step)[0][0]
        a = a[:q]
        b = b[:q]

    np.savetxt(folder + '/' + filename + "wl.csv", a,
               delimiter=",")  # save wavelength
    np.savetxt(folder + '/' + filename + ".csv", b,
               delimiter=",")  # save fluorescen intensity
    plt.plot(a, b)
    plt.title(title + ' ' + filename)
    plt.xlabel('Wavelength, nm')
    plt.ylabel('Signal Amplitude, AU')
    plt.show()
    return msg
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 10:27:12 2020

@author: jtm
"""

import pandas as pd
from seabreeze.spectrometers import Spectrometer

from oceanops import dark_measurement

#%% make a df to hold data
# connect to OceanOptics spectrometer
oo = Spectrometer.from_first_available()
data = pd.DataFrame()
it = 10
integration_times = []
while it < oo.integration_time_micros_limits[1]:
    integration_times.append(it)
    it *= 2

#%% set desired temperature before running this cell
t = oo.f.temperature.temperature_get_all()[0]
cycle = 0
while t < 45.00:
    data = data.append(dark_measurement(oo, integration_times))
    data['cycle'] = cycle
    cycle += 1
    t = oo.f.temperature.temperature_get_all()[0]