-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Flame-S Edge Trigger Mode and Timing #97
Comments
Hi Dean, Thank you for the really detailed error description! 🥇 This makes solving issues a lot easier. First: the way you added the new Second: the darkcount error you get is definitely a bug. And I thought I fixed this a long time ago already... Can you show the output of: import seabreeze
print(seabreeze.__version__) Let's solve the darkcount issue first, and then move towards the trigger issue. Also, just to let you know: I have a work in progress branch where I implement that the Flame-S will be recognized correctly and will push that soon. But time is currently a scarce commodity so it's hard for me to predict when I can continue to work on it. Let's try to get out the dark count issue because that should make everything you need for now. Cheers, |
Hi Andreas, I just saw your message. I think you are correct that if we can get the Dark to work then I can get the trigger '4' single shot to work and can actually start putting the potentiostat with the spectrometer. I tested some OI py code but it is not ready for this application yet. Did I understand that there is a new py-seabreeze version? Well, I'll do the test first.
Output:
Version: 1.1.0 Dean |
Hi Dean,
And yes, the newest version is 1.2.0 and I released it yesterday. It fixed a few small issues with test and usb-transport handling. But should not change anything for you. I'll try to reproduce the darkcount error on my machine tomorrow. Will have to sign off for today! Have a nice day, |
OK... I'll try the py vs c - seabreeze test again on both my surface pro 7 and MacBook pro... maybe it is an OS issue but doubt it and update if I find anything useful. I have many zoom meetings today so it might take a bit. Regards, Dean Update 1: I have gotten the py-seabreeze code to work on an environment on my mac but not on the PC. I can't tell if I did something different on the PC. Also, the version that is working doesn't have the modification for SINGLE_SHOT. Not sure why now it is working on one and not the other. Could there be a difference in a class it calls? Still on the mac, I think I was fooled. I tried to restart using pyseabreeze after running using cseabreeze and it appeared to work but it still was hooked onto cseabreeze. I am a bit puzzled as now something is not allowing the backend to load.
On the PC side, I maybe have more info. I get warnings before the logic error:
I'll look again tomorrow if I can get time. Maybe I should reinstall anaconda again anew? |
I wanted to setup another test on the surface pro 7 from a new environment. I made a new environment with python 3.8 and did a pip install seabreeze (1.2.0) then realized that it didn't install py-seabreeze so then issued "pip install seabreeze[pyseabreeze]". Since I had already installed drivers before via 1.1.0, I didn't worry about the following error for seabreeze_os_setup. Maybe this is a problem?
To test, I using the following code first and in creating a spectrometer it erred in a manner I have not seen. An eeprom error.
and got the following back:
I doubt this is that helpful but thought I would pass it along. Maybe it is related or may be new per 1.2.0. BTW, cseabreeze continues to work as in the past. I just can't change the triggering options. I'll update if I learn more. |
Hi Dean, So the That the eeprom feature is missing is very strange. I'll put that on my list for trying to reproduce. Cheers, |
I am beginning to wonder if some of these errors might be connected to a particular anaconda environment or win10 / MacOS permissions. I am going to try two things: 1) not use anaconda on my win10 box but the chocolaty procedure (though I like anaconda's flexibility) and 2) on my MacOS box, try to install in a fresh environment. It sure seems like we are close to have the Flame-S working nicely. I may end up finishing my Labview version to get things running since my teaching schedule will get heavy shortly. BTW: I have not run that test you asked about for the development version. I was not confident I was able to download and install the dev version properly. Regards, Dean |
Okay, small update:
Regarding anaconda: |
OK. If I understand your first point... the dark pixel issue is the reason I can't set True to Dark and nonlinearity correction in the get spectrum call and it is currently not fixed in version 1.2.0? Second, I'll transition to anaconda environments with python 3.8. Thanks! I think if I can get the dark part fixed I can patch the '4' setting temporarily but having py-seabreeze recognize Flame-S and have the trigger settings match would be great. Update 20200813: FYI: I setup a new anaconda 3.8 environment on my MacOS 10.15.6. When I issued the install command for pyseabreeze only pip didn't find anything but seabreeze alone worked OK.
Though when I issued just seabreeze it seemed good.
Will test Update 20200813 5pm PST I tried to run the following code when I got home which is where I am trying to do development on due to COVID.
It is grumpy due to seabreeze backend USB errors:
It does print 1.2.0 for the seabreeze version. Then errors also when I call Again, if I switch to cseabreeze, then usb seems to work again:
Dark and nonlinear correction work nicely. But, I can't select trigger mode '4' and can't tweak the cseabreeze as I believe it is compiled. Then, I figured something was missing from the environment. I found pyusb and installed it. Shutown anaconda, and restarted anaconda as well as disconnecting and reconnecting the Flame-S. Does pyseabreeze have a dependency on this and it is not caught in the pip install? Now it gets through the But, neither dark or nonlinearity correction work but without them I get spectra. Note, I added another test to see if it is only dark but nonlinearity also triggers the error.
Could I have done something wrong in setting up the environment? You suggest that the bug related to this is fixed. Don't mean to disagree. 😄 I'll give it a try on the windows box next. 20200813 later OK... did a quick test with windows10 on a surface pro 7. I built another python 3.8 environment the same as above. USB was not found. I installed pyusb. It errors in a different way. Rebooted. Tried again and got for the same initial code as above:
It really seems I have something setup incorrectly. I get errors when I run seabreeze_os_setup but I wonder if it is because I have run that in the past?
Hope this plethora of notes is helpful. enough for today. It really seems like it should be close. Thanks. Dean |
It's fixed in version 1.2.0 So if you are running 1.2.0 you should be able to set it to True and not crash with the error you reported before :)
Great. I have a suspicion that a possible download error will crash with a unspecific error message like you reported. Running it with python=3.8 should circumvent that. (It's totally possible that there's another bug though)
Yes. As soon as I have some spare time to continue and finish the work on "real" Flame-S support (not aliased as a USB2000plus) this will be supported out of the box. Cheers, |
I am not quite sure what happened but I stopped getting backend error on macOS. But then also discovered that the following seems to work after I modified devices.py to allow SINGLE_SHOT. I really doubt that did much for the backend USB error but...
and then get:
With dark=True and nc=False: With dark =False and nc=False: So, it seems perhaps that the problem is with the nonlinearity portion. When I switch back to cseabreeze I can easily grab those coef.s Whenever
Still no idea why the backend USB issues stopped. Hope this is not too much info and you find it useful. Regards, Dean |
the backend issues probably stopped because you installed I'm not sure why it wasn't installed in the first place, but debugging issues with your local environment is almost impossible in retrospect. You would need to show every single command including output that you used to create the environment for me to be able to MAYBE figure out what's wrong with your python environment. The spectra plot you showed are great! that means it's working already 👍 🏅 In other news: I also added the nonlinearity coefficient feature back into pyseabreeze for the USB2000+ and by extension the FlameS. And the Triggermode 4 support is added to the FlameS for pyseabreeze, too. So that means, the current master branch should make the FlameS work as expected. Cheers, |
Cool... 👏 All I did to install seabreeze was pip install seabreeze via terminal in the anaconda python3.8 environment I setup fresh. No dependencies were invoked as far as I could tell. It was the error that led me to pyusb. Should pyusb get added when installing seabreeze that way? I'll have to learn more about GitHub so I make sure I install the main branch. I'll try to test that out. For fun... here is a plot of an overlay of 53 absorbance spectra collected every 100 ms with 24 ave.s for a thin film of P3HT. Just testing. Without the non-linear correction... BTW I think trigger mode 4 should work for USB2000+ too ??? I don't have one though to test. I only have other USB650s. Will let you know. |
I installed what I think is the master branch. It didn't seem to be correct. The files have a current timestamp. I am still getting it assigned to USB2000+, don't see trigger 4, and nonlinear correction is not working. I must not have succeeded as I can see your changes on GitHub. Will see if I can figure out what I did wrong.
Update As a short check, I think I installed the proper master branch. I can now see the changed devices.py. BUT, it can't get a serial number now. I tried with its serial number and from first available.
And got:
Anaconda says that pyusb is installed... and I think
Ideas? |
Also, I was trying to figure out why the serial number is not reported and I looked at the Flame S class. Why is nonlinearity in USB2000+ and not in Flame-S and the other Features are there?
In USB2000+:
|
Hi Dean, the command you used is correct. pip install git+git://github.com/ap--/python-seabreeze.git If you run it again now, your seabreeze version should show up as As you correctly noticed, I forgot to add the nonlinearity coefficient feature to the FlameS. And I pushed to more commits, fixing the issues. Which OS are you running this on right now? Windows or Mac? Cheers, |
Good morning (here) (or evening... 😄 )... Thanks. I am currently running MacOS 10.15.6 for now just because my mac is my main box but when things are working will be transitioning to the Surface when installing the new build. I can move to the surface if that is more helpful. FYI: I still don't get a serial number.
Tried it again after forcing kernel to restart and rebooting Flame and get a different error?
If I leave things alone and redo the import.... to list devices I am more or less back to the original error. |
Hmmm... Please run the code that produces this error again, after you updated your seabreeze install. version should be |
OK... Here is what happened:
Tried to build in win10 but git fails at building wheels. |
Here is what I have found which includes all of the register info around page 87 and the FPGA firmware version is at 0x04 read only though you likely have this. |
Yes. Could you please connect your FlameS via the OceanOptics Software and check its firmware version? If it's |
Wow! Very nice! I need to fix the Run your python script that you're using to test the spectrometer not with python your-spectrometer-test-script.py But with: python -O your-spectrometer-test-script.py (That is a capital O for optimize, which ignores all assert statements in the python code at runtime) |
I have been testing in jupyter notebooks and am not sure how to do that in anaconda/jupyter. I'll research that or I'll put the cells together as a single .py and test from a python call. I think I can do that. I am still 'learning to really drive' anaconda. I won't likely get to that until tomorrow now. I was able to go back to the plain version and added the line for nonlinearity. It then functions albeit without native acknowledgment of being a Flame-S but it 'appears' to function for now with dark correction, nonlinearity, and trigger mode 4. You must have found out info about upgraded firmware. I could not find any info on that. Do you think I should ask OI for an update to the firmware? Will let you know what I find. Thanks! |
Hi Dean, could you please try with the newest version? |
UPDATE Nice! Here is the result:
Everything I have tried worked in a new environment. I pre-installed pyusb in case it didn't grab it. I'll test a bit more but looks great for these issues! Congrats! I should include that both dark and nonlinearity worked as did trigger 4. I work on developing the spectroelectrochemistry application now. I will still look at the jump in acquisition time / integration time with increasing integration time. I suspect that may be a spectrometer issue? |
No rush. Will only be able to have another look tomorrow evening. |
Awesome 🎉 🥳 Okay, I'll try to get a new version out on the weekend. Cheers, |
Thanks Andreas! I'll look at the new issue and can maybe contribute the code I used with some tweaks. I am sure you can generate testing code that is better than mine. LOL. Best wishes. Dean |
spectrometer and system information
current problem
This issue is branched from a previous issue regarding the Flame-S --> "Flame-S spectrometer is seen but doesn't report data #92".
(Andreas: Sorry this is long but hopefully understandable and helpful. Dean )
First Trigger / Timing Issue
I suspect the settings for triggering the HR2000+, USB2000+, and Flame-S are missing edge triggering unless the trigger numbers one specifies are not the same as the manuals.
I heard back from OI regarding discrepancies in the manuals and per your suggestion I am starting a new issue.
Here is what tech support said which is consistent with page 34 above from the USB2000+ manual and from the Flame for the Flame-S spectrometer:
Note that they leave out '1' which is described as a software trigger...
and from the part of the Flame manual that is consistent with the note from tech support (though in other parts of the manual it appears to have contradictory settings). I suspect this issue has to do with the differences between the Flame-S and Flame-T models where the latter one seems have the other set of trigger values seen in the manual.
From my testing of both cseabreeze and py-seabreeze...
So, if the data value for the trigger info: "T(word)" in py/c-seabreeze goes from 0 to 3, then I suspect it will not be possible to setup edge trigger mode which is '4'. However, if there is an internal translation from 0...3 to 0, 4, 2, 3 then perhaps but it is not clear to me if that is the case.
I was able to add '4' to the NI Labview trigger subVI and was able to trigger. I can't figure out if I can modify the py-seabreeze code to add trigger mode 4 or even if that would be the correct thing to do.
I have found the following in spectrometers.py but I have not been able to go past this to see where trigger mode gets set.
Second Trigger / Timing Issue
Second regarding timing of acquiring data. Previously, I measured the average time to acquire a spectrum as a function of integration time and at about 1600 microseconds there is a jump down in acquisition time. Even though I would like that to be accurate I suspect it is an issue in that py-seabreeze might be reporting the spectrum before it is read out of the CCD. Here is what I found as previously reported. In this case, I am triggering in trigger mode 0 (free running). This was acquired on a Mac but it is very similar on a win10 box.
And I suspect there is some sort of process prioritization that may be computer dependent that adds an approximately constant call time to the loop so the time per scan goes down... I think the main question is why the change in behavior at 1600 µs for integration time?
I have seen this from both win10 and macOS.
The External triggering options firmware3.0 and above PDF file, it has the following timing diagram which I am not sure it the timing would apply to a free running spectrometer but it might providing some insight:
The reason I am doing this is to use edge triggering to sync timing with a Gamry potentiostat which I can set to have an output pulse at each data point and then I turn off edge triggering and acquire 'X' spectra to average then turn on edge triggering again and wait for the next pulse.
I am wondering if the spectrometer will return values for the spectrum even before a new one is acquired.
steps to reproduce
Execute the code below to set edge triggering.
minimal code example and error (very helpful if available)
and in devices.py
Hum? Should EDGE be 0x04 like SINGLE_SHOT?
Maybe this would fix things? I'll try it.
I tried this but it sort of seems to work in that in pyseabreeze it doesn't error for a mode of 4 but there are other issues.
The spectrometer can correct for dark counts and nonlinearity but when I set those to true it errors as follows. This may be independent of the trigger mode.
Here is what happens with some example code without changing triggering:
exception but it runs:
If I change to:
Then I get the following errors even though the spectrometer supports both modes and it works in cseabreeze as far as I can tell.
But... the following works apparently:
It doesn't error. I will add more if I can get it to trigger from the potentiostat but that is all I have time for now.
The text was updated successfully, but these errors were encountered: