fix: add fabs on the Jacobian

This commit is contained in:
2025-12-07 11:18:20 -05:00
parent 1819d58778
commit b00e652394

View File

@@ -26,7 +26,7 @@ double integrand_r(double *xy, size_t dim, void *integrand_params_void) {
double rgb[3] = {0}; double rgb[3] = {0};
double theta_phi[2] = {theta, phi}; double theta_phi[2] = {theta, phi};
integrand_params->system->angle_to_pixel(theta_phi, rgb); integrand_params->system->angle_to_pixel(theta_phi, rgb);
return rgb[0]*gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc); return rgb[0]*fabs(gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc));
} }
double integrand_g(double *xy, size_t dim, void *integrand_params_void) { double integrand_g(double *xy, size_t dim, void *integrand_params_void) {
@@ -38,7 +38,7 @@ double integrand_g(double *xy, size_t dim, void *integrand_params_void) {
double rgb[3] = {0}; double rgb[3] = {0};
double theta_phi[2] = {theta, phi}; double theta_phi[2] = {theta, phi};
integrand_params->system->angle_to_pixel(theta_phi, rgb); integrand_params->system->angle_to_pixel(theta_phi, rgb);
return rgb[1]*gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc); return rgb[1]*fabs(gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc));
} }
double integrand_b(double *xy, size_t dim, void *integrand_params_void) { double integrand_b(double *xy, size_t dim, void *integrand_params_void) {
@@ -50,7 +50,7 @@ double integrand_b(double *xy, size_t dim, void *integrand_params_void) {
double rgb[3] = {0}; double rgb[3] = {0};
double theta_phi[2] = {theta, phi}; double theta_phi[2] = {theta, phi};
integrand_params->system->angle_to_pixel(theta_phi, rgb); integrand_params->system->angle_to_pixel(theta_phi, rgb);
return rgb[2]*gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc); return rgb[2]*fabs(gsl_spline_eval_deriv(integrand_params->spline_data->spline, cotpsi, integrand_params->spline_data->acc));
} }
int MC_pixel_render(const System *system, int i, int j, const Spline_data spline_data, double *rgb, int pixel_render_max, double pixel_render_err, gsl_rng *r){ int MC_pixel_render(const System *system, int i, int j, const Spline_data spline_data, double *rgb, int pixel_render_max, double pixel_render_err, gsl_rng *r){