astrorama / SourceXtractorPlusPlus

SourceXtractor++, the next generation SExtractor
https://astrorama.github.io/SourceXtractorPlusPlus/
GNU Lesser General Public License v3.0
72 stars 9 forks source link

Model image seems to be background subtracted #530

Closed mkuemmel closed 2 years ago

mkuemmel commented 2 years ago

I found this when fitting user defined models to M95, but when making a Sersic fits the same happens. When using the notation: img: the original image mod: the model image res: the residual image

In the example the background was set to 0.0 in both config files, hence it should be: img - mod = res When doing this operation, the residual looks different from the residual that SE++ writes out.

Actually, when : img - mod - res_se++ = strange

It turns out that: strange = bck

With bck the background model. It look as if: mod_se++ = mod - bck

Which would mean that SE++ subtracts the background always from the model even if it is set to 0.0!

The dataset where I found this behaviour is available here: https://cloud.physik.lmu.de/index.php/s/F22skXAYjWHXkSg

I'll still check with data containing only small source whether the same happens also there.

marcschefer commented 2 years ago

I don't see the constant_background option being set as a parameter to MeasurementImage in the Python configuration, the command line option only applies to the detection image.

In the python config, you have a constant_background = 0.0 as a variable assignment and then it's not used, it's a parameter not a global variable and it should be inside your MeasurementImage constructor call.

mkuemmel commented 2 years ago

OMG, looks like I had seen months/years ago the line: _constantbackground = 0.0

in some python configuration file. For whatever reason I had interpreted that this line sets all background in all images to 0.0!

That line is in many of my python configuration files...

marcschefer commented 2 years ago

If it was in some script it must have been the result of a copy/paste error, but it never worked like that.

mkuemmel commented 2 years ago

Wellwell, to see it from the positive side, this is an error I won't make again...