Hi,
Apologies for bothering you again. I have installed pyprofit using 'pip install pyprofit' (I nver managed to get it working using the setup.py from github). When I run Usage.py it iterates through a very large number models before breaking with the error pasted at the bottom. For some reason the axrat suddenly changes from 1.0 to 1.0000000069077553. I can't see if we are fitting axrat from:
Initial set of parameters
names = ['%s.%s' % (profile, prop) for prop,profile in itertools.product(('xcen','ycen','mag','re','nser','ang','axrat','box'), ('sersic1','sersic2'))]
model0 = np.array((84.8832, 84.8832, 94.5951, 94.5951, 16.83217, 16.83217, 7.0574, 14.1148, 4.3776, 1.0000, 140.8191, 140.8191, 1., 0.4891, 0, 0))
tofit = np.array((True, False, True, False, True, True, True, True, True, False, True, True, False, True, True, False))
tolog = np.array((False, False, False, False, False, False, True, True, True, True, False, False, True, True, False, False))
sigmas = np.array((2, 2, 2, 2, 5, 5, 1, 1, 1, 1, 30, 30, 0.3, 0.3, 0.3, 0.3))
lowers = np.array((0, 0, 0, 0, 10, 10, 0, 0, -1, -1, -180, -180, -1, -1, -1, -1))
uppers = np.array((1e3, 1e3, 1e3, 1e3, 30, 30, 2, 2, 1.3, 1.3, 360, 360, 0, 0, 1, 1))
priors = np.array([prior_func(s) for s in sigmas])
I have not changed the usage.py at all. It seems very odd that it suddenly changes axrat which is presumably held fixed and breaks.
Any advice would be greatly appreciated.
Best,
Raphael.
{'psf': array([[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
...,
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.],
[ 0., 0., 0., ..., 0., 0., 0.]], dtype=float32), 'width': 169, 'magzero': 0, 'profiles': {'sersic': [{'box': 1.0, 'ang': -180.0, 'xcen': 0.0, 'axrat': 1.0, 're': 1.0, 'convolve': True, 'mag': 10.0, 'nser': 19.952623149688797, 'ycen': 0.0}, {'box': 0.0, 'ang': -180.0, 'xcen': 84.883200000000002, 'axrat': 1.0000000069077553, 're': 1.0, 'convolve': True, 'mag': 30.0, 'nser': 1.0, 'ycen': 94.595100000000002}]}, 'height': 187}
Traceback (most recent call last):
File "", line 1, in
runfile('/Users/rs548/GitHub/pyprofit/examples/usage.py', wdir='/Users/rs548/GitHub/pyprofit/examples')
File "/Users/rs548/anaconda/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "/Users/rs548/anaconda/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 94, in execfile
builtins.execfile(filename, *where)
File "/Users/rs548/GitHub/pyprofit/examples/usage.py", line 122, in
run()
File "/Users/rs548/GitHub/pyprofit/examples/usage.py", line 111, in run
result = optimize.minimize(profit_like_model, data.init, args=(data,), method='L-BFGS-B', bounds=data.bounds, options={'disp':True})
File "/Users/rs548/anaconda/lib/python2.7/site-packages/scipy/optimize/_minimize.py", line 450, in minimize
callback=callback, **options)
File "/Users/rs548/anaconda/lib/python2.7/site-packages/scipy/optimize/lbfgsb.py", line 328, in _minimize_lbfgsb
f, g = func_and_grad(x)
File "/Users/rs548/anaconda/lib/python2.7/site-packages/scipy/optimize/lbfgsb.py", line 274, in func_and_grad
g = _approx_fprime_helper(x, fun, epsilon, args=args, f0=f)
File "/Users/rs548/anaconda/lib/python2.7/site-packages/scipy/optimize/optimize.py", line 628, in _approx_fprime_helper
grad[k] = (f(*((xk + d,) + args)) - f0) / d[k]
File "/Users/rs548/anaconda/lib/python2.7/site-packages/scipy/optimize/optimize.py", line 292, in function_wrapper
return function(*(wrapper_args + args))
File "profit_optim.py", line 82, in profit_like_model
allparams, modelim = to_pyprofit_image(params, data)
File "profit_optim.py", line 70, in to_pyprofit_image
return allparams, np.array(pyprofit.make_model(profit_model))
error: axrat > 1, must have axrat <= 1