...
This commit is contained in:
@@ -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]
|
// 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<double> tx(pcm_data.bspline.knotsX.size() + 6), ty(pcm_data.bspline.knotsY.size() + 6);
|
std::vector<double> tx(pcm_data.bspline.knotsX.size() + 6), ty(pcm_data.bspline.knotsY.size() + 6);
|
||||||
|
|
||||||
std::vector<double>&theta_hw = _hwY, &theta_tag = _targetCOLAT, &phi_hw = _hwX, &phi_tag = _targetCOLON;
|
std::vector<double>*theta_hw = &_hwY, *theta_tag = &_targetCOLAT, *phi_hw = &_hwX, *phi_tag = &_targetCOLON;
|
||||||
std::vector<double> theta, phi;
|
std::vector<double> theta, phi;
|
||||||
|
|
||||||
// full set of B-spline knots
|
// full set of B-spline knots
|
||||||
@@ -432,8 +432,8 @@ protected:
|
|||||||
theta[i] = _hwY[i] + MCC_HALF_PI;
|
theta[i] = _hwY[i] + MCC_HALF_PI;
|
||||||
phi[i] = _hwX[i] + std::numbers::pi;
|
phi[i] = _hwX[i] + std::numbers::pi;
|
||||||
}
|
}
|
||||||
theta_hw = theta;
|
theta_hw = θ
|
||||||
phi_hw = phi;
|
phi_hw = φ
|
||||||
|
|
||||||
for (size_t i = 0; i < tx.size(); ++i) {
|
for (size_t i = 0; i < tx.size(); ++i) {
|
||||||
tx[i] += std::numbers::pi;
|
tx[i] += std::numbers::pi;
|
||||||
@@ -452,24 +452,24 @@ protected:
|
|||||||
|
|
||||||
// direct (celestial = encoder + pcm)
|
// direct (celestial = encoder + pcm)
|
||||||
result.bspline_fit_err[0] =
|
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) {
|
if (result.bspline_fit_err[0] > 0) {
|
||||||
result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT;
|
result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.bspline_fit_err[1] =
|
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) {
|
if (result.bspline_fit_err[1] > 0) {
|
||||||
result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT;
|
result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT;
|
||||||
return result;
|
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!!!
|
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.model_colatRES); // get fitted residuals!!!
|
||||||
|
|
||||||
result.colon_err.resize(numberOfPoints());
|
result.colon_err.resize(numberOfPoints());
|
||||||
@@ -488,8 +488,8 @@ protected:
|
|||||||
// inverse (encoder = celestial + pcm)
|
// inverse (encoder = celestial + pcm)
|
||||||
|
|
||||||
if constexpr (std::same_as<ref_coordpair_t, MccSkyHADEC_OBS>) {
|
if constexpr (std::same_as<ref_coordpair_t, MccSkyHADEC_OBS>) {
|
||||||
theta_tag = theta;
|
theta_tag = θ
|
||||||
phi_tag = phi;
|
phi_tag = φ
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> colon_res = _colonRES;
|
std::vector<double> colon_res = _colonRES;
|
||||||
@@ -499,29 +499,29 @@ protected:
|
|||||||
colat_res[i] = -colat_res[i];
|
colat_res[i] = -colat_res[i];
|
||||||
|
|
||||||
if constexpr (std::same_as<ref_coordpair_t, MccSkyHADEC_OBS>) {
|
if constexpr (std::same_as<ref_coordpair_t, MccSkyHADEC_OBS>) {
|
||||||
theta_tag[i] = _targetCOLAT[i] + MCC_HALF_PI;
|
(*theta_tag)[i] = _targetCOLAT[i] + MCC_HALF_PI;
|
||||||
phi_tag[i] = _targetCOLON[i] + std::numbers::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);
|
pcm_data.bspline.inverseCoeffsX, resi2x);
|
||||||
if (result.bspline_fit_err[2] > 0) {
|
if (result.bspline_fit_err[2] > 0) {
|
||||||
result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT;
|
result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT;
|
||||||
return result;
|
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);
|
pcm_data.bspline.inverseCoeffsY, resi2y);
|
||||||
if (result.bspline_fit_err[3] > 0) {
|
if (result.bspline_fit_err[3] > 0) {
|
||||||
result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT;
|
result.error = MccPCMFitterErrorCode::ERROR_BSPLINE_FIT;
|
||||||
return result;
|
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!!!
|
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_model_colatRES); // get fitted residuals!!!
|
||||||
|
|
||||||
result.inv_colon_err.resize(numberOfPoints());
|
result.inv_colon_err.resize(numberOfPoints());
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ int main(int narg, char* argv[])
|
|||||||
|
|
||||||
fit_pcm_data.type = MccDefaultPCMType::PCM_TYPE_BSPLINE;
|
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);
|
fr = pcm_fitter.computeModel(fit_pcm_data);
|
||||||
|
|
||||||
// if (r.error) {
|
// if (r.error) {
|
||||||
@@ -150,6 +150,8 @@ int main(int narg, char* argv[])
|
|||||||
std::println("error: {}", fr.error.message());
|
std::println("error: {}", fr.error.message());
|
||||||
std::println("b-spline error: {}", fr.bspline_fit_err);
|
std::println("b-spline error: {}", fr.bspline_fit_err);
|
||||||
return 1;
|
return 1;
|
||||||
|
} else {
|
||||||
|
std::println("b-spline fit exit code: {}", fr.bspline_fit_err);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::println("\n\n{:*^40}\n", " FITTED DIFFS ");
|
std::println("\n\n{:*^40}\n", " FITTED DIFFS ");
|
||||||
|
|||||||
Reference in New Issue
Block a user