ap-- / python-oceanoptics

*discontinued* Python module for oceanoptics spectrometers
MIT License
21 stars 11 forks source link

Update XXX2000.py #7

Closed rluening closed 9 years ago

rluening commented 9 years ago

Tested with an USB2000

ap-- commented 9 years ago

Thanks for contributing. Please fix the above things, then we can merge the PR.

ap-- commented 9 years ago

I just pushed a new usb2000 branch. Can you check it out? It should fix the:

If they work, we can look into the request_spectrum problem.

ap-- commented 9 years ago

Okay, there was a mistake in defines.py. Can you test the usb2000 branch now?

ap-- commented 9 years ago

Please add this line:

print "DEBUG:", self._integration_time, self._USBTIMEOUT, self._packet_N, self._packet_size

in front of the time.sleep in class _XXX2000 and report back.

rluening commented 9 years ago

DEBUG: 0.1 1.0 64 64 Thus time.sleep(max(self._integration_time - self._USBTIMEOUT, 0)) will be 0.

Is the time base still µs? (--Found: time is now in seconds )

The USB2000 has a valid range of 3 to 30000 ms for integration time: _init_robust_spectrum(self) will set it to 0.001 s

print "DEBUG:", self._EPspec => 135 => '0x87' WRONG Port

This is improtant. The spectrum is received through epi=0x82

Hard coded to use epi=0x82: XXX2000.py", line 24, in for j in range(self._packet_N) for i in range(self._packet_size)) IndexError: array index out of range

rluening commented 9 years ago

at line 22 print "DEBUG:", ret, len(ret) will give a flat array('B', [0,....]) of len 4096 in one dimension. I guess this is not what you expected ! ?

ap-- commented 9 years ago

DEBUG: 0.1 1.0 64 64 Thus time.sleep(max(self._integration_time - self._USBTIMEOUT, 0)) will be 0. Is the time base still µs? (--Found: time is now in seconds )

This is ok. Exactly what we'd expect.

The USB2000 has a valid range of 3 to 30000 ms for integration time: _init_robust_spectrum(self) will set it to 0.001 s

This could be problematic. I'll change it to 5 microseconds. Fixed in cf26bb6

print "DEBUG:", self._EPspec => 135 => '0x87' WRONG Port This is improtant. The spectrum is received through epi=0x82

Yes, that was my mistake again. Fixed in 715763a

XXX2000.py", line 24, in for j in range(self._packet_N) for i in range(self._packet_size)) IndexError: array index out of range

Yes, there's a mistake. Fixed in 8d66a30

rluening commented 9 years ago

We are getting closer.... Now in line 21: for j in range(0, self._packet_N, 2) for i in range(self._packet_size)) TypeError: sequence item 0: expected string, int found

ap-- commented 9 years ago

Weird... Can you:

print ret
print type(ret)

Before that line and report back?

rluening commented 9 years ago

