Opened 9 years ago

Closed 7 years ago

#20 closed defect (fixed)

constrained_levenberg_marquardt error handling is broken

Reported by: flip Owned by: bsoher
Priority: major Milestone:
Component: libduke_mr Version:
Keywords: Cc:

Description

The file libduke_mr/constrained_levenberg_marquardt.py contains one function: constrained_levenberg_marquardt().

The error handling in this function is broken. Specifically --

  • Near the top there's a case where an error message is printed to stdout ("Curvefit - not enough data points"), but the code takes no other action. Raising an error would be the logical thing to do.
  • The variable msg is populated with important-looking error messages in a couple of places, but the variable is not returned to the caller. It's written to, but never read. Raising an error would be preferable.
  • There's a naked "except" clause.
  • In one case the return variable chisqr is set to numpy.NAN. FIrst of all, the code should use Python's builtin Not-a-Number float('nan'). Second of all, the function doesn't advertise that it might return NaN in that variable and our code isn't prepared to handle it.


Change History (1)

comment:1 Changed 7 years ago by flip

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in various commits.

Note: See TracTickets for help on using tickets.