{"action":"created","issue":{"url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/159","repository_url":"https://api.github.com/repos/pyspeckit/pyspeckit","labels_url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/159/labels{/name}","comments_url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/159/comments","events_url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/159/events","html_url":"https://github.com/pyspeckit/pyspeckit/pull/159","id":148065732,"number":159,"title":"fiteach doesn't fit certain pixels, specfit does","user":{"login":"vlas-sokolov","id":11835115,"avatar_url":"https://avatars.githubusercontent.com/u/11835115?v=3","gravatar_id":"","url":"https://api.github.com/users/vlas-sokolov","html_url":"https://github.com/vlas-sokolov","followers_url":"https://api.github.com/users/vlas-sokolov/followers","following_url":"https://api.github.com/users/vlas-sokolov/following{/other_user}","gists_url":"https://api.github.com/users/vlas-sokolov/gists{/gist_id}","starred_url":"https://api.github.com/users/vlas-sokolov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlas-sokolov/subscriptions","organizations_url":"https://api.github.com/users/vlas-sokolov/orgs","repos_url":"https://api.github.com/users/vlas-sokolov/repos","events_url":"https://api.github.com/users/vlas-sokolov/events{/privacy}","received_events_url":"https://api.github.com/users/vlas-sokolov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":19,"created_at":"2016-04-13T13:44:12Z","updated_at":"2016-07-31T18:25:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pyspeckit/pyspeckit/pulls/159","html_url":"https://github.com/pyspeckit/pyspeckit/pull/159","diff_url":"https://github.com/pyspeckit/pyspeckit/pull/159.diff","patch_url":"https://github.com/pyspeckit/pyspeckit/pull/159.patch"},"body":"I'm getting an unexpected behavior when running `fiteach` on a dummy gaussian cube. A fit with a good initial guess doesn't converge for a significant fraction of the pixels, despite good signal-to-noise ratios in them.\r\n\r\nIt doesn't seem to be an issue of the underlying non-linear least squares code too - if I just do a for-loop over all (x,y) positions and fit every spectrum using `specfit` with the same initial guesses, the issue disappears:\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pylab as plt\r\nimport pyspeckit\r\nfrom pyspeckit.cubes.tests.test_cubetools import make_test_cube\r\n\r\nmake_test_cube((100,10,10), outfile='test.fits', sigma=(10,5))\r\n\r\n# get sigma from fiteach()\r\nspc = pyspeckit.Cube('test.fits')\r\nspc.fiteach(fittype = 'gaussian',\r\n            guesses=[0.7,0.5,0.8])\r\nsigma_fiteach = spc.parcube[2].copy()\r\n\r\n# get sigma from fitting individual spectra\r\nfor y,x in np.ndindex(spc.cube.shape[1:]):\r\n    sp = spc.get_spectrum(x,y)\r\n    sp.specfit(fittype='gaussian', guesses=[0.7,0.5,0.8])\r\n    spc.parcube[:,y,x] = sp.specfit.parinfo.values\r\nsigma_forloop = spc.parcube[2]\r\n\r\n# the difference of sigma fits shows pixels ignored by fiteach()!\r\nplt.imshow(sigma_fiteach / sigma_forloop, \r\n           cmap=plt.cm.get_cmap('Pastel1',2), \r\n           interpolation='none',\r\n           vmin=-0.5, vmax=1.5)\r\nplt.colorbar(ticks=[0,1])\r\nplt.show()\r\n```\r\nBelow is the ratio if the fitted sigma values - it illustrates the \"holes\" in the parcube resulting from `fiteach`:\r\n![pyspeckit-issue159](https://cloud.githubusercontent.com/assets/11835115/14495095/4c7e3c7c-018e-11e6-82b3-2b20576df6b0.png)\r\n"},"comment":{"url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/comments/236447829","html_url":"https://github.com/pyspeckit/pyspeckit/pull/159#issuecomment-236447829","issue_url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/159","id":236447829,"user":{"login":"keflavich","id":143715,"avatar_url":"https://avatars.githubusercontent.com/u/143715?v=3","gravatar_id":"","url":"https://api.github.com/users/keflavich","html_url":"https://github.com/keflavich","followers_url":"https://api.github.com/users/keflavich/followers","following_url":"https://api.github.com/users/keflavich/following{/other_user}","gists_url":"https://api.github.com/users/keflavich/gists{/gist_id}","starred_url":"https://api.github.com/users/keflavich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keflavich/subscriptions","organizations_url":"https://api.github.com/users/keflavich/orgs","repos_url":"https://api.github.com/users/keflavich/repos","events_url":"https://api.github.com/users/keflavich/events{/privacy}","received_events_url":"https://api.github.com/users/keflavich/received_events","type":"User","site_admin":false},"created_at":"2016-07-31T18:25:04Z","updated_at":"2016-07-31T18:25:04Z","body":"The test failures mostly have to do with specutils failing to install.  I don't really understand this."}}
{"actor":{"display_login":"keflavich"}}