String comment = "From polynomial fit of degree " + degree;
for (n = 1; n <= numred; n++) {
// write(1,222)tfit(n)+dt0,xfit(n),ds9*sfit(n)
ValidObservation fitOb = new ValidObservation();
fitOb.setDateInfo(new DateInfo(tfit[n] + dt0));
// double uncertainty = ds9*sfit[n]; // TODO: ask Matt about this;
// uncertainty?
fitOb.setMagnitude(new Magnitude(xfit[n], 0));
fitOb.setComments(comment);
fitOb.setBand(SeriesType.Model);
fit.add(fitOb);
}
if (fit.isEmpty()) {
throw new AlgorithmError("No observations in fit list.");
}
// Note: save residuals (to list)
// 40 write(6,*) 'Residuals filename?'
// read*,ftmp;
// 41 open(unit=9,file=ftmp,status='unknown',err=42);
// 42 write(6,*) 'Could not open file.'
// Store the residuals resulting from the polynomial fit operation as
// "residual observations".
residuals = new ArrayList<ValidObservation>();
for (n = nlolim; n <= nuplim; n++) {
if (wvec[n] > 0.0) {
dtime = tvec[n];
dx = smooth(dtime);
res = xvec[n] - dx;
for (nb = 1; nb <= nbias; nb++) {
if (obs[n] == obias[nb])
res = res - dcoef[npoly + nb];
}
// write(9,240) tvec(n)+dt0,res
ValidObservation residualOb = new ValidObservation();
residualOb.setDateInfo(new DateInfo(tvec[n] + dt0));
residualOb.setMagnitude(new Magnitude(res, 0));
residualOb.setComments(comment);
residualOb.setBand(SeriesType.Residuals);
residuals.add(residualOb);
}