Author Topic: Question: Is it possible to output a serial port command (CL Acquisition)?  (Read 24222 times)

Jason in Singapore

  • Post Doc
  • ***
  • Posts: 15
    • FACTS Lab at NTU

Hi all,

This is a bit off the wall. We have attached an optical spectrometer to the stem of our CL camera system as a DIY approach to CL spectral analysis. Since the materials we are looking at are high CL emitters, it works surprisingly well.

We would like to attempt hyperspectral imaging. The thought is to use the Rectangular Grid feature in Automate to set the XY positions and timing while we compile the spectra into an array using our own program. Does anybody know of a way to have ProbeSoftware issue a serial port command at the beginning or end of each analysis within a grid? We would use this for triggering the spectrometer.

Bonus question: Does anybody know how to have ProbeSoftware write a text file containing X, Y, and time at the beginning or end of each analysis within the grid of spots?

All advice is appreciated. Has anybody tried this or something similar?

Cheers,
Jason
« Last Edit: June 17, 2015, 09:28:09 AM by John Donovan »
"Truth is relative, belief absolute"

Probeman

  • Emeritus
  • *****
  • Posts: 2856
  • Never sleeps...
    • John Donovan
Re: Question: Is it possible to output a serial port command?
« Reply #1 on: June 10, 2015, 11:59:30 AM »
This is a bit off the wall. We have attached an optical spectrometer to the stem of our CL camera system as a DIY approach to CL spectral analysis. Since the materials we are looking at are high CL emitters, it works surprisingly well.

We would like to attempt hyperspectral imaging. The thought is to use the Rectangular Grid feature in Automate to set the XY positions and timing while we compile the spectra into an array using our own program. Does anybody know of a way to have ProbeSoftware issue a serial port command at the beginning or end of each analysis within a grid? We would use this for triggering the spectrometer.

Bonus question: Does anybody know how to have ProbeSoftware write a text file containing X, Y, and time at the beginning or end of each analysis within the grid of spots?

All advice is appreciated. Has anybody tried this or something similar?

Cheers,
Jason

I love this kind of DIY stuff!  Basically I think you want to acquire a CL spectra along with the WDS data in PFE, just as we currently do for EDS spectra... correct?

I'd prefer to implement an interface to a commercial CL system such as Gatan or even a defacto standard such as an Ocean Optics visible light spectrometer. Is that what you are using? I am not aware of what kind (if any) of an API that Ocean Optics makes available.

A vendor API would be much preferred to re-inventing the wheel as they say.
john
The only stupid question is the one not asked!

Jason in Singapore

  • Post Doc
  • ***
  • Posts: 15
    • FACTS Lab at NTU
Re: Question: Is it possible to output a serial port command?
« Reply #2 on: June 12, 2015, 01:53:23 AM »

The spectrometer is a Newport but next week we want to try the same thing with an Ocean Optics spectrometer. Our plan was to bypass the spectrometer software and use our homebrew software “IV Spectrum”, which is written in Python.

Our thought was to use Probe Software for stage control while IV Spectrum sorts out the spectral data and produces images of designated wavelength ranges. What we need is a triggering mechanism … ideally 2-way triggering. There are a few options. The “start” trigger could either be ProbeSoftware issuing a serial port command, or else ProbeSoftware appending the X,Y position to a designated text file. The reverse trigger is not essential, but it would allow the pace to be set by IV Spectrum.
"Truth is relative, belief absolute"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Question: Is it possible to output a serial port command?
« Reply #3 on: June 12, 2015, 08:39:55 AM »

The spectrometer is a Newport but next week we want to try the same thing with an Ocean Optics spectrometer. Our plan was to bypass the spectrometer software and use our homebrew software “IV Spectrum”, which is written in Python.

Our thought was to use Probe Software for stage control while IV Spectrum sorts out the spectral data and produces images of designated wavelength ranges. What we need is a triggering mechanism … ideally 2-way triggering. There are a few options. The “start” trigger could either be ProbeSoftware issuing a serial port command, or else ProbeSoftware appending the X,Y position to a designated text file. The reverse trigger is not essential, but it would allow the pace to be set by IV Spectrum.

Hi Jason,
I don't mind adding a serial port trigger to PFE for initiating a CL spectra acquisition, but then what? I'd rather have PFE also store the CL intensity data in the PFE database automatically just as it does for EDS spectra currently. I hate external files scattered all over the hard drive!

