Giter VIP home page Giter VIP logo

Comments (4)

ap-- avatar ap-- commented on July 23, 2024

Currently the TemperatureFeature is not wrapped in the cseabreeze backend.
And the only two Spectrometers that support it are the STS and the Spark.

But using the pyseabreeze backend it should be possible to jerry-rig it...
This is untested and (if it works) will only work with a STS or a Spark spectrometer:

import seabreeze
seabreeze.use('pyseabreeze')
import seabreeze.spectrometers as sb
import struct

# open first spectrometer
spec = sb.Spectrometer.from_serial_number()
# query number of temperature sensors
_N = spec._dev.interface.query(0x00400000, "")
N = struct.unpack("<B", _N)[0]
print "N =", N
# read temperatures
for i in range(N):
    try:
        temp = spec._dev.interface.query(0x00400001, struct.pack("<B", i))
    except Exception as e:
        print "Error reading sensor", i, "('%s')" % str(e)
    else:
        print "temp", i, "=", struct.unpack("<f", temp)

from python-seabreeze.

adriahf avatar adriahf commented on July 23, 2024

I have tested it with a STS and the output is:

N = 3
temp 0 = (29.172489166259766,)
temp 1 = (-34.25904846191406,)
temp 2 = (55.93994903564453,)

I think that temp 0 value corresponds to the temperature in Celsius.

from python-seabreeze.

ap-- avatar ap-- commented on July 23, 2024

From the STS datasheet page 30:

The microcontroller sensor will report values much higher than the detector board
thermistor because the microcontroller integrated circuit runs at a higher temperature.
The STS contains three memory locations for the temperature sensor as follows:
0 = Detector Board Thermistor
1 = Reserved/Internal Use
2 = Microcontroller Sensor Temperature

And:

Units are in °C.

from python-seabreeze.

ap-- avatar ap-- commented on July 23, 2024

with version 1.0.0 all supported SeaBreeze features are wrapped, which means, it should be possible to do this now 🎉

# if your spectometer supports the temperature feature
from seabreeze.spectrometers import Spectrometer
spec = Spectrometer.from_first_available()
spec.f.temperature.temperature_get_all()

see:
https://python-seabreeze.readthedocs.io/en/latest/backend_api.html#seabreeze.cseabreeze.SeaBreezeTemperatureFeature

from python-seabreeze.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.