Hello,
I am attempting to write a script that will batch through all of the layers in a plot window and fit a user selected data range with a user-defined fitting function. I've gotten that to work, for the most part. However, for some reason, the preview line that allows the user to see their fit progress in real time only displays on the first layer of the plot window, regardless of the layer being fitted on. The data markers seem to be selecting the right data set, and the fit line preview appears to be fitting the right data set as well, but it isn't being shown on the same layer as the active one.
Since this particular operation typically involves 50+ data sets, the plot window is set to display only the active page layer.
This is not something that occurs when using the NLFit dialog from the menu, so I'm leaning towards it being the fault of my script.
Here is the relevant portion of the script:
//clear all data markers in plot
doc -e LW{mks1=-1;}
plot -c;
//define integer to be iterated in doc -e loop
int nn = 1;
//define datasets to store fit parameters
dataset alpha, gamma, tauHN, deps, temps;
doc -e LW
{
plot -c;
//prompt the user to see if the layer in question can be fitted
type -y "Do you want to fit this plot?";
if(t == 1)
{
range -w aa=%C;
// wks range for the sheet the column belongs to
range ss = uid2range(aa.GetLayer())$;
// show sheet name
dname$ = ss.name$;
dname2$ = dname.Between("_","K")$;
//extract temperature from the sheet name
temp = %(dname2$);
// Start range selector
dotool 4;
// Define macro that runs when user is done
def pointproc
{
done = 1;
dotool 0;
}
// Wait in a loop for user to finish by pressing ...
// (1) Enter key or (2) double-clicking
for( done = 0 ; done == 0 ; )
{
sec -p .1;
}
//start fitting session with parameter initialization
nlbegin func:=HN_EpsImaginary nltree:=ParamTree;
ParamTree.tauHN = .0005;
ParamTree.alpha = 1;
ParamTree.gamma = 1;
ParamTree.sigma_0 = 0;
ParamTree.f_sigma_0=1;
//allow the user to run the fit to completion
nlpara 1;
nlend;
//store fit parameters as the next element in each dataset
temps[$(nn)] = temp;
alpha[$(nn)] = ParamTree.alpha;
gamma[$(nn)] = ParamTree.gamma;
deps[$(nn)] = ParamTree.deps;
tauHN[$(nn)] = ParamTree.tauHN;
//delete marker for this fit
mks1=-1;
//iterate the indexing variable
nn = nn+1;
}
}
Thanks,
zvicars
Origin Pro 2015 Sr. 2
Windows 7