本文整理汇总了C++中ModelObject::SetZeroPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelObject::SetZeroPoint方法的具体用法?C++ ModelObject::SetZeroPoint怎么用?C++ ModelObject::SetZeroPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelObject
的用法示例。
在下文中一共展示了ModelObject::SetZeroPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
printf("PSF file \"%s\": %d data points\n", options.psfFileName.c_str(), nPixels_psf);
/* Set default end data row (if not specified) and check for reasonable values: */
startDataRow = 0;
endDataRow = nPixels_psf - 1;
xVals_psf = (double *)calloc( (size_t)nPixels_psf, sizeof(double) );
yVals_psf = (double *)calloc( (size_t)nPixels_psf, sizeof(double) );
if ( (xVals_psf == NULL) || (yVals_psf == NULL) ) {
fprintf(stderr, "\nFailure to allocate memory for PSF data!\n");
exit(-1);
}
nSavedRows = ReadDataFile(options.psfFileName, startDataRow, endDataRow,
xVals_psf, yVals_psf, NULL, NULL);
if (nSavedRows > nStoredDataVals) {
fprintf(stderr, "\nMore PSF rows saved (%d) than we allocated space for (%d)!\n",
nSavedRows, nPixels_psf);
exit(-1);
}
}
/* Set up the model object */
theModel = new ModelObject1d();
/* Add functions to the model object */
printf("Adding functions to model object...\n");
status = AddFunctions1d(theModel, functionList, FunctionBlockIndices);
if (status < 0) {
printf("*** WARNING: Failure in AddFunctions!\n\n");
exit(-1);
}
theModel->SetZeroPoint(options.zeroPoint);
// Set up parameter vector(s), now that we know how many total parameters
// there will be
nParamsTot = nFreeParams = theModel->GetNParams();
printf("\t%d total parameters\n", nParamsTot);
paramsVect = (double *) malloc(nParamsTot * sizeof(double));
for (int i = 0; i < nParamsTot; i++)
paramsVect[i] = parameterList[i];
paramErrs = (double *) malloc(nParamsTot * sizeof(double));
/* Add image data, errors, and mask to the model object */
// "true" = input yVals data are magnitudes, not intensities
theModel->AddDataVectors(nStoredDataVals, xVals, yVals, options.dataAreMagnitudes);
theModel->AddErrorVector1D(nStoredDataVals, yWeights, WEIGHTS_ARE_SIGMAS);
if (maskAllocated) {
status = theModel->AddMaskVector1D(nStoredDataVals, maskVals, options.maskFormat);
if (status < 0) {
fprintf(stderr, "*** ERROR: Failure in ModelObject::AddMaskVector1D!\n\n");
exit(-1);
}
}
// Add PSF vector, if present, and thereby enable convolution
if (options.psfPresent) {
status = theModel->AddPSFVector1D(nPixels_psf, xVals_psf, yVals_psf);
if (status < 0) {
fprintf(stderr, "*** ERROR: Failure in ModelObject::AddPSFVector1D!\n\n");
exit(-1);
}
}
theModel->FinalSetupForFitting(); // calls ApplyMask(), VetDataVector()
theModel->PrintDescription();