Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we recomment using gsl instead of levmar in #554??? #555

Open
mkuemmel opened this issue May 26, 2023 · 6 comments
Open

Should we recomment using gsl instead of levmar in #554??? #555

mkuemmel opened this issue May 26, 2023 · 6 comments
Assignees

Comments

@mkuemmel
Copy link
Collaborator

In the dataset discussed in #554, one way to avoid getting stuck would be using gsl instead of levmar.
I checked that. While indeed the program runs through, a comparison of the fit results in x and y shows:
x_offset
y_offset

~2% of the sources are off in both, x and y. The sources are rather evenly distributed in x/y.

In flux there is even a branch which is far off:
flux_comp

I did not go into detail, but it is strange that gsl gives 1000 times brighter flux than levmar. The sources that are at around 1 fit very good, however!

@marcschefer
Copy link
Member

It's weird, we test gsl as part of our automated tests so I think it's working in normal cases. Could it be possible those failure cases are related to what's causing the infinite loop in levmar?

@mkuemmel
Copy link
Collaborator Author

It is strange that:

  • the positional offset goes to the same direction;
  • there is this line at ~-1000.

Maybe more effort is necessary in the parameterization, I only exchanged levmar --> gsl in the config files. On the other hand it's a rather simple PSF fitting, meaning only one parameter. If consistent the residuals of the brighter objects at -1000 must look ridiculous...

@mkuemmel
Copy link
Collaborator Author

Yepp, the objects at -1000. are black holes in the residuals.

But the failures are signaled in the stop reason. They all have stop-reason=11 (but there are also good stop-reson=11 sources.

I tried to figure out what that 11 means for gsl, but it is confusing. 11 means too many iterations, but for most of the baid fails the # of iteration is 0, also 11 should be translated into a flag, but the gsl flag is always 0.

@mkuemmel
Copy link
Collaborator Author

It's a bit confusing:

  • the factor 1000 in the bad measurements comes from the detection images, meaning it does not start fitting at all and just reports the starting flux value;
  • the stop reason is "exceeded max number of iterations", which fits with the stop reason;
  • however the # of iterations is only 1;
  • also the flag should be set to 1, which I don't see in the result table;

Somehow for those 4% sources the fits does not really start. No idea why.

@mkuemmel
Copy link
Collaborator Author

I ran the same dataset with levmar and with gsl and crossmatched the results.
When plotting the relative difference between the initial flux and the fitted flux it looks like this:

rel_diffs

The good news: the sources that were not fitted with gsl were also not fitted with levmar.

The bad news: I have no idea why neither minimizer does a good job.

I should have checked the flagging. I'll investigate further....

@mkuemmel
Copy link
Collaborator Author

They all have in levmar:
"7 - stopped by invalid (i.e. NaN or Inf) "func" values; a user error "

There are NAN's in the image file and 0 in the weight, but no weight threshold.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants