diff --git a/include/mcc/mcc_pcm_fit.h b/include/mcc/mcc_pcm_fit.h index 499c276..5f96149 100644 --- a/include/mcc/mcc_pcm_fit.h +++ b/include/mcc/mcc_pcm_fit.h @@ -394,7 +394,7 @@ protected: // full knot vectors: [t_min, t_min, t_min, t_min, ..., t_1, t_2, ..., t_max, t_max, t_max, t_max] std::vector tx(pcm_data.bspline.knotsX.size() + 6), ty(pcm_data.bspline.knotsY.size() + 6); - std::vector&theta_hw = _hwY, &theta_tag = _targetCOLAT, &phi_hw = _hwX, &phi_tag = _targetCOLON; + std::vector*theta_hw = &_hwY, *theta_tag = &_targetCOLAT, *phi_hw = &_hwX, *phi_tag = &_targetCOLON; std::vector theta, phi; // full set of B-spline knots @@ -432,8 +432,8 @@ protected: theta[i] = _hwY[i] + MCC_HALF_PI; phi[i] = _hwX[i] + std::numbers::pi; } - theta_hw = theta; - phi_hw = phi; + theta_hw = θ + phi_hw = φ for (size_t i = 0; i < tx.size(); ++i) { tx[i] += std::numbers::pi; @@ -452,24 +452,24 @@ protected: // direct (celestial = encoder + pcm) result.bspline_fit_err[0] = - bsplines::fitpack_sphere_fit(theta_hw, phi_hw, _colonRES, 1.0, ty, tx, pcm_data.bspline.coeffsX, resi2x); + bsplines::fitpack_sphere_fit(*theta_hw, *phi_hw, _colonRES, 1.0, ty, tx, pcm_data.bspline.coeffsX, resi2x); if (result.bspline_fit_err[0] > 0) { result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT; return result; } result.bspline_fit_err[1] = - bsplines::fitpack_sphere_fit(theta_hw, phi_hw, _colatRES, 1.0, ty, tx, pcm_data.bspline.coeffsY, resi2y); + bsplines::fitpack_sphere_fit(*theta_hw, *phi_hw, _colatRES, 1.0, ty, tx, pcm_data.bspline.coeffsY, resi2y); if (result.bspline_fit_err[1] > 0) { result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT; return result; } - bsplines::fitpack_eval_spl2d(ty, tx, pcm_data.bspline.coeffsX, theta_hw, phi_hw, + bsplines::fitpack_eval_spl2d(ty, tx, pcm_data.bspline.coeffsX, *theta_hw, *phi_hw, result.model_colonRES); // get fitted residuals!!! - bsplines::fitpack_eval_spl2d(ty, tx, pcm_data.bspline.coeffsY, theta_hw, phi_hw, + bsplines::fitpack_eval_spl2d(ty, tx, pcm_data.bspline.coeffsY, *theta_hw, *phi_hw, result.model_colatRES); // get fitted residuals!!! result.colon_err.resize(numberOfPoints()); @@ -488,8 +488,8 @@ protected: // inverse (encoder = celestial + pcm) if constexpr (std::same_as) { - theta_tag = theta; - phi_tag = phi; + theta_tag = θ + phi_tag = φ } std::vector colon_res = _colonRES; @@ -499,29 +499,29 @@ protected: colat_res[i] = -colat_res[i]; if constexpr (std::same_as) { - theta_tag[i] = _targetCOLAT[i] + MCC_HALF_PI; - phi_tag[i] = _targetCOLON[i] + std::numbers::pi; + (*theta_tag)[i] = _targetCOLAT[i] + MCC_HALF_PI; + (*phi_tag)[i] = _targetCOLON[i] + std::numbers::pi; } } - result.bspline_fit_err[2] = bsplines::fitpack_sphere_fit(theta_tag, phi_tag, colon_res, 1.0, ty, tx, + result.bspline_fit_err[2] = bsplines::fitpack_sphere_fit(*theta_tag, *phi_tag, colon_res, 1.0, ty, tx, pcm_data.bspline.inverseCoeffsX, resi2x); if (result.bspline_fit_err[2] > 0) { result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT; return result; } - result.bspline_fit_err[3] = bsplines::fitpack_sphere_fit(theta_tag, phi_tag, colat_res, 1.0, ty, tx, + result.bspline_fit_err[3] = bsplines::fitpack_sphere_fit(*theta_tag, *phi_tag, colat_res, 1.0, ty, tx, pcm_data.bspline.inverseCoeffsY, resi2y); if (result.bspline_fit_err[3] > 0) { result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT; return result; } - bsplines::fitpack_eval_spl2d(ty, tx, pcm_data.bspline.inverseCoeffsX, theta_tag, phi_tag, + bsplines::fitpack_eval_spl2d(ty, tx, pcm_data.bspline.inverseCoeffsX, *theta_tag, *phi_tag, result.inv_model_colonRES); // get fitted residuals!!! - bsplines::fitpack_eval_spl2d(ty, tx, pcm_data.bspline.inverseCoeffsY, theta_tag, phi_tag, + bsplines::fitpack_eval_spl2d(ty, tx, pcm_data.bspline.inverseCoeffsY, *theta_tag, *phi_tag, result.inv_model_colatRES); // get fitted residuals!!! result.inv_colon_err.resize(numberOfPoints()); diff --git a/tests/mcc_pcm_z1000_test.cpp b/tests/mcc_pcm_z1000_test.cpp index c66cd2c..f63e046 100644 --- a/tests/mcc_pcm_z1000_test.cpp +++ b/tests/mcc_pcm_z1000_test.cpp @@ -138,7 +138,7 @@ int main(int narg, char* argv[]) fit_pcm_data.type = MccDefaultPCMType::PCM_TYPE_BSPLINE; - r = pcm_cstr.computeModel(fit_pcm_data); + // r = pcm_cstr.computeModel(fit_pcm_data); fr = pcm_fitter.computeModel(fit_pcm_data); // if (r.error) { @@ -150,6 +150,8 @@ int main(int narg, char* argv[]) std::println("error: {}", fr.error.message()); std::println("b-spline error: {}", fr.bspline_fit_err); return 1; + } else { + std::println("b-spline fit exit code: {}", fr.bspline_fit_err); } std::println("\n\n{:*^40}\n", " FITTED DIFFS ");