-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sample, sampleDark and sampleGradient #3
Comments
Wow, thanks a lot for this. It is still highly relevant I've been trying to apply it, using Python's struct library (I'm using the little-endian encoding, i.e. "<I". But I ended up with a few questions, and I'm wondering if you can help me:
|
I am still trying to work with the code you provided, but I'm not managing to find the bytes you mention. Can you elaborate a bit on how you obtained these and decoded the data? Thanks |
Here is my scan.json { |
@hbsagen What is your question or comment? You just provided a scan file... |
@kebasaa I had no question really. But I am eagerly following this thread, as I want to extract data from the SCIO as well. I thought more data maybe could help somehow :) |
@hbsagen I see. Thanks, but please start a new issue next time you want to contribute something unrelated to this current issue. Your data shows me something interesting at least: It seems like your SCiO is reporting a different number of bytes in sample_gradient. Mine has 1656 bytes, yours seems to have less. I would appreciate some help though, if you have any experience with this kind of reverse-engineering. @earwickerh Still hoping that you could answer my questions above. 400 values in 1800 bytes somehow doesn't add up, so I'm wondering how that could work... I understood that you're using big-endian decoding. But the hex values you're quoting are nowhere to be found in the data itself, and the code you posted doesn't work. Can you please update it and add some explanations? Thanks |
Nice to see you're still tinkering with this. In the readme it says: "Every SCIO bluetooth LE message contains 3 parts: sample, sampleDark and sampleGradient (No clue so far what that those mean or how to convert them)." Not sure if that's up to date, but hope the below is helpful.
sample: This is the raw spectral data from the sample. It represents the light that is reflected off the sample and detected by the SCIO.
sampleDark: This is the raw spectral data from the SCIO's internal dark current reference. It represents the background signal that is detected when there is no light present.
sampleGradient: This is the raw spectral data from the SCIO's internal white reference. It represents the signal detected when the SCIO is measuring a known white reference
To calculate the reflectance values of the sample, you need to subtract the sampleDark data from the sample data and divide the result by the difference between the sampleGradient data and the sampleDark data. This is expressed by the equation R = (S - D) / (G - D), where R is the reflectance value, S is the sample data, D is the sampleDark data, and G is the sampleGradient data.
Let's take -bark.txt sample:
Each packet consists of a header and three data sections: sample, sampleDark, and sampleGradient. The header contains information about the packet, including a packet identifier (01 or 02), the protocol identifier (ba), and the length of the data sections (in this case, 02 90).The sample, sampleDark, and sampleGradient data sections are each 400 bytes long and contain spectral data measured by the SCIO spectrometer.
To calculate reflectance values from the sample, sampleDark, and sampleGradient data, you need to perform the following steps:
The example code below should extract the data from the log, converts these arrays to numpy arrays of integers and performs the reflectance calculation using numpy array operations.
The reflectance values will be in units of "counts per second"...
The text was updated successfully, but these errors were encountered: