Comments (9)
So according to the datasheet the NIR256 has the product ID 0x1010 and if I understand you correctly you created an inf file for the NIR256 so that it uses the pyusb compatible windows-driver.
So if you did this the correctly you should be able to run:
import usb.core
list(usb.core.find(idVendor=0x2457, idProduct=0x1010, find_all=True))
and it should find the Device.
If it finds it:
make a pull request with your changes to pyseabreeze and I'll have a look at your code changes.
If it doesn't:
search for tutorials online on how to use pyusb with a usb device on windows, and try to install the correct driver for your spectrometer.
Good luck
from python-seabreeze.
Hi !
The device is now well detected by the pc as the code lines you gave me print this on the spyder console :
[<DEVICE ID 2457:1010 on Bus 000 Address 001>]
But the seabreeze's list_devices() is still empty unfortunately...:/
I will make a pull request, I hope you will find the errors...
Thanks !
edit : I am new to github, so I did a pull request but somehow it is a pull request on a fork of this project but on my profile, I don't know if it is what you expected...
from python-seabreeze.
hmm...
can you report the output of:
import seabreeze.pyseabreeze.interfaces.defines as sbdef
print sbdef.ProductIds
from python-seabreeze.
This is what I get : [4160, 8192, 4098, 4164, 4166, 4134, 4136, 4106, 4140, 4130, 16384, 4112, 4114, 20480, 4116, 4118, 4120, 16388, 4138, 4126]
from python-seabreeze.
Hey @anffray,
sorry for the late reply. I can't really see an issue with your code (although I might miss something. It's hard to debug without the hardware)
one more thing you could try is:
import usb.core
from seabreeze.pyseabreeze.interfaces import NIR256
import numpy as np
dev, = list(usb.core.find(idVendor=0x2457, idProduct=0x1010, find_all=True))
s = NIR256()
s.open_device(dev)
N = s.get_formatted_spectrum_length()
arr = np.zeros((N,))
s.get_formatted_spectrum(arr)
print arr
from python-seabreeze.
Thank you !
So I tried this and with my NIR I got :
Traceback (most recent call last):
File "C:\ProgramData\Anaconda2\lib\site-packages\seabreeze\pyseabreeze\interfaces\common.py", line 14, in decorated_func
return func(*args, **kwargs)
File "C:\ProgramData\Anaconda2\lib\site-packages\seabreeze\pyseabreeze\interfaces\spectrometer.py", line 139, in get_formatted_spectrum
out[:] = ret * self._NORMALIZATION_VALUE
AttributeError: 'NIR256' object has no attribute '_NORMALIZATION_VALUE'
With another try I got this and I have the same SeabreezeError with a HR4000 :
Traceback (most recent call last):
File "<ipython-input-2-4c110a6164d0>", line 1, in <module>
runfile('C:/Users/AAA/Desktop/testscript.py', wdir='C:/Users/AAA/Desktop')
File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/AAA/Desktop/testscript.py", line 19, in <module>
s.get_formatted_spectrum(arr)
File "C:\ProgramData\Anaconda2\lib\site-packages\seabreeze\pyseabreeze\interfaces\common.py", line 23, in decorated_func
raise SeaBreezeError(msg)
SeaBreezeError: Error while reading raw spectrum
I don't really know where these errors come from...
from python-seabreeze.
Sorry, my mistake:
import usb.core
from seabreeze.pyseabreeze.interfaces import NIR256
import numpy as np
dev, = list(usb.core.find(idVendor=0x2457, idProduct=0x1010, find_all=True))
s = NIR256()
s.open_device(dev)
# < ADDED THE FOLLOWING LINES
s.usb_send(struct.pack('<B', 0x01))
time.sleep(0.1)
s._initialize_common()
# />
N = s.get_formatted_spectrum_length()
arr = np.zeros((N,))
s.get_formatted_spectrum(arr)
print arr
from python-seabreeze.
So it gave this to me :
[ 0. 912. 514. 722. 1294. 278. 1394. 3941. 1367. 1373.
694. 1298. 314. 2826. 2663. 1728. 1446. 541. 3092. 1747.
3734. 1239. 2302. 39. 3568. 387. 27. 3894. 1794. 267.
1758. 3912. 2184. 2085. 3932. 3620. 3648. 906. 2784. 3771.
1579. 3210. 2536. 3468. 1718. 3094. 1653. 586. 2147. 2120.
426. 1718. 393. 4054. 1166. 702. 671. 3955. 94. 592.
1566. 691. 1162. 2604. 3366. 727. 1231. 1730. 3918. 1658.
340. 350. 1998. 266. 3234. 472. 3748. 132. 2589. 884.
3334. 2798. 1059. 3424. 514. 491. 795. 2895. 1372. 2338.
1516. 496. 2174. 3714. 1250. 3989. 2547. 873. 2766. 1470.
3237. 1430. 3870. 246. 2984. 2959. 4052. 1994. 2315. 3866.
2278. 2172. 3796. 3195. 278. 1888. 3990. 3200. 1287. 660.
3877. 502. 1336. 133. 887. 3316. 1643. 3402. 754. 4067.
3177. 3970. 231. 2286. 629. 914. 3066. 834. 2642. 2806.
368. 3588. 3902. 1606. 1630. 2831. 1665. 2031. 3770. 3244.
916. 1180. 1284. 3114. 512. 2386. 2246. 2694. 1244. 2819.
2214. 2442. 4091. 3848. 1002. 495. 681. 2404. 36. 2116.
6. 2363. 2034. 3678. 3126. 1482. 3183. 2142. 3646. 422.
2084. 95. 442. 1662. 2154. 3870. 836. 3255. 910. 3866.
1972. 2176. 1429. 2562. 3596. 2902. 1998. 3360. 2494. 1130.
2258. 775. 2726. 1075. 922. 1270. 3619. 130. 3868. 62.
2447. 2830. 2719. 3909. 62. 1582. 1011. 1258. 2091. 2107.
360. 3579. 2564. 3761. 2290. 3426. 618. 788. 4070. 2082.
3978. 705. 1371. 1630. 3290. 1977. 2319. 2386. 218. 116.
3852. 3882. 3423. 2779. 622. 2714. 4095. 1799. 3891. 2074.
94. 748. 3266. 2743. 3694. 3247.]
from python-seabreeze.
Well looks like you're getting closer to a working implementation for your spectrometer model 👍
If this does not look like a spectrum, when you plot it, try using get_unformatted_spectrum_length
and get_unformatted_spectrum
record one spectrum with the light blocked, and one with the spectrometer saturated. Then you can try to reverse engineer the bitpattern for this spectrometer.
Look at the different implementations of get_formatted_spectrum
in pyseabreeze to get a feeling for how to reconstruct the spectra. Most of them are just a bit of byte shuffling to reconstruct the words per pixel and then maybe an XOR for some of the higher bits.
And look at the spectrometer class in seabreeze to see how to use the lower level interface directly.
Here's the example for how to query the wavelength array (which I would try next, in your case) https://github.com/ap--/python-seabreeze/blob/master/seabreeze/spectrometers.py#L112-L118
Keep up the good work 🏅
from python-seabreeze.
Related Issues (20)
- C seabreeze doesn't report firmware version HOT 1
- Problem with set_integration_time, the spectrometer doesn't wait for spectrum acquisition. HOT 3
- Seabreeze and SR4 Spectrometers HOT 20
- Extract cseabreeze into its own module HOT 1
- Rewrite Transport to use bMaxPacketSize
- ADC1000 error with external interrupt HOT 10
- USB2000 Issue reading intensities HOT 1
- Edge Trigger Issue Continues HOT 3
- QEPro lower intensities compared with OceanView - "hidden" settings? HOT 1
- Flame-S in version 2.4.0 pyseabreeze and trigger mode HOT 2
- Overflow, still alive and well HOT 1
- Getting CPython errors when building from source HOT 1
- Install on raspberry pi HOT 5
- Basic SR2 support HOT 2
- Drivers Dont have valid signatures HOT 8
- Support for SR6 / HR6 HOT 5
- USB2000 and some Flame S error at initialization due to fpga firmware version register check HOT 4
- Error in connecting to spectrometer after interrupting program HOT 1
- Ethernet Support for HDX HOT 6
- OceanHR4 connection issue HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-seabreeze.