162 double min_flux = 0.;
164 for (
auto pixel : pixel_coordinates) {
165 pixel -= stamp_top_left;
167 min_flux += threshold_map_stamp.getValue(pixel);
181 auto size =
std::max<double>(source_stamp.getWidth(), source_stamp.getHeight());
183 double radius_guess = shape_parameters.getEllipseA() / 2.0;
186 double guess_y = pixel_centroid.getCentroidY() - stamp_top_left.
m_y;
190 double exp_reff_guess = radius_guess;
191 double exp_aspect_guess =
std::max<double>(shape_parameters.getEllipseB() / shape_parameters.getEllipseA(), 0.01);
192 double exp_rot_guess = shape_parameters.getEllipseTheta();
195 exp_flux_guess, exp_reff_guess, exp_aspect_guess, exp_rot_guess);
197 source_model->createModels(extended_models, point_models);
198 source_model->registerParameters(manager);
204 (
size_t) source_stamp.getWidth(), (
size_t) source_stamp.getHeight(),
211 std::fill(weight->getData().begin(), weight->getData().end(), 1);
213 for (
int y=0; y < source_stamp.getHeight(); y++) {
214 for (
int x=0; x < source_stamp.getWidth(); x++) {
215 weight->at(x, y) = (thresholded_stamp.getValue(x, y) >= 0) ? 0 : 1;
219 for (
auto pixel : pixel_coordinates) {
220 pixel -= stamp_top_left;
221 weight->at(pixel.m_x, pixel.m_y) = 1;
225 SeFloat gain = detection_frame_info.getGain();
226 SeFloat saturation = detection_frame_info.getSaturation();
228 for (
int y=0; y < source_stamp.getHeight(); y++) {
229 for (
int x=0; x < source_stamp.getWidth(); x++) {
230 auto back_var = variance_stamp.getValue(x, y);
231 if (saturation > 0 && source_stamp.getValue(x, y) >= saturation) {
232 weight->at(x, y) = 0;
233 }
else if (weight->at(x, y)>0) {
235 weight->at(x, y) =
sqrt(1.0 / (back_var + source_stamp.getValue(x, y) / gain));
237 weight->at(x, y) =
sqrt(1.0 / back_var);
254 auto solution = engine->solveProblem(manager, res_estimator);
255 size_t iterations = solution.iteration_no;
265 source_model->createModels(tmp_extended_models, tmp_point_models);
267 (
size_t)source_stamp.getWidth(),
268 (
size_t)source_stamp.getHeight(),
272 auto final_image = frame_model_after.
getImage();
275 double total_flux = 0;
276 for (
int y = 0; y < source_stamp.getHeight(); y++) {
277 for (
int x = 0; x < source_stamp.getWidth(); x++) {
279 pixel += stamp_top_left;
282 final_stamp->setValue(x, y, final_stamp->getValue(x, y) + final_image->getValue(x, y));
284 total_flux += final_image->getValue(x, y);
290 SeFloat x = stamp_top_left.
m_x + source_model->x->getValue() - 0.5f;
291 SeFloat y = stamp_top_left.
m_y + source_model->y->getValue() - 0.5f;
296 source_model->moffat_i0->getValue(), source_model->moffat_index->getValue(),
297 source_model->minkowski_exponent->getValue(), source_model->flat_top_offset->getValue(), source_model->m_size,
298 source_model->moffat_x_scale->getValue(), source_model->moffat_y_scale->getValue(),
299 source_model->moffat_rotation->getValue(),