In your "homebrew" software could you provide an API that I could call from PFE to start, stop, get the status of and retrieve the CL spectra intensity acquisition?  It's simpler than acquisition of EDS spectra because I wouldn't need to obtain net intensities for quantification!  Can you make your python code into a DLL that I could call from PFE?  I think Philippe Pinard told me that this is possible.  Here is a possible API:

Function CL_Init
   Open a connection to the CL interface

Function CL_StartCL
   Start the CL spectrum acquisition

Function CL_GetStatus
   Returns true if acquisition in progress, false if not.

Function CL_StopCL
   Stop or cancel the current spectrum acquisition

Function CL_GetSpectrum(npoints&, narray&())
   Get an array of CL intensities from the current acquisition. Npoints& is the number of array elements returned in narray&().

Function CL_Close
   Close the CL interface

We could add an Export All CL Spectra button too. What do you think about this possibility?
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

RIKO

  • Post Doc
  • ***
  • Posts: 16
Re: Question: Is it possible to output a serial port command?
« Reply #4 on: June 14, 2015, 11:04:41 AM »
Hi John, thanks for approving my request.
Ocean optics is providing library for their spectrometer for free.
It is called seabreeze http://oceanoptics.com/product/seabreeze/
We are using basically the same library for our python scripts (we called 'IV SPectrum' for Current-voltage-spectrum acquisition).
It will be great if this thing can be integrated to PFE !!.

Some equivalent functions copied from seabreeze docs:
Function CL_Init
   Open a connection to the CL interface
   int probeDevices ()
   int addRS232DeviceLocation (char *deviceTypeName, char *deviceBusPath, unsigned int baud)
   int getNumberOfDeviceIDs ()
   int getDeviceIDs (long *ids, unsigned long maxLength)
   int openDevice (long id, int *errorCode)

   
Function CL_StartCL
   Start the CL spectrum acquisition
   int spectrometerGetUnformattedSpectrumLength (long deviceID, long featureID, int *errorCode)
   int spectrometerGetUnformattedSpectrum (long deviceID, long featureID, int *errorCode, unsigned char *buffer, int bufferLength)
   int spectrometerGetFormattedSpectrumLength (long deviceID, long featureID, int *errorCode)
   int spectrometerGetFormattedSpectrum (long deviceID, long featureID, int *errorCode, double *buffer, int bufferLength)
   int spectrometerGetWavelengths (long deviceID, long featureID, int *errorCode, double *wavelengths, int length)
   
   
Function CL_GetStatus
   Returns true if acquisition in progress, false if not.

Function CL_StopCL
   Stop or cancel the current spectrum acquisition

Function CL_GetSpectrum(npoints&, narray&())
   Get an array of CL intensities from the current acquisition. Npoints& is the number of array elements returned in narray&().

Function CL_Close
   Close the CL interface
      void closeDevice (long id, int *errorCode)

-riko-

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Question: Is it possible to output a serial port command?
« Reply #5 on: June 14, 2015, 11:09:40 AM »
Hi John, thanks for approving my request.
Ocean optics is providing library for their spectrometer for free.
It is called seabreeze http://oceanoptics.com/product/seabreeze/
We are using basically the same library for our python scripts (we called 'IV SPectrum' for Current-voltage-spectrum acquisition).
It will be great if this thing can be integrated to PFE !!.

Some equivalent functions copied from seabreeze docs:
Function CL_Init
   Open a connection to the CL interface
   int probeDevices ()
   int addRS232DeviceLocation (char *deviceTypeName, char *deviceBusPath, unsigned int baud)
   int getNumberOfDeviceIDs ()
   int getDeviceIDs (long *ids, unsigned long maxLength)
   int openDevice (long id, int *errorCode)

   
Function CL_StartCL
   Start the CL spectrum acquisition
   int spectrometerGetUnformattedSpectrumLength (long deviceID, long featureID, int *errorCode)
   int spectrometerGetUnformattedSpectrum (long deviceID, long featureID, int *errorCode, unsigned char *buffer, int bufferLength)
   int spectrometerGetFormattedSpectrumLength (long deviceID, long featureID, int *errorCode)
   int spectrometerGetFormattedSpectrum (long deviceID, long featureID, int *errorCode, double *buffer, int bufferLength)
   int spectrometerGetWavelengths (long deviceID, long featureID, int *errorCode, double *wavelengths, int length)
   
   
