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 for Programming
 LabTalk Forum
 Loop operation becomes very slow after a while
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

wang.plasma@gmail.com

Japan
2 Posts

Posted - 09/13/2020 :  9:37:13 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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"
}



cpyang

USA
1406 Posts

Posted - 09/13/2020 :  10:22:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

wang.plasma@gmail.com

Japan
2 Posts

Posted - 09/15/2020 :  01:01:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

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


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