Author |
Topic |
|
optics1w
6 Posts |
Posted - 11/08/2011 : 11:38:44 PM
|
Origin Ver. and Service Release (Select Help-->About Origin): V8.0891 Operating System:Windows XP sp3
Hi Everyone! Help me Please
I have three OGS files (Used for Origin V6.1)
Origin V6.1: This files operates Origin V8.0: These files are not going to operate
(first file)
[OpenFiles] //////////////////////////////////// %H!wks.colwidth=10; %H!wks.col2.digitMode=1; %H!wks.col2.digits=8; /////////////////////////////////// Menu id=34050; run.section(,Init); FDLOG.UseGroup(Ascii); FDLOG.OptionDLG$="ImpASCII"; if (exist(%H)==2); FDLOG.checkname$=$DialogBox.PartialImport; FDLOG.DlgName$=$DialogBox.ImportTitle; if(FDLOG.Open(A)) return 1; %B=FDLOG.path$; if (exist(%H)==2) wks.import.partial=FDLOG.checkstatus; Open -w %B%A; set %H -ue; //return 0; // //Menu id=34050; //run.section(FILE,ImportAscii); %K=%H; /////////////////////////////
//////////////////////////// Menu id=34006; run.section(Standard,NewWks);
wks.colwidth=10; %H!wks.col2.digitMode=1; %H!wks.col2.digits=8;
Menu id=34050; run.section(FILE,ImportAscii); %L=%H; ////////////////////////////
//////////////////////////// Menu id=34006; run.section(Standard,NewWks);
wks.colwidth=10; %H!wks.col2.digitMode=1; %H!wks.col2.digits=8;
Menu id=34050; run.section(FILE,ImportAscii); %M=%H; ///////////////////////////
/////////////////////////// Menu id=34006; run.section(Standard,NewWks);
wks.colwidth=10; %H!wks.col2.digitMode=1; %H!wks.col2.digits=8;
Menu id=34050; run.section(FILE,ImportAscii); %N=%H; //////////////////////////
[Test] %A = System.Wks.DefTemplate$; win -T Data "%A";
(second file)
[AveragePlotting] %A = System.Wks.DefTemplate$; win -T Data "%A";
wks.colwidth=12; wks.col2.digitMode=1; wks.col2.digits=9; %O=%H; %O_A=%K_A; %O_B=(%K_B+%L_B+%M_B+%N_B)/4.0 ;
%OMax=%O_B[51]; %OMax90Id=51; %OMax0_90=0.9*%OMax;
for(i=52;i<480;i++) { if( %O_B[i] > %OMax0_90 ){%OMax90Id = i;} };
%A = System.Wks.DefTemplate$; win -T Data "%A"; wks.colwidth=12; wks.col2.digitMode=1; wks.col2.digits=9; %P=%H; %PEndId=500-%OMax90Id; for(i=1;i<=%PEndId;i++){ %P_A[i]=%O_A[i+%OMax90Id]; %P_B[i]=%O_B[i+%OMax90Id]; }
// Selection Process Need !!! wks.colSel(1,1); wks.colSel(2,1);
Menu id=33249; run.section(Plot,Line);
//Menu id=34165; //run.section(Fit,ExpDecay1);
(third file)
[Nonlinear Curve Fitting]
//////////////////////////////////////
[Fitting] nlsf.v1=1; nlsf.v2=1; nlsf.v3=1; Menu id=34165; run.section(Fit,ExpDecay1);
nlsf.v1=1; nlsf.v2=1; nlsf.v3=1; //Menu id=36085; //nlsf.control(); nlsf.begin(); nlsf.chkConstr(); nlsf.iterate(10); nlsf.fit(10); nlsf.make(); nlsf.end(); //nlsf.control(close);
/*
%q=nlsf.p1; %r=nlsf.p2; %s=nlsf.p3; saveredirection=type.redirection(16,3); type.beginresults(); type $regression.shortparaheader1; separator 3; type "y0\t$(%q)\t$(nlsf.e1)"; type "A1\t$(%r)\t$(nlsf.e2)"; type "t1\t$(%s)\t$(nlsf.e3)"; separator 3; type.endresults(); type.redirection=saveredirection; delete -v saveredirection; return 0; */ ////////////////////////////////// //////////////////////////////////
[CheckData] /* check the dataset type */ if(%C=="") { type -b $FIT.NoData; return 1; }
/// check plot type
if (exist(%H)==2) worksheet -p 200;
get %C -pt plottype; if( plottype == 231 ) /// plot type is error bar { type -b $FIT.ErrorBar; return 1; }
if( plottype == 232 ) /// plot type is text { type -b $FIT.TextData; return 1; } /// plot type ok, might still have other consideration later
///RKM 5/18/99 ADD_ERROR_BAR_WEIGHTING %B=errof(%C); if (exist(%B)==1) { nlsf.wType=1; nlsf.w$=%B; nlsf.chisqrerr=0; //Don't Scale Errors with Standard Deviation } else { nlsf.wType=0; nlsf.w$=""; nlsf.chisqrerr=1; //Scale Errors with Standard Deviation }
return 0;
[EXPDECAY1] /* Exponential decay 1 */ /* -------------------------------------------------------------*/ /*Fit y0+A1*e^(-(x-x0)/t1) to %C */ /// HYYU check the type for fitting if( run.section(,CheckData) ) return 1; /// end HYYU check data type
nlsf.func$=ExpDec1;
run.section(,KineticInit,0.05);
/// ML v4.12 7/22/96 B874 ENABLE_NEGATIVE_COEFFICIENTS // to enable something like: 80 - 40 * exp(-x/40) if ( t1 < 0 ) { t1 = -t1; A1 = -A1; y0 = limit.ymax; } /// end B874 ENABLE_NEGATIVE_COEFFICIENTS
if(run.section(,AutoNLSF)==1) return 1; /* queue changed to type t1 instead of t */ /* this will now be consistant with manuals */ /* Modified 4/28/94 by JMP Keyword tt1 */ queue { SaveRedirection=type.Redirection(16,3); // SDB 1/7/99 REPORT_TO_OUTPUTLOG type.BeginResults(); /// RKM 12/10/98 v6.0141 REPORT_TO_OUTPUTLOG type $Fit.Expdecay1function; ///RKM 5/18/99 ADD_ERROR_BAR_WEIGHTING %B=errof(%C); if (exist(%B)==1) type $regression.UsingWeight; type; type $fit.Chisqr; type $fit.Rsquare; type; type $Regression.ShortParaHeader1; Separator 3; type "y0\t$(y0)\t$(nlsf.e1)"; type "A1\t$(A1)\t$(nlsf.e2)"; type "t1\t$(t1)\t$(nlsf.e3)"; Separator 3; type.EndResults(); type.Redirection=SaveRedirection; // restore previous redirection. delete -v SaveRedirection; }; return 0;
////////////////////////////////////////////////////////////////////////////////////////
////////
////////////////////////////////////////////////////////////////////////////////////////
////////
////////////////////////////////////////////////////////////////////////////////////////
////////
[AutoNLSF] ii=nlsf.tolerance; nlsf.tolerance=.0005; /// SDB 7/7/20 INIT_XBEGIN_XEND nlsf.xBegin = 0/0; nlsf.xEnd = 0/0; nlsf.cleanupfitdata(); nlsf.fitdata$=%C; if(nlsf.iterate(1)==-1) return 1; nlsf.iterate(2); nlsf.iterate(3); if(nlsf.datastep > 4) { nlsf.datastep/=2; nlsf.iterate(1); nlsf.iterate(2); } if(nlsf.datastep > 1) { nlsf.datastep=1; nlsf.iterate(2); } nlsf.iterate(50); //nlsf.pasteToPlot=0; nlsf.end(8); //nlsf.pasteToPlot=1; //nlsf.end(); legend; nlsf.tolerance=ii; return 0;
////////////////////////////////////////////////////////////////////////////////////////
//////// ////////////////////////////////////////////////////////////////////////////////////////
////////
[KineticInit] /* CPY v3.53 changed to add %1 argument */
limit %C; /* find max/min in both X and Y for the data */
run.section(,SetXYoffset,%1); /* set y0 and x0 based on limit.### * will set y0 or x0 to zero if * they are close to zero */
/* next we need to find the time constant(t1) and amplitude (A1) */ del dummy;/* incase it was not deleted from other parts */
copy -s 20 %C dummy; /* we interpolate the data with 20 points and put into * a temporary data set called dummy */
// set dummy -f 0; /* this remove any possible offset in x */ dummy-y0; /* also remove y offset */ dummy = ln(dummy); /*LR -B dummy; linear regression on the beginning changed to simple LR, CPY v3.493 */ LR -N dummy; #! copy dummy test_B;LR.B=;LR.A=;
del dummy; /* we are interested only in the parameters */
t1=-1/LR.B;t1=$(t1,*3); A1=exp(LR.A);A1=$(A1,*3); /* limit them to 3 sig digits */
if(y0==0) pv1=0; /* hold y0 if it is zero */ A2=0;A3=0; /* to disable the other two exponentials */ nlsf.msgprompt=2; /* No_dependency_msg Cao 5/5/94*/
return 0;
/////////////////////////////// //////////////////////////////
[SetXYoffset] /* this macro is used in initializing various * fitting functions * The parameters in limit.??? is assumed * set x0, y0 accordingly */
/* CPY v3.53 add argument */ minoffset = %1; /* consider zero offset if 5% from zero */ x0 = limit.xmin; if(abs(x0/(limit.xmax-x0)) < minoffset) x0 = 0; y0 = limit.ymin; if(abs(y0/(limit.ymax-y0)) < minoffset) y0 = 0; del -v minoffset; #!x0=; #!y0=;
////////////////////////////////////
|
|
Laurie
USA
404 Posts |
Posted - 11/09/2011 : 1:43:43 PM
|
Hi,
I only looked at the script for the first OGS file. I discovered that it will run just fine in version 8 if you comment out each "menu id" line. These lines were never needed, and in Origin 8 they cause the script to stop. With these lines removed your script will run just fine.
Laurie
OriginLab Technical Support |
|
|
optics1w
6 Posts |
Posted - 11/10/2011 : 10:45:22 PM
|
Thank you very much! Laurie
All "menu id"line Delete All the files will work. |
|
|
|
Topic |
|
|
|