The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 before script Skip issue
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

zknauss

USA
72 Posts

Posted - 02/14/2023 :  11:55:20 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,
I am using the below code to run batch peak detection with a before script fft_filter to skip data which has no peaks and place zeros in the output file. The issue I am running into is that the code seems to skip and not place the zeros if the first set of data is does not pass the filter (has zero peaks). The code only seems to function properly if there has been peaks previously found on one of the data sets.

An example:
column 1-2 have no peaks they will be absent from the generated report sheet
column 3 has peaks the data will be displayed correctly.
Column 4 four has no peaks and is entered correctly as zeros

The issue is I need columns 1 and 2 to have zeros entered.
I have underlined the section of the code I believe the error is in.

Thanks,

Zack


pe_cd path:="/"; pe_cd path:="/25MIN CONTROL/NEUO/";
paMultiY
iy:=[NCONROIData]N_CON_Peaks!(1"Time",2:10)[x0:300]
theme:="Peak_Analysis -2-"
append:=peak_centers
ow:=[NCONT1ROI]1!
dataid:="Long Name"
beforescript:=<[<dataset dr; fft_filters
iy:=_ry filter:=high
oy:=dr;
stats dr;
double nSD = stats.sd;
stats _ry; double sSD = stats.sd;
if(nSD^2/sSD^2>.5) { _skip=1; int nn = [NCONT1ROI]1!wks.col1.nrows; [NCONT1ROI]1!wks.col1.nrows = nn + 2;
[NCONT1ROI]1!Cell(nn+1, 1)$ = _ry.lname$;
[NCONT1ROI]1!Cell(nn+2, 1)$ = _ry.lname$;
[NCONT1ROI]1!Cell(nn+1, 2) = 0;
[NCONT1ROI]1!Cell(nn+2, 2) = 0;

} else _skip=0; >]>;

ZTK

Shirley_GZ

China
Posts

Posted - 02/15/2023 :  04:43:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Zack,

Please try to exchange the data in col(2) and col(4), then run the script again.

We suspect that there is some peculiar small peak in col(2) that caused the incorrect output from the script run。

Thanks,
Shriley

Originlab Technical Service Team
Go to Top of Page

zknauss

USA
72 Posts

Posted - 02/15/2023 :  10:10:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So I've run several different organizations of data and got the following results:

- no data will be reported until there is at least one data set with peaks this seems to be independent of which data sets are used (Image1/2). further there is an error in the script reported (Image 3)

-If the first set of data does contain peaks it runs without issue (Image 4)

This is a problem because we'd like to use multiple instances so if an instance starts on a zero peak data set it behaves in the same way resulting in a massive loss of data that causes major failures later in the analysis.
For reference Image 1 should start: 1, 2, 3,
Image 2: 1, 3,
Image 4: 3, 1, 2






ZTK

Edited by - zknauss on 02/15/2023 10:13:05 AM
Go to Top of Page

zknauss

USA
72 Posts

Posted - 02/15/2023 :  10:19:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I've determined the error response is due to there being no col 3 initally in the new results sheet adding this col stops the error code but doesnt affect the issue of no data being output in those runs.

ZTK
Go to Top of Page

YimingChen

1596 Posts

Posted - 02/15/2023 :  1:39:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This is because the results are being appended starting from row one in the result sheet. You can make the following changes in the Batch PA dialog.


James
Go to Top of Page

zknauss

USA
72 Posts

Posted - 02/15/2023 :  2:24:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That worked perfectly thank you!

ZTK
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000