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 for Programming
 LabTalk Forum
 Loop operation becomes very slow after a while

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
wang.plasma@gmail.com Posted - 09/13/2020 : 9:37:13 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2020b
Operating System:Win10

Hi,

I got a problem when using loop operation for my interpolation. Here are details:

I want to do the interpolation to a series of files named **P****.txt. One loop for ** and another for ****. The loop itself works as expected, but the speed becomes slower after a while.

For example, 46 files are done in the 1st minite, but 36 for the 2nd miniute, 30 for the 3rd, 24 for the 4th, ... Finally it becomes very slow. I have totally 8000 files to deal with, thus now I have to restart the script again after a few minutes.

I guess this happens due to large histroy data (used for undo), but not sure. In the script I clean imported data in every loop thus the work space may not the problem. Following are my script:

[Main]
newbook Interpolation;
newsheet name:="RZ_mesh";

%W="C:\Users\wangp\OneDrive\_DOCUMENT\OriginLab\Project\P3D\"; // set Working Directory
%I="C:\Users\wangp\OneDrive\_DOCUMENT\OriginLab\Project\P3D\ori_data\"; // set Input Directory
%O="C:\Users\wangp\OneDrive\_DOCUMENT\OriginLab\Project\P3D\result\"; // set Output Directory

string i0$ = "RZ_mesh.txt"; // set input file name for R-Z mesh
impasc fname:="%W"+i0$ options.impmode:=4; // import RZ mesh file
page.active = 1; // active sheet 1 (data in flux-like co-or)

loop (time, 1010, 1015)
{
loop (m_count, 1, 48)
{
int mode = m_count*1;
string o1$ = "%O"+"$(mode, #2)"+"P"+"$(time, #4)"+".dat";
impasc fname:= "%I"+"$(mode, #2)"+"P"+"$(time, #4)"+".txt" options.FirstMode:=0; // import flux-like data files

wks.name$ = raw_data;
interp2 ixy:="RZ_mesh"!(A,B) ir:="raw_data"!(A,B,C) oz:="RZ_mesh"!(RESULT) method:=rc; // interpolation using nearest

expASC iw:=RZ_mesh type:=0 path:=o1$ separator:=TAB missing:=0 comment:=0 longname:=0 overwrite:=0; // output
page.active = 1;
}
save %Ymyfile; //save the current project to UFF entitled "myfilename"
}



2   L A T E S T    R E P L I E S    (Newest First)
wang.plasma@gmail.com Posted - 09/15/2020 : 01:01:27 AM

Hi Cpyang,

Thanks for your suggestion.

I didn't test the method using connector, but another solution
from the support team works well. That is, to add options with
options.Sparklines:=0; When sparkline is turned off, the speed
becomes doubled and not drop too much.

However, thanks a lot for the help.
Sincerely,
Wang


quote:
Originally posted by cpyang

I think using CSV connector instead of impasc will be faster.

As for possible impact due to Undo which impasc may have, set @UN=0

CP


cpyang Posted - 09/13/2020 : 10:22:18 PM
I think using CSV connector instead of impasc will be faster.

As for possible impact due to Undo which impasc may have, set @UN=0

CP

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