163 double min_flux = 0.;
165 for (
auto pixel : pixel_coordinates) {
166 pixel -= stamp_top_left;
168 min_flux += threshold_map_stamp.getValue(pixel);
182 auto size =
std::max<double>(source_stamp.getWidth(), source_stamp.getHeight());
184 double radius_guess = shape_parameters.getEllipseA() / 2.0;
187 double guess_y = pixel_centroid.getCentroidY() - stamp_top_left.
m_y;
191 double exp_reff_guess = radius_guess;
192 double exp_aspect_guess =
std::max<double>(shape_parameters.getEllipseB() / shape_parameters.getEllipseA(), 0.01);
193 double exp_rot_guess = shape_parameters.getEllipseTheta();
196 exp_flux_guess, exp_reff_guess, exp_aspect_guess, exp_rot_guess);
198 source_model->createModels(extended_models, point_models);
199 source_model->registerParameters(manager);
205 (
size_t) source_stamp.getWidth(), (
size_t) source_stamp.getHeight(),
212 std::fill(weight->getData().begin(), weight->getData().end(), 1);
214 for (
int y=0; y < source_stamp.getHeight(); y++) {
215 for (
int x=0; x < source_stamp.getWidth(); x++) {
216 weight->at(x, y) = (thresholded_stamp.getValue(x, y) >= 0) ? 0 : 1;
220 for (
auto pixel : pixel_coordinates) {
221 pixel -= stamp_top_left;
222 weight->at(pixel.m_x, pixel.m_y) = 1;
226 SeFloat gain = detection_frame_info.getGain();
227 SeFloat saturation = detection_frame_info.getSaturation();
229 for (
int y=0; y < source_stamp.getHeight(); y++) {
230 for (
int x=0; x < source_stamp.getWidth(); x++) {
231 auto back_var = variance_stamp.getValue(x, y);
232 if (saturation > 0 && source_stamp.getValue(x, y) >= saturation) {
233 weight->at(x, y) = 0;
234 }
else if (weight->at(x, y)>0) {
236 weight->at(x, y) =
sqrt(1.0 / (back_var + source_stamp.getValue(x, y) / gain));
238 weight->at(x, y) =
sqrt(1.0 / back_var);
255 auto solution = engine->solveProblem(manager, res_estimator);
256 size_t iterations = solution.iteration_no;
266 source_model->createModels(extended_models, point_models);
268 (
size_t)source_stamp.getWidth(),
269 (
size_t)source_stamp.getHeight(),
273 auto final_image = frame_model_after.
getImage();
276 double total_flux = 0;
277 for (
int y = 0; y < source_stamp.getHeight(); y++) {
278 for (
int x = 0; x < source_stamp.getWidth(); x++) {
280 pixel += stamp_top_left;
283 final_stamp->setValue(x, y, final_stamp->getValue(x, y) + final_image->getValue(x, y));
285 total_flux += final_image->getValue(x, y);
291 SeFloat x = stamp_top_left.
m_x + source_model->x->getValue() - 0.5f;
292 SeFloat y = stamp_top_left.
m_y + source_model->y->getValue() - 0.5f;
297 source_model->moffat_i0->getValue(), source_model->moffat_index->getValue(),
298 source_model->minkowski_exponent->getValue(), source_model->flat_top_offset->getValue(), source_model->m_size,
299 source_model->moffat_x_scale->getValue(), source_model->moffat_y_scale->getValue(),
300 source_model->moffat_rotation->getValue(),