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;
113 skip_if(irplib_strehl_compute(
self,
131 #ifdef HDRL_USE_EXPERIMENTAL
133 hdrl_self = hdrl_image_create(
self, NULL);
135 skip_if (hdrl_self == NULL);
138 hdrl_param = hdrl_strehl_parameter_create(lam * 1e-6,
143 if (hdrl_param != NULL)
144 hdrl_strehl = hdrl_strehl_compute(hdrl_self, hdrl_param);
146 if (!cpl_errorstate_is_equal(cleanstate)) {
147 irplib_error_recover(cleanstate,
"HDRL Strehl computation failed "
148 "(keeping %g)", *pstrehl);
149 }
else if (0.0 < *pstrehl && *pstrehl < 1.0 &&
150 (hdrl_strehl.strehl_value.data <= 0.0 ||
151 hdrl_strehl.strehl_value.data >= 1.0)) {
152 cpl_msg_warning(cpl_func,
"Ignoring suspicious HDRL Strehl: %g "
153 "(keeping %g)", hdrl_strehl.strehl_value.data,
156 cpl_msg_info(cpl_func,
"Changing Strehl: %g -> %g",
157 *pstrehl, hdrl_strehl.strehl_value.data);
158 *pstrehl = hdrl_strehl.strehl_value.data;
165 #ifdef HDRL_USE_EXPERIMENTAL
166 hdrl_parameter_delete(hdrl_param);
167 hdrl_image_delete(hdrl_self);
170 return cpl_error_get_code();
cpl_error_code naco_strehl_compute(const cpl_image *self, const cpl_parameterlist *parlist, const char *recipename, double lam, double dlam, double pos_x, double pos_y, double pixscale, double *pstrehl, double *pstrehl_err, double *pstar_bg, double *pstar_peak, double *pstar_flux, double *ppsf_peak, double *ppsf_flux, double *pbg_noise)
Compute the strehl ratio in an image.
double naco_parameterlist_get_double(const cpl_parameterlist *self, const char *recipe, naco_parameter bitmask)
Retrieve the value of a NACO parameter of type double.
#define IRPLIB_STREHL_M2
The diameter of the secondary mirror, [m].
#define IRPLIB_STREHL_M1
The diameter of the primary mirror, [m].
#define IRPLIB_STREHL_BOX_SIZE
The size of the internally used PSF-image, [pixel].