Function CL_GetStatus
   Returns true if acquisition in progress, false if not.

Function CL_StopCL
   Stop or cancel the current spectrum acquisition

Function CL_GetSpectrum(npoints&, narray&())
   Get an array of CL intensities from the current acquisition. Npoints& is the number of array elements returned in narray&().

Function CL_Close
   Close the CL interface
      void closeDevice (long id, int *errorCode)

-riko-

So have you tested the interface at all?

I see these functions:

   int spectrometerGetUnformattedSpectrumLength (long deviceID, long featureID, int *errorCode)
   int spectrometerGetUnformattedSpectrum (long deviceID, long featureID, int *errorCode, unsigned char *buffer, int bufferLength)
   int spectrometerGetFormattedSpectrumLength (long deviceID, long featureID, int *errorCode)
   int spectrometerGetFormattedSpectrum (long deviceID, long featureID, int *errorCode, double *buffer, int bufferLength)
   int spectrometerGetWavelengths (long deviceID, long featureID, int *errorCode, double *wavelengths, int length)

but are they called to start or return the data?

Maybe post the document for us?
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Question: Is it possible to output a serial port command?
« Reply #6 on: June 14, 2015, 12:07:08 PM »
Some other considerations:

How do you get the CL signal out of the instrument?  Are you utilizing the EPMA light optics or using an insertable parabolic mirror?  In other words can the CL spectra be acquired at the same time as the WDS elements, or does it have to be before or afterwards?

There is also a discussion on future integration of EDS (and CL) spectrum imaging using the stage/beam pixel sync pulses from the instrument mapping generator:

http://probesoftware.com/smf/index.php?topic=400.msg2174#msg2174

Thermo is already implementing this new integrated EDS-WDS mapping method on John Fournelle's new Cameca SXFive instrument. But having this for point analyses is a good start... we already acquire a full EDS spectra for each point analysis from Bruker and Thermo detectors.
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

RIKO

  • Post Doc
  • ***
  • Posts: 16
Re: Question: Is it possible to output a serial port command?
« Reply #7 on: June 15, 2015, 02:55:59 AM »

Unfortunatelly we had not tried seabreeze itself.
I thougth it should be easier than creating a new api from our python script, and probably more robust than our home-made driver.

Quote
   int spectrometerGetUnformattedSpectrumLength (long deviceID, long featureID, int *errorCode) ....

Those function should be for return data, as I can see from the example code (attached).
The official docs for this driver is pretty minimal, but discern able from the example.

In our script, we skip the seabreeze and use python driver from Nuria Pujol Vilanova.
Downloadable from
Quote
http://www.google.com.sg/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CB0QFjAAahUKEwjjksvprJHGAhVNfLwKHWEpAJA&url=http%3A%2F%2Fforja.rediris.es%2Ffrs%2Fdownload.php%2F682%2FTestingUSB4000.py&ei=DpZ-VePTLs348QXh0oCACQ&usg=AFQjCNGfAsv4t2bIyydm3NFZl35GaViQjQ

And attached are our stripped down versions of the same driver (oospec.py & oospec.pyc).
The problem next is, how can we interface with c++. There seems to either call or embed python from/to c++. I attached the docs print out as well https://docs.python.org/2/extending/embedding.html.

We obtained the CL signal from a small window provided by JEOL (as seen from picture posted by Jason, with me in the frame). There use to be metal stem on that window, with attached photo multiplier and a CCD. There are seems to be lens system in it. The CL collected at the same time as WDS and EDS.
Looking at the EDS spectrum imaging, looks like CL will be much simpler.

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Question: Is it possible to output a serial port command?
« Reply #8 on: June 15, 2015, 06:59:07 AM »
Hi Rico,
I like that you utilized the secondary optical/EDS port so you can acquire CL at the same time as EDS and WDS.

Yes, I agree using the "seabreeze" API should be a better solution than a "hacked" API.    ;)

I'm sort of gearing up for the M&M conference this summer (a few other irons in the fire as they say!), but I think I should be able to create a CL acquisition interface for point analyses in PFE later this summer using your link:

http://oceanoptics.com/product/seabreeze/

Creating CL spectrum imaging capability (a la xCLent) will be more difficult as we would need to synchronize with the JEOL stage/beam mapping pixel sync signals as described here (for EDS):

