Author |
Topic  |
|
bodya67
Russia
6 Posts |
Posted - 07/25/2019 : 07:55:56 AM
|
Origin Ver.: OriginPro 2019b Operating System: Windows 10 Hello, I would like to ask a question.
I use the X - function (pa) in the loop, but I need to set the peak position. For this, I use smode: = 1, but the cycle continues to run, preventing me from finishing, and since the report is not generated, it gives an error. How can I get around this problem? For example, using the nlfitpeaks function, you can set useqp: = 0, which allows you to select the peak positions and everything works. But for pa, I did not find anything like it. I use this code: [Main]
n=1; for (int s_num_1 = 3; s_num_1 <= 3; s_num_1++) { for (int s_num_2 = 1; s_num_2 <= 5; s_num_2++) { s1$ = $(s_num_1)$(s_num_2 ); s$ = "Sample"+s1$; newbook; fname$ = "C:\Users\Admin\Desktop\Excel processed\" + s$ + ".xls"; impExcel; col(1)[L]$ = RamanShift; col(2)[L]$ = Intensity; col(1)[U]$ = (1/cm);
pa iy:=(1,2) smode:=1 theme:=BWF_analisis;
x_G = cell(1,3); y_G = cell(1,4); x_D = cell(2,3); y_D = cell(2,4);
window -a Graph1; expGraph type:=jpg path:="D:\origin\Graphs1" filename:=s$;
window -a Book1; col(1)[L]$ = Number; col(2)[L]$ = x_D; col(3)[L]$ = y_D; col(4)[L]$ = x_G; col(5)[L]$ = y_G; col(6)[L]$ = y_D/y_G;
cell(n,1)$ = Sample_$(s_num_1)_$(s_num_2); cell(n,2) = x_D; cell(n,3) = y_D; cell(n,4) = x_G; cell(n,5) = y_G; cell(n,6) = y_D/y_G; n++; window -cw Graph*; window -cw Sample*; } }
} }
|
|
YimingChen
1666 Posts |
Posted - 07/25/2019 : 5:00:10 PM
|
Hi,
Can we know where the peak positions info from? Are they different for different dataset? Do you want to 1) set it manually for each dataset 2) load the position from a external file or 3) read it from worksheet with each dataset?
Would you mind sharing with us your data files as well as the peak position info that we can check further? Please send it to <tech@originlab.com>.
Thank you
James |
Edited by - YimingChen on 07/25/2019 5:01:00 PM |
 |
|
bodya67
Russia
6 Posts |
Posted - 07/25/2019 : 6:25:15 PM
|
I myself set the peak positions, based on the type of the original spectrum, for each data set they are different. Unfortunately, I can't send you the files because this is my research and I can't disclose the data
|
Edited by - bodya67 on 07/25/2019 6:27:36 PM |
 |
|
minimax
357 Posts |
Posted - 07/26/2019 : 03:22:46 AM
|
quote: I myself set the peak positions, based on the type of the original spectrum
Hi bodya67, Do you mean that the position is not predefined anywhere, and you need interactive operation same as nlfitpeaks to manually select from the graph for each dataset?
If this is true, a. it cannot be in a silent loop since you need manual mouse click every time? b. nlfitpeaks should already work well? Why needs to use pa instead? You still need to fit with baseline? |
 |
|
bodya67
Russia
6 Posts |
Posted - 07/26/2019 : 10:47:44 AM
|
Hi minimax, that's right, I need to click for each graphic. I can’t use nlfitpeaks because this function allows setting only 1 type of fitting function for both peaks, and I need to set 2 peaks with different fitting functions. Perhaps this can be done using another function, but I found that it can be done using the pa function, and I do not know other ways. |
 |
|
bodya67
Russia
6 Posts |
Posted - 07/26/2019 : 11:02:40 AM
|
Examples of fitting for the same original spectrum using two peaks of the same function and two different functions for each peak, respectively.

 |
 |
|
minimax
357 Posts |
Posted - 07/29/2019 : 02:09:46 AM
|
Hi bodya67,
Unfortunately pa does not support manually pick points in the loop, we will check if we could improve.
But at the same time, have you ever tried all the methods under Peak Finding Settings branch?
From the screenshot of your plot, it seems that the peak position is not complicated, so we suppose one of the methods we provide may be able to find the peaks correctly.
In other words, you do not have to pick it by mouse? |
 |
|
bodya67
Russia
6 Posts |
Posted - 07/30/2019 : 03:55:20 AM
|
I tried to select all methods and, usually, when it automatically searches for peaks, the left peak, which is set by the Lorentz function, is obtained too low, approximately, as in the pictures  |
 |
|
minimax
357 Posts |
Posted - 08/01/2019 : 02:50:31 AM
|
Hi bodya67,
Your screenshot just showed a result of fitting, but cannot tell the initial peak position from find peak step.
In another word, it cannot tell if the find peak result is not good or not.
On the other hand, fitting process will certainly shift all the values (center, width, height).
To restrict the shift distance, you may add bounds, on dialog Find Peaks page - Peak Fitting Bounds.
You can also tweak the bounds on Fit Peaks page - Fit Control button - Bounds tab and Fit Control tab's Constraints. |
 |
|
|
Topic  |
|
|
|