This commit is contained in:
2026-03-24 02:43:17 +03:00
parent 7d327a3276
commit 0182844af6
5 changed files with 132 additions and 16 deletions

View File

@@ -179,7 +179,8 @@ public:
template <norm_kind_t KIND>
MccAngle& normalize()
{
_angleInRads = std::fmod(_angleInRads, std::numbers::pi * 2.0);
// _angleInRads = std::fmod(_angleInRads, std::numbers::pi * 2.0);
_angleInRads = std::fmod(_angleInRads, MCC_TWO_PI);
if constexpr (KIND == NORM_KIND_0_360) {
if (_angleInRads < 0.0) {
@@ -195,7 +196,8 @@ public:
} else if constexpr (KIND == NORM_KIND_180_180) {
if (_angleInRads > std::numbers::pi) {
// _angleInRads = 2.0 * std::numbers::pi - _angleInRads;
_angleInRads = MCC_TWO_PI - _angleInRads;
// _angleInRads = MCC_TWO_PI - _angleInRads;
_angleInRads = _angleInRads - MCC_TWO_PI;
} else if (_angleInRads < -std::numbers::pi) {
// _angleInRads += 2.0 * std::numbers::pi;
_angleInRads += MCC_TWO_PI;

View File

@@ -148,8 +148,8 @@ public:
// alt-azimuthal
coeff_t tubeFlexure;
coeff_t forkFlexure;
coeff_t DECaxisFlexure; // declination axis flexure
coeff_t forkFlexure;
};
#ifdef USE_BSPLINE_PCM

View File

@@ -138,7 +138,7 @@ public:
};
MccError addPoint(mcc_skypoint_c auto target_coords, mcc_coord_pair_c auto const& hw_counts)
requires(decltype(hw_counts)::pairKind == MccCoordPairKind::COORDS_KIND_XY)
requires(std::decay_t<decltype(hw_counts)>::pairKind == MccCoordPairKind::COORDS_KIND_XY)
{
auto err = target_coords.to(ref_coordpair_t::pairKind, hw_counts.epoch());
if (err) {
@@ -232,7 +232,7 @@ public:
min_data_size = 8;
}
if (_table.size() < min_data_size) {
if (numberOfPoints() < min_data_size) {
result.error = MccDefaultPCMConstructorErrorCode::ERROR_NOT_ENOUGH_DATA;
return result;
}
@@ -240,7 +240,7 @@ public:
// robust linear regression with Tukey's loss function
result = robustLinearRegress(pcm_data, comp_params);
} else {
if (_table.size() < min_data_size) {
if (numberOfPoints() < min_data_size) {
result.error = MccDefaultPCMConstructorErrorCode::ERROR_NOT_ENOUGH_DATA;
return result;
}
@@ -256,8 +256,8 @@ public:
std::vector<double> xres = _table.colon_res, yres = _table.colat_res;
for (size_t i = 0; i < numberOfPoints(); ++i) {
_table.colon_res = _table.target_colon[i] - result.model_colon;
_table.colat_res = _table.target_colat[i] - result.model_colat;
_table.colon_res[i] = _table.target_colon[i] - result.model_colon[i];
_table.colat_res[i] = _table.target_colat[i] - result.model_colat[i];
}
auto r = bsplineFitting(pcm_data);
@@ -266,11 +266,11 @@ public:
if (!r.error) {
for (size_t i = 0; i < numberOfPoints(); ++i) {
result.model_colon += r.model_colon;
result.model_colat += r.model_colat;
result.model_colon[i] += r.model_colon[i];
result.model_colat[i] += r.model_colat[i];
result.colon_res = _table.target_colon[i] - result.model_colon;
result.colat_res = _table.target_colat[i] - result.model_colat;
result.colon_res[i] = _table.target_colon[i] - result.model_colon[i];
result.colat_res[i] = _table.target_colat[i] - result.model_colat[i];
}
}
@@ -424,11 +424,9 @@ protected:
1.0E-8;
};
compute_result_t result{.pcm_type = pcm_data.type,
.error = MccDefaultPCMConstructorErrorCode::ERROR_OK,
.max_iter = comp_params.max_iter};
compute_result_t result{.pcm_type = pcm_data.type, .error = MccDefaultPCMConstructorErrorCode::ERROR_OK};
const size_t n_coeffs = pcm_data.type == MOUNT_TYPE == MccMountType::FORK_TYPE ? 9 : 8;
const size_t n_coeffs = MOUNT_TYPE == MccMountType::FORK_TYPE ? 9 : 8;
Eigen::MatrixXd X(2 * numberOfPoints(), n_coeffs);
Eigen::VectorXd y(2 * numberOfPoints()), beta(n_coeffs), new_beta(n_coeffs);