glotaran / pyglotaran

A Python library for Global and Target Analysis of time-resolved spectroscopy data
GNU Lesser General Public License v3.0
53 stars 18 forks source link

fitting crashes with suboptimal starting values #137

Closed jsnel closed 5 years ago

jsnel commented 6 years ago

Description

I am trying to run the streakdata example notebook, https://github.com/glotaran/glotaran-examples/blob/master/fluorescence/2001-Gobets_et_al-Streakdata_PSI/demo_notebook_ga_seq.ipynb with slightly less than optimal parameters. Notebook which crashes attached: streakdata_notebook.zip I expected it to still be able to fit the data, but it crashed.

What I Did

I ran the code

result = model.fit()

And got the output.

   Iteration     Total nfev        Cost      Cost reduction    Step norm     Optimality   
       0              1         3.6545e+09                                    1.84e+12    
       1              2         1.6650e+09      1.99e+09       1.90e+00       8.42e+11    
       2              3         4.2493e+08      1.24e+09       2.57e+00       1.70e+10    
       3              4         0.0000e+00      4.25e+08       1.83e+00       0.00e+00    
`gtol` termination condition is satisfied.
Function evaluations 4, initial cost 3.6545e+09, final cost 0.0000e+00, first-order optimality 0.00e+00.
/home/joris/anaconda3/envs/glotaran/lib/python3.6/site-packages/lmfit/minimizer.py:337: RuntimeWarning: invalid value encountered in double_scalars
  _neg2_log_likel = self.ndata * np.log(self.chisqr / self.ndata)
/home/joris/anaconda3/envs/glotaran/lib/python3.6/site-packages/lmfit/minimizer.py:339: RuntimeWarning: divide by zero encountered in log
  self.bic = _neg2_log_likel + np.log(self.ndata) * self.nvarys

Ways to make it crash:

joernweissenborn commented 5 years ago

fixed with omitting nan