EranOfek / AstroPack

Astronomy & Astrophysics Software Pacakge
Other
19 stars 4 forks source link

`tools.math.fit.ransacLinearModel` errors if it receives no points #519

Open EastEriq opened 3 days ago

EastEriq commented 3 days ago

and this can happen in the focus loop. It's a pathological situation, so I'll try catch it, but maybe you want to make the function more robust to such calls.

>> tools.math.fit.ransacLinearModel([],[])
Error using randi
First input must be a positive scalar integer value IMAX, or two integer values
[IMIN IMAX] with IMIN less than or equal to IMAX.

Error in tools.math.fit.ransacLinearModel (line 53)
        IndRand = randi([1 Npt], NptSim, 1);
EranOfek commented 3 days ago

I added a comment to the help that H can't be empty. This should be checked by the upper level, and in this case, it make sense that the focus code will check this.