I would like to have your suggestions and help concerning my problem.
I have images generated on a position sensitive detector. The signal for each pixels corresponds to the amount of 'particles' interacting with the detector, so I would consider the signal distribution as a counting statistics.
I have to fit a profile of these images with a non-linear function and for this I am using a non-linear least square minimization (Levenberg-Marquardt algorithm) as implemented in scipy least_square.
So far, I have not used any weights for the input data (that corresponds to have a constant value of 1 for all points) and the fit is 'visually' looking very nice. On the other hand, the chi_square is enormously high and I think that this is due to the fact the I am not scaling the input data for their uncertainty.
My idea was to use the counting statistics to provide the uncertainty of each point.
I was thinking to calculate the variance standard deviation of each pixel as the square root of its number of counts and then use it as weight for the fit. In this way, the pixels with the highest signal will have a higher variance standard deviation and a higher weight. On the contrary the 'almost' empty pixels will have a lower weight in the fit.
what do you think it is the most reasonable approach?
EDIT: after Sextus's answer
My fitting model function is not necessarily exact, meaning that it is the mathematical representation of the physical phenomenon occurring. Thus there is no reason why the calculated chi squared should follow the chi squared distribution.
So far, the obtained fits were reasonably well following the experimental distribution and the qualitative information obtained are well describing the phenomenon. But since I'm performing several thousands of fits, I was looking for a fit-goodness parameter to use to quickly identify failed and bad fits. After the remarks of @Sextus, I guess that the chi squared cannot be used for this purpose. Do you have any fit-goodness parameter to suggest under these circumstances?
For the moment, I'm not using any weights, that is equivalent to give to all points the same weight of 1. What will be the benefit of using weights? Will the uncertainty of the determined parameters get better? Will the fit-goodness parameter get better? For this purpose, can make sense to use the standard deviation of each pixel as weights? In this case, I would use the assumption that each pixel is independent and follows a Poissonian distribution with standard deviation = square root of the mean.
Thanks again for your help, toto