http://probesoftware.com/smf/index.php?topic=400.msg2174#msg2174

We are currently implementing this for a Thermo EDS on John Fournelle's Cameca SXFive instrument in Wisconsin...
« Last Edit: June 15, 2015, 07:31:33 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Re: Question: Is it possible to output a serial port command?
« Reply #9 on: June 15, 2015, 07:14:37 AM »
Rico,
Can you provide more details on the CL optics as shown here:



Do you know anything about the geometric efficiency?  How do you think it compares to collecting light through the JEOL light optics (a la xCLent) or compared to a parabolic mirror over the sample which I believe is the most efficient?

After a quick look at the open source SeaBreeze driver, I wonder if their standard OmniDriver seen here:

http://oceanoptics.com/product/omnidriver/

is a better way to proceed.  The only caveat I see is that the OmniDriver is not free, but it appears to be well supported which is often a good way to go.

If I implement this CL interface in PFE, would you be willing to provide a copy of the OmniDriver CL driver for me to test the interface with?

Edit by John: here is question I would very much enjoy hearing from CL experts on: how does the optical collection efficiency (numerical aperture?) numbers compare for these three methods of CL spectrum collection to a fiber optic:

1. Gatan/Horiba style parabolic mirror

2. XCLent style through the instrument light optics

3. Transfer lens style using secondary EDS port as shown in the above photograph.
« Last Edit: June 17, 2015, 08:07:32 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
Jason and Rico: please see this post:

http://probesoftware.com/smf/index.php?topic=529.msg2913#msg2913

I've implemented all the code for CL spectrum acquisition in PFE except for the hardware specifics.  Now we just need someone to specify a CL hardware API for me to connect!  Ocean Optics, Newport, Gatan, etc.- you all tell me what you need!
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

RIKO

  • Post Doc
  • ***
  • Posts: 16
Hi John,

Those looks cool

As for your questions, I have no idea what is our setup efficiency. I guess it is pretty low.  For one,  we are using refurbished spectrometer (Newport 100 OSM). It took about 5s to collect reasonable signal from InGaN sample. Jeol's exClent system is definitely better, but probably much more costly than our setup.  Next, we want to try Ocean Optics USB4000, to see if we can capture the spectrum better (as soon as the machine available).

As for the Omnidriver. I will have to get back to you on this. I have to make sure the licensing does not conflict with the lab and my institution regulation and policy.

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
As for the Omnidriver. I will have to get back to you on this. I have to make sure the licensing does not conflict with the lab and my institution regulation and policy.

No worries.  If you are going to interface to the Ocean Optics box I'll buy my own copy of the driver. I know someone that has an Ocean Optics spectrometer I can test.

It would be interesting to get some absolute readings on a few standard fluorescent materials... I'm sure this has been done, and although the sensitivity will be a function of the spectral characteristics, even a panchromatic measurement will be useful for comparing relative optical efficiency of the various collection devices.
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3304
  • Other duties as assigned...
    • Probe Software
As for the Omnidriver. I will have to get back to you on this. I have to make sure the licensing does not conflict with the lab and my institution regulation and policy.

Hi Rico,
OK, I called Ocean Optics and they will sell us a full driver with optical spectrum processing for ~600$, so I'll just have Probe Software purchase it- and yes, the driver is fully re-distributable for end-users so we will provide that along with the CL spectrum acquisition capability.

If you guys would like to beta-test the CL acquisition feature for us, we can provide the PFE CL acquisition feature and driver to you for free- everyone else will have to pay a nominal cost!    :P

Can you provide us with any information on the collection optics hardware circled in the picture in this post:

http://probesoftware.com/smf/index.php?topic=517.msg2883#msg2883

For example, who makes it, how much is it and how well does it seem to work (the geometric efficiency question)?

Edit by John: I just received the Ocean Optics driver.  Will start implementing it in PFE ASAP.  Any one willing to beta test the acquisition?  I don't have a fiber optic connection on my Sx100 (yet). 

Though Paul Edwards said he was able to attach the CL spectrometer directly to the Sx100 using a small lens optics.
« Last Edit: June 24, 2015, 01:55:13 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

qEd

  • Professor
  • ****
  • Posts: 26
For reference a parabolic mirror, for example like the ones Gatan uses in many of their systems is roughly 80-85% efficient.
Ed