double y = function.value(jd);
ValidObservation fitOb = new ValidObservation();
fitOb.setDateInfo(new DateInfo(jd));
fitOb.setMagnitude(new Magnitude(y, 0));
fitOb.setBand(SeriesType.Model);
fitOb.setComments(comment);
fit.add(fitOb);
ValidObservation resOb = new ValidObservation();
resOb.setDateInfo(new DateInfo(jd));
double residual = mag - y;
resOb.setMagnitude(new Magnitude(residual, 0));
resOb.setBand(SeriesType.Residuals);
resOb.setComments(comment);
residuals.add(resOb);
sumSqResiduals += (residual * residual);