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
 All Forums
 Origin Forum
 Origin Forum
 before script Skip issue

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
zknauss Posted - 02/14/2023 : 11:55:20 AM
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
5   L A T E S T    R E P L I E S    (Newest First)
zknauss Posted - 02/15/2023 : 2:24:50 PM
That worked perfectly thank you!

ZTK
YimingChen Posted - 02/15/2023 : 1:39:40 PM
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
zknauss Posted - 02/15/2023 : 10:19:55 AM
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
zknauss Posted - 02/15/2023 : 10:10:21 AM
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
Shirley_GZ Posted - 02/15/2023 : 04:43:34 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000