{"action":"opened","issue":{"url":"https://api.github.com/repos/DataMedSci/pymchelper/issues/319","repository_url":"https://api.github.com/repos/DataMedSci/pymchelper","labels_url":"https://api.github.com/repos/DataMedSci/pymchelper/issues/319/labels{/name}","comments_url":"https://api.github.com/repos/DataMedSci/pymchelper/issues/319/comments","events_url":"https://api.github.com/repos/DataMedSci/pymchelper/issues/319/events","html_url":"https://github.com/DataMedSci/pymchelper/issues/319","id":344202448,"node_id":"MDU6SXNzdWUzNDQyMDI0NDg=","number":319,"title":"Ugly error when DDD fitting not possible","user":{"login":"grzanka","id":7374733,"node_id":"MDQ6VXNlcjczNzQ3MzM=","avatar_url":"https://avatars0.githubusercontent.com/u/7374733?v=4","gravatar_id":"","url":"https://api.github.com/users/grzanka","html_url":"https://github.com/grzanka","followers_url":"https://api.github.com/users/grzanka/followers","following_url":"https://api.github.com/users/grzanka/following{/other_user}","gists_url":"https://api.github.com/users/grzanka/gists{/gist_id}","starred_url":"https://api.github.com/users/grzanka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grzanka/subscriptions","organizations_url":"https://api.github.com/users/grzanka/orgs","repos_url":"https://api.github.com/users/grzanka/repos","events_url":"https://api.github.com/users/grzanka/events{/privacy}","received_events_url":"https://api.github.com/users/grzanka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-24T21:02:02Z","updated_at":"2018-07-24T21:02:02Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"It is better to replace results with NaN in such case.\r\nNow a stack trace is printed:\r\n```\r\n...........................................................................\r\n/net/archive/groups/plggccbmc/software/tools/pymchelper/0.12.1/pymchelper/writers/trip98.py in write(self=<pymchelper.writers.trip98.TripDddWriter object>, detector=<pymchelper.detector.Detector object>)\r\n    221                 # perform the fit\r\n    222                 params, params_error = self._lateral_fit(r_fitting_cm,\r\n    223                                                          dose_fitting_1d_positive_MeV_g,\r\n    224                                                          z_cm,\r\n    225                                                          self.energy_MeV,\r\n--> 226                                                          self.ngauss)\r\n        self.ngauss = 2\r\n    227 \r\n    228                 fwhm1_cm, factor, fwhm2_cm, dz0_MeV_cm_g = params\r\n    229                 fwhm1_cm_error, factor_error, fwhm2_cm_error, dz0_MeV_cm_g_error = params_error\r\n    230                 fwhm1_cm_data[ind] = fwhm1_cm\r\n\r\n...........................................................................\r\n/net/archive/groups/plggccbmc/software/tools/pymchelper/0.12.1/pymchelper/writers/trip98.py in _lateral_fit(cls=<class 'pymchelper.writers.trip98.TripDddWriter'>, r_cm=array([ 0.25]), dose_MeV_g=array([ 6.91477447]), z_cm=0.025000000000000001, energy_MeV=150.0, ngauss=2)\r\n    744                                    xdata=r_cm,\r\n    745                                    ydata=dose_MeV_g * r_cm,\r\n    746                                    p0=[starting_amp_MeV_g, starting_sigma_cm, starting_weigth, starting_sigma2_add_cm],\r\n    747                                    bounds=([min_amp_MeV_g, min_sigma_cm, min_weigth, min_sigma2_add_cm],\r\n    748                                            [max_amp_MeV_g, max_sigma_cm, max_weigth, max_sigma2_add_cm]),\r\n--> 749                                    sigma=None)\r\n    750             # TODO return also parameter errors\r\n    751             perr = np.sqrt(np.diag(pcov))\r\n    752             dz0_MeV_cm_g_error, sigma_cm_error, factor_error, sigma2_add_cm_error = perr\r\n    753 \r\n\r\n...........................................................................\r\n/net/software/local/intel-python/2018.0.018/intelpython3/lib/python3.6/site-packages/scipy/optimize/minpack.py in curve_fit(f=<bound method TripDddWriter.gauss2_r_MeV_cm_g of <class 'pymchelper.writers.trip98.TripDddWriter'>>, xdata=array([ 0.25]), ydata=array([ 1.72869362]), p0=array([ 6.91477447,  0.25      ,  0.99      ,  0.1       ]), sigma=None, absolute_sigma=False, check_finite=True, bounds=([6.9147744697943997e-10, 0.0025000000000000001, 0.55, 0.1], [13.829548939588799, 2500.0, 0.999999999999, 20.0]), method='trf', jac='2-point', **kwargs={'max_nfev': None})\r\n    760 \r\n    761         res = least_squares(func, p0, jac=jac, bounds=bounds, method=method,\r\n    762                             **kwargs)\r\n    763 \r\n    764         if not res.success:\r\n--> 765             raise RuntimeError(\"Optimal parameters not found: \" + res.message)\r\n        res.message = 'The maximum number of function evaluations is exceeded.'\r\n    766 \r\n    767         cost = 2 * res.cost  # res.cost is half sum of squares!\r\n    768         popt = res.x\r\n    769 \r\n\r\nRuntimeError: Optimal parameters not found: The maximum number of function evaluations is exceeded.\r\n___________________________________________________________________________\r\n\r\n```"}}
{"actor":{"display_login":"grzanka"}}