T O P I C R E V I E W |
jensenm90 |
Posted - 04/29/2012 : 11:15:24 PM Origin Ver. and Service Release (Select Help-->About Origin): 8.6 SR3 Operating System:Windows 7
I'm trying to create a script that will allow me to integrate several peaks within a range automatically and output the peak areas to a new sheet. The data is of a recurring potential pulse experiment done using a potentiostat. In total, there are 60 separate pulse 'events.' Integrating the current over a certain pulse range will allow me to track the number of electrons passing into or out of the system. Ideally, my output would be a data sheet with one column of X values as "Pulse Number" associated with a second column as "Peak Area."
I've looked over the scripting guide, but I'm completely overwhelmed.
If someone could please help me that would be really great.
Thanks you in advance,
- Matt |
5 L A T E S T R E P L I E S (Newest First) |
easwar |
Posted - 05/01/2012 : 11:01:57 AM Hi Matt,
Origin offers two programming languages: LabTalk Script, and Origin C. For the latter, taking a course in C/C++ could be helpful. We do have programming guides for both that provide an overview of what you can do with these languages, and these guides include several practical examples. Look at the help menu and try read thru some chapters of the guides.
Regarding your specific problem, do you need to integrate within a small window around each peak, or do you just want to integrate the entire curve over a range covering multiple peaks to get the cumulative area? It was not clear from your post.
If you send your data and some more explanation on what you are looking for, we can help. Use the "Send File to Tech support" link on top right of the page, attach your opj/data file, and refer to this post in your message.
Easwar OriginLab |
jensenm90 |
Posted - 04/30/2012 : 4:19:19 PM Dr Shepard,
I really appreciate how quickly you responded!
But I think you might have overestimated my knowledge of programming in general... I understand conceptually how you approach to the problem, but the implementation is pretty difficult at this point. I think I'm going to take a few programming classes before I tackle this problem again.
On that note: my university (Western Washington University) offers an intro to C++ class. Would a class like that provide me with sufficient background to approach Origin's language?
Thanks,
- Matt
(Also, I appreciate the aside about mechanical switches! I always find residual terminology fascinating!) |
Drbobshepherd |
Posted - 04/30/2012 : 12:17:25 PM Corrections:
Instead of "voltage", I should have said "curent density", which is how you labelled your data. Therefore, Risetime will equal dI/dt.
And, your conditional for detecting possible pulses should be to compare abs(Risetime[i]) to your Threshold.
DrBob |
Drbobshepherd |
Posted - 04/30/2012 : 12:11:00 PM You have an interesting curve there. I believe the "Peak Area" column you want to calculate is simple enough; use the integ1 X-function with the "math" output type. For example,you could try
integ1 iy:=(Col(1),Col(2)) type:=math oy:=Col(3);
This assumes Time is col(1), Voltage is col(2) and your integration results will go to col(3).
The "Pulse Number" column is a little more complicated. To detect pulses, you need to generate a two additional datasets, Risetime (dV/dt), and Pulseflag. Also, create a variable, t0 initialized to the first time value. Then, create two constants, Threshold and Debounce and with a little thought or experimentation, determine suitable values. Threshold is the Risetime value that will trigger pulse detection. Debounce is the period of time that the detection algorithm will be temporarily suspended after a pulse is found. (The debounce name originates from the early days of mechanical switches with spring contacts that literally bounced open and close several times before settling. Detection circuits had to be designed with a suitable "Debounce Period" to ignore the chatter.)
Loop over every cell in Risetime. If Risetime[i] is greater than Threshold, you may have a pulse. Compare the Time. If the time elapsed since the previous pulse detection is less than Debounce, you do not have a new pulse. If greater, then you do have a new pulse; set Pulseflag[i]=1, and t0= Time[i].
When the loop is finished, create your "Pulse Number" dataset by cummulatively counting the flags in "Pulseflag". |
jensenm90 |
Posted - 04/30/2012 : 01:12:07 AM This is what the data looks like:
 |
|
|