domeckert / pyproffit

Pyproffit is a Python code for the analysis of X-ray brightness profiles from clusters of galaxies
GNU General Public License v3.0
18 stars 4 forks source link

fitting.py and psfmat #9

Closed iacopsen closed 3 years ago

iacopsen commented 3 years ago

Problem when fitting the sky background of the median profile:

medprof_lin = pyproffit.Profile(data=dat_voronoi,center_choice='peak',binsize=5.,maxrad=15.) Determining X-ray peak Coordinates of surface-brightness peak: 429.0 474.0 Corresponding FK5 coordinates: 344.7018210184074 -34.80046387405536 medprof_lin.MedianSB(outsamples="outsamples.fits") mod_const=pyproffit.Model(pyproffit.Const) fitobj_median=pyproffit.Fitter(profile=medprof_lin,model=mod_const) fitobj_median.Migrad(bkg=-4.,pedantic=False,fitlow=10.,fithigh=15.) Traceback (most recent call last): File "", line 1, in File "/home/software/pyth/lib/python3.7/site-packages/pyproffit/fitting.py", line 225, in Migrad fmin, param=minuit.migrad() File "iminuit/_libiminuit.pyx", line 736, in iminuit._libiminuit.Minuit.migrad RuntimeError: exception was raised in user function User function arguments: bkg = -4.000000 Original python exception in user function: TypeError: unsupported operand type(s) for *: 'NoneType' and 'float' File "~/software/pyth/lib/python3.7/site-packages/pyproffit/fitting.py", line 73, in call ym = np.dot(self.psfmat, ym) File "<__array_function__ internals>", line 6, in dot

Line 73 of fitting.py contains "ym = np.dot(self.psfmat, ym)" but self.psfmat is equal to "None". If I comment this specific line the code works.

domeckert commented 3 years ago

Fixed. Thanks for reporting the bug.