28 #define HDRL_USE_EXPERIMENTAL
38 #include "naco_strehl.h"
39 #include "naco_parameter.h"
41 #include "irplib_strehl.h"
43 #ifdef HDRL_USE_EXPERIMENTAL
81 const cpl_parameterlist * parlist,
82 const char * recipename,
98 cpl_errorstate cleanstate = cpl_errorstate_get();
106 #ifdef HDRL_USE_EXPERIMENTAL
107 hdrl_parameter * hdrl_param = NULL;
108 hdrl_strehl_result hdrl_strehl;
109 hdrl_image * hdrl_self = NULL;
111 hdrl_strehl.strehl_value.data = 0.0;
115 skip_if(irplib_strehl_compute(
self,
116 IRPLIB_STREHL_M1, IRPLIB_STREHL_M2,
119 IRPLIB_STREHL_BOX_SIZE,
133 #ifdef HDRL_USE_EXPERIMENTAL
135 hdrl_self = hdrl_image_create(
self, NULL);
137 skip_if (hdrl_self == NULL);
140 hdrl_param = hdrl_strehl_parameter_create(lam * 1e-6,
141 IRPLIB_STREHL_M1 * 0.5,
142 IRPLIB_STREHL_M2 * 0.5,
145 if (hdrl_param != NULL)
146 hdrl_strehl = hdrl_strehl_compute(hdrl_self, hdrl_param);
148 if (!cpl_errorstate_is_equal(cleanstate)) {
149 irplib_error_recover(cleanstate,
"HDRL Strehl computation failed "
150 "(keeping %g)", *pstrehl);
151 }
else if (0.0 < *pstrehl && *pstrehl < 1.0 &&
152 (hdrl_strehl.strehl_value.data <= 0.0 ||
153 hdrl_strehl.strehl_value.data >= 1.0)) {
154 cpl_msg_warning(cpl_func,
"Ignoring suspicious HDRL Strehl: %g "
155 "(keeping %g)", hdrl_strehl.strehl_value.data,
158 cpl_msg_info(cpl_func,
"Changing Strehl: %g -> %g",
159 *pstrehl, hdrl_strehl.strehl_value.data);
160 *pstrehl = hdrl_strehl.strehl_value.data;
167 #ifdef HDRL_USE_EXPERIMENTAL
168 hdrl_parameter_delete(hdrl_param);
169 hdrl_image_delete(hdrl_self);
172 return cpl_error_get_code();