Here we go: array('B', [0, 38, 43, 37, 36, 53, 51, 53, 50, 53, 52, 53, 47, 57, 58, 51, 50, 54, 45, 52, 54, 43, 47, 54, 54, 53, 53, 53, 50, 53, 53, 57, 59, 65, 49, 51, 51, 52, 63, 62, 56, 47, 56, 50, 58, 55, 57, 53, 52, 56, 57, 50, 47, 53, 52, 48, 48, 55, 52, 51, 51, 56, 56, 51, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 51, 56, 57, 53, 53, 51, 46, 55, 59, 49, 61, 64, 56, 53, 50, 49, 52, 59, 53, 54, 49, 56, 51, 52, 58, 56, 59, 52, 64, 50, 48, 44, 58, 60, 51, 54, 63, 56, 62, 59, 49, 59, 53, 55, 53, 52, 61, 59, 61, 57, 51, 59, 55, 59, 58, 57, 57, 58, 60, 55, 52, 53, 54, 56, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 52, 55, 55, 57, 56, 56, 55, 60, 56, 57, 56, 52, 53, 62, 52, 54, 61, 58, 63, 61, 51, 60, 56, 54, 57, 58, 62, 51, 53, 52, 63, 56, 64, 56, 47, 51, 60, 47, 56, 66, 72, 70, 66, 61, 64, 61, 65, 67, 55, 58, 56, 65, 57, 63, 57, 62, 62, 62, 59, 61, 59, 51, 57, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 50, 60, 56, 58, 62, 61, 53, 52, 57, 59, 52, 32, 58, 53, 57, 52, 54, 55, 58, 57, 59, 54, 55, 57, 54, 61, 61, 58, 65, 56, 69, 64, 54, 59, 63, 55, 52, 55, 58, 57, 57, 58, 52, 54, 53, 70, 67, 57, 66, 65, 60, 58, 56, 57, 56, 55, 74, 95, 105, 86, 75, 61, 65, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 58, 67, 65, 62, 59, 64, 61, 58, 63, 51, 69, 63, 58, 48, 60, 60, 60, 58, 51, 53, 56, 57, 53, 65, 57, 61, 61, 51, 67, 53, 68, 61, 50, 53, 53, 55, 65, 66, 60, 62, 54, 60, 69, 63, 60, 62, 64, 69, 56, 54, 52, 59, 59, 62, 59, 54, 58, 59, 58, 68, 67, 63, 58, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 56, 60, 51, 55, 59, 64, 50, 57, 55, 57, 51, 56, 60, 58, 66, 55, 52, 68, 64, 62, 65, 60, 65, 59, 60, 62, 60, 67, 71, 52, 53, 59, 59, 60, 55, 64, 59, 62, 72, 58, 54, 65, 55, 57, 61, 61, 58, 51, 58, 63, 70, 56, 57, 63, 61, 55, 62, 55, 65, 68, 68, 65, 66, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 65, 74, 75, 69, 89, 71, 67, 73, 75, 70, 72, 69, 66, 86, 69, 72, 68, 70, 74, 65, 70, 55, 67, 62, 73, 61, 60, 64, 61, 70, 66, 58, 63, 62, 66, 65, 57, 68, 60, 65, 62, 73, 59, 61, 55, 63, 59, 61, 60, 65, 60, 64, 55, 55, 59, 57, 63, 65, 61, 60, 63, 56, 59, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 57, 68, 58, 57, 47, 50, 48, 56, 56, 59, 56, 61, 61, 53, 53, 53, 61, 58, 55, 65, 61, 64, 68, 63, 56, 58, 45, 53, 61, 60, 59, 62, 53, 61, 63, 60, 52, 51, 52, 55, 61, 62, 56, 53, 58, 58, 62, 56, 55, 62, 61, 57, 53, 51, 53, 58, 60, 66, 67, 61, 66, 57, 70, 62, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 58, 58, 66, 65, 62, 55, 63, 63, 56, 58, 59, 32, 55, 61, 67, 57, 62, 66, 72, 76, 78, 79, 83, 82, 99, 115, 134, 153, 158, 165, 156, 168, 156, 150, 143, 154, 179, 185, 189, 164, 117, 97, 97, 82, 93, 79, 81, 85, 88, 81, 84, 81, 85, 75, 85, 74, 71, 85, 76, 76, 73, 64, 69, 68, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 68, 60, 62, 58, 61, 59, 59, 65, 61, 58, 59, 62, 63, 71, 62, 69, 63, 57, 56, 59, 62, 70, 57, 64, 55, 55, 61, 69, 55, 63, 54, 54, 61, 57, 51, 55, 59, 55, 55, 65, 54, 58, 66, 52, 71, 61, 56, 55, 64, 67, 62, 59, 72, 60, 64, 68, 72, 73, 75, 79, 77, 65, 70, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 71, 78, 73, 77, 82, 83, 92, 75, 83, 85, 83, 84, 88, 85, 89, 82, 92, 92, 86, 74, 76, 73, 82, 99, 107, 105, 108, 92, 80, 95, 81, 81, 79, 76, 78, 74, 77, 79, 91, 89, 94, 90, 82, 88, 78, 77, 66, 72, 70, 60, 76, 74, 70, 67, 78, 73, 80, 77, 72, 80, 72, 73, 75, 72, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 71, 62, 61, 72, 63, 64, 63, 69, 59, 66, 69, 71, 70, 69, 81, 79, 75, 75, 76, 82, 86, 99, 96, 120, 150, 236, 92, 171, 174, 116, 55, 240, 217, 192, 169, 165, 157, 151, 144, 131, 115, 108, 103, 89, 85, 94, 88, 93, 94, 79, 96, 89, 91, 83, 92, 92, 92, 90, 85, 89, 81, 82, 84, 78, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 72, 80, 82, 81, 68, 78, 77, 80, 80, 71, 73, 71, 81, 77, 77, 80, 87, 92, 103, 107, 99, 95, 79, 69, 76, 74, 61, 61, 61, 71, 63, 62, 67, 71, 62, 62, 57, 58, 68, 62, 54, 70, 59, 58, 62, 53, 63, 56, 64, 63, 60, 56, 62, 56, 62, 65, 61, 62, 57, 53, 57, 60, 61, 65, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60, 63, 56, 61, 58, 61, 57, 53, 56, 78, 62, 65, 71, 68, 70, 58, 64, 58, 59, 53, 74, 55, 60, 61, 60, 62, 55, 55, 57, 51, 60, 54, 60, 63, 63, 64, 56, 55, 62, 62, 59, 61, 57, 62, 60, 59, 62, 57, 63, 62, 56, 58, 70, 54, 58, 55, 55, 52, 65, 65, 58, 52, 61, 57, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 58, 57, 65, 66, 51, 58, 58, 55, 55, 68, 57, 54, 57, 57, 70, 60, 54, 51, 51, 54, 55, 61, 66, 57, 60, 51, 52, 67, 56, 53, 59, 59, 67, 59, 55, 62, 63, 49, 57, 56, 55, 52, 53, 58, 55, 54, 51, 57, 54, 63, 64, 64, 63, 62, 62, 53, 55, 61, 60, 56, 62, 55, 55, 56, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 60, 59, 66, 58, 58, 59, 55, 53, 57, 51, 72, 58, 59, 66, 57, 64, 64, 55, 59, 58, 57, 51, 54, 57, 53, 59, 51, 54, 52, 57, 52, 54, 59, 48, 53, 52, 60, 65, 51, 50, 57, 57, 70, 63, 60, 64, 63, 67, 63, 67, 53, 69, 70, 62, 72, 68, 64, 59, 67, 67, 62, 64, 62, 74, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 62, 68, 56, 62, 58, 54, 57, 57, 63, 59, 48, 58, 57, 59, 50, 65, 68, 63, 59, 54, 63, 58, 57, 52, 47, 51, 57, 49, 55, 54, 53, 45, 52, 52, 52, 53, 59, 59, 52, 53, 57, 60, 54, 52, 52, 63, 65, 52, 53, 60, 51, 52, 62, 56, 52, 51, 51, 53, 53, 58, 50, 26, 53, 60, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 64, 59, 48, 55, 59, 53, 50, 62, 60, 52, 61, 58, 60, 55, 59, 57, 57, 59, 58, 61, 53, 67, 58, 68, 57, 60, 55, 57, 55, 56, 61, 61, 52, 55, 65, 59, 60, 58, 56, 56, 56, 58, 66, 54, 58, 59, 58, 46, 52, 59, 51, 53, 55, 56, 59, 51, 57, 61, 43, 47, 56, 51, 57, 57, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 59, 68, 54, 52, 50, 52, 57, 64, 61, 60, 55, 61, 59, 53, 47, 60, 53, 39, 51, 55, 58, 59, 49, 51, 52, 54, 60, 59, 48, 52, 62, 56, 64, 57, 63, 61, 55, 57, 54, 61, 59, 54, 60, 61, 53, 55, 57, 63, 63, 60, 57, 58, 59, 56, 53, 59, 57, 58, 49, 54, 57, 56, 53, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 58, 56, 47, 32, 56, 52, 50, 51, 49, 55, 58, 57, 56, 53, 54, 54, 49, 56, 61, 54, 57, 55, 59, 50, 60, 56, 59, 54, 57, 63, 57, 52, 65, 56, 50, 54, 57, 54, 59, 57, 58, 59, 60, 60, 57, 56, 56, 59, 50, 58, 55, 50, 52, 54, 58, 47, 56, 57, 50, 59, 52, 62, 59, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 61, 54, 50, 59, 51, 53, 61, 53, 45, 54, 57, 53, 57, 54, 57, 64, 47, 48, 54, 54, 50, 51, 48, 52, 58, 54, 58, 54, 53, 60, 55, 56, 55, 63, 59, 54, 60, 68, 60, 52, 50, 61, 55, 52, 59, 53, 53, 51, 55, 61, 63, 46, 51, 55, 60, 58, 53, 50, 54, 51, 50, 55, 50, 56, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 56, 50, 60, 54, 52, 50, 57, 55, 56, 47, 53, 58, 60, 61, 58, 58, 45, 52, 56, 57, 51, 52, 50, 59, 47, 59, 62, 54, 53, 56, 50, 55, 59, 49, 54, 55, 44, 52, 55, 61, 50, 54, 60, 59, 62, 55, 58, 49, 48, 53, 51, 57, 59, 50, 54, 61, 61, 55, 52, 50, 56, 56, 59, 50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50, 56, 50, 57, 57, 51, 51, 55, 60, 60, 57, 55, 57, 54, 54, 57, 56, 55, 58, 53, 60, 56, 61, 56, 56, 49, 55, 61, 51, 58, 52, 55, 61, 60, 50, 49, 48, 62, 56, 57, 60, 59, 38, 51, 62, 54, 54, 52, 56, 59, 58, 55, 52, 56, 54, 55, 56, 45, 55, 59, 54, 55, 57, 53, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 50, 57, 63, 63, 52, 52, 62, 54, 57, 58, 49, 52, 53, 47, 52, 50, 52, 60, 65, 55, 61, 57, 55, 51, 49, 48, 55, 54, 53, 53, 62, 60, 51, 58, 52, 43, 56, 50, 53, 54, 58, 50, 59, 65, 55, 54, 52, 51, 55, 57, 55, 64, 57, 54, 50, 48, 50, 60, 58, 63, 56, 58, 51, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 58, 53, 61, 61, 57, 51, 53, 58, 56, 56, 59, 49, 46, 54, 48, 60, 60, 55, 53, 45, 48, 54, 53, 50, 52, 57, 56, 52, 51, 52, 53, 58, 51, 46, 55, 57, 53, 54, 50, 57, 52, 55, 55, 54, 60, 50, 45, 56, 69, 58, 63, 61, 59, 50, 49, 59, 55, 44, 49, 47, 58, 53, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 52, 52, 46, 61, 48, 57, 59, 49, 54, 50, 60, 58, 52, 53, 53, 58, 52, 51, 53, 53, 54, 47, 46, 63, 54, 62, 58, 54, 59, 47, 55, 54, 55, 56, 72, 45, 50, 51, 56, 53, 52, 52, 60, 57, 55, 57, 64, 59, 50, 57, 51, 60, 60, 55, 56, 51, 45, 58, 48, 54, 69, 55, 56, 60, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 53, 55, 58, 55, 54, 62, 55, 48, 58, 59, 56, 55, 58, 58, 53, 45, 54, 61, 50, 56, 54, 58, 51, 50, 53, 64, 53, 54, 50, 52, 62, 64, 59, 62, 57, 57, 58, 46, 51, 56, 57, 45, 54, 52, 54, 53, 45, 49, 55, 61, 49, 55, 58, 52, 60, 50, 51, 55, 63, 56, 50, 52, 61, 57, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 62, 64, 54, 50, 51, 50, 58, 62, 52, 59, 53, 54, 52, 61, 63, 46, 49, 63, 59, 48, 61, 59, 57, 62, 54, 50, 57, 58, 49, 56, 48, 55, 53, 63, 53, 58, 55, 51, 54, 51, 67, 61, 60, 59, 47, 58, 49, 53, 60, 56, 58, 52, 55, 52, 55, 51, 49, 60, 54, 61, 50, 54, 54, 56, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 51, 52, 51, 53, 55, 52, 44, 65, 60, 55, 60, 48, 52, 48, 57, 54, 52, 51, 56, 55, 60, 63, 53, 49, 56, 49, 57, 46, 54, 56, 58, 52, 56, 61, 57, 61, 53, 54, 60, 56, 59, 59, 58, 58, 51, 54, 55, 49, 51, 54, 50, 56, 52, 61, 51, 55, 55, 51, 52, 54, 55, 50, 49, 48, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 44, 53, 54, 50, 55, 54, 54, 50, 57, 61, 60, 60, 52, 51, 55, 51, 48, 50, 42, 47, 56, 53, 47, 54, 53, 54, 56, 47, 58, 60, 53, 54, 58, 48, 60, 53, 48, 58, 62, 56, 62, 58, 48, 51, 54, 50, 54, 44, 58, 56, 57, 60, 59, 60, 58, 56, 56, 50, 52, 59, 55, 58, 53, 53, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 48, 61, 57, 53, 58, 52, 51, 61, 57, 53, 63, 58, 56, 53, 56, 59, 52, 54, 48, 57, 48, 56, 55, 59, 58, 57, 57, 60, 62, 52, 54, 54, 57, 54, 52, 49, 57, 55, 59, 54, 61, 58, 57, 53, 51, 55, 62, 58, 50, 49, 61, 54, 52, 53, 60, 57, 51, 64, 60, 60, 50, 46, 46, 57, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 63, 63, 57, 53, 58, 65, 57, 56, 58, 59, 49, 56, 64, 62, 53, 58, 48, 53, 52, 54, 56, 56, 50, 53, 59, 50, 50, 56, 62, 53, 53, 55, 50, 54, 58, 54, 46, 52, 45, 45, 53, 52, 59, 62, 55, 53, 57, 50, 59, 56, 49, 48, 54, 54, 57, 49, 51, 61, 55, 45, 55, 63, 49, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) <type 'array.array'>

rluening commented 9 years ago

type is: type 'array.array'

ap-- commented 9 years ago

What version of pyusb are you using? ret should be a string.

rluening commented 9 years ago

pyusb-1.0.0a2 on Win7

ap-- commented 9 years ago

try the newest code. 8b57e63f77

If it still doesn't work, please try it with pyusb-1.0.0b1 as recommended

rluening commented 9 years ago

Tried...and of cause: ret = sum( ret[1:], ret[0] ) TypeError: sum() can't sum strings [use ''.join(seq) instead]

switched to pyusb-1.0.0b2 because pyusb-1.0.0b1 is not available any more.

ap-- commented 9 years ago

My mistake. The string stuff was wrong. I hope it works with ba0ce959 Switching to 1.0.0b2 might break things for you. https://pypi.python.org/pypi/pyusb has version 1.0.0b1

rluening commented 9 years ago

ok. Now on 1.0.0b1 New Error .... spectrum = struct.unpack('<'+'H'*self._pixels, ret) struct.error: unpack requires a string argument of length 16

my supmitted Code still runs fine for me thus pyusb didn't break anything :)

ap-- commented 9 years ago

The manual is wrong here. Big endian Byteorder on first word in query status... Fixed in 403b4158

rluening commented 9 years ago

status query gives: {'usb_speed': 128, 'integration_time': 5000, 'spectral_data_density': 0, 'acquisition_status': 1, 'timer_swap': 0, 'lamp_enable': 0, 'pixels': 2048, 'trigger_mode': 0, 'packets_in_endpoint': 64}

I checked self._integration_time at line 14 => 0.005 == 5 ms != 5000ms like in status 'usb_speed': 128 is wrong should be 0

and an Error: spectrum = struct.unpack('<'+'H'*self._pixels, ret) struct.error: unpack requires a string argument of length 4096

rluening commented 9 years ago

query_status

rluening commented 9 years ago

It changes endianess in the bytestream... ugly isn't it?

ap-- commented 9 years ago

It's quite hard to debug this without the hardware. I hope it's working now... 7678aa353

rluening commented 9 years ago

No error yet :)

I will check the values more carefully tommorow

rluening commented 9 years ago

Looks good !!

I am still not sure why "".join(sorted_ret) is working.....

I compared the result of my byteshifting implementation and yours. They differ because of noise, but are similar enought to say it is finally working.

rluening commented 9 years ago

A little late but the USB2000 data sheet is available at: http://oceanoptics.com/wp-content/uploads/USB2000-OEM-Data-Sheet.pdf

ap-- commented 9 years ago

already merged in