{"action":"created","issue":{"url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/86","labels_url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/86/comments","events_url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/86/events","html_url":"https://github.com/pyspeckit/pyspeckit/issues/86","id":97169463,"number":86,"title":"problem handling old VLA headers","user":{"login":"jpinedaf","id":6529114,"avatar_url":"https://avatars.githubusercontent.com/u/6529114?v=3","gravatar_id":"","url":"https://api.github.com/users/jpinedaf","html_url":"https://github.com/jpinedaf","followers_url":"https://api.github.com/users/jpinedaf/followers","following_url":"https://api.github.com/users/jpinedaf/following{/other_user}","gists_url":"https://api.github.com/users/jpinedaf/gists{/gist_id}","starred_url":"https://api.github.com/users/jpinedaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpinedaf/subscriptions","organizations_url":"https://api.github.com/users/jpinedaf/orgs","repos_url":"https://api.github.com/users/jpinedaf/repos","events_url":"https://api.github.com/users/jpinedaf/events{/privacy}","received_events_url":"https://api.github.com/users/jpinedaf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-24T23:39:40Z","updated_at":"2015-07-26T21:05:22Z","closed_at":null,"body":"@keflavich When trying to fit some old VLA data I get the error message below. Here I'm trying to fit the NH3(1,1) line, and in the header it is stored as velocity. Is there something obvious I should check?\r\n\r\n```\r\nIn [106]: fit_NH3_lines.cubefit(region='IRAS03282', vmin=6.0, vmax=8.0, do_plot=True, \r\n            snr_min=5.0, multicore=1)\r\nstart fit\r\n---------------------------------------------------------------------------\r\nUnitsError                                Traceback (most recent call last)\r\n<ipython-input-106-8b7bd1213d90> in <module>()\r\n      1 fit_NH3_lines.cubefit(region='IRAS03282', vmin=6.0, vmax=8.0, do_plot=True, \r\n----> 2             snr_min=5.0, multicore=1)\r\n\r\n/Users/jpineda/science/j_radius/fit_NH3_lines.py in cubefit(region, vmin, vmax, do_plot, snr_min, multicore)\r\n    146                   use_neighbor_as_guess=True,\r\n    147                   position_order = 1/peaksnr,\r\n--> 148                   errmap=errmap11, multicore=multicore)\r\n    149 \r\n    150     #fitcubefile = fits.PrimaryHDU(data=np.concatenate([cubes.parcube,cubes.errcube]), header=cubes.header)\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspeckit-0.1.17.dev1838-py2.7.egg/pyspeckit/cubes/SpectralCube.pyc in fiteach(self, errspec, errmap, guesses, verbose, verbose_level, quiet, signal_cut, usemomentcube, blank_value, integral, direct, absorption, use_nearest_as_guess, use_neighbor_as_guess, start_from_point, multicore, position_order, continuum_map, **fitkwargs)\r\n    766         # session that's just going to crash at the end.\r\n    767         # try a first fit for exception-catching\r\n--> 768         try0 = fit_a_pixel((0,valid_pixels[0][0],valid_pixels[0][1]))\r\n    769         try:\r\n    770             assert len(try0[1]) == len(guesses) == len(self.parcube) == len(self.errcube)\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspeckit-0.1.17.dev1838-py2.7.egg/pyspeckit/cubes/SpectralCube.pyc in fit_a_pixel(iixy)\r\n    646         def fit_a_pixel(iixy):\r\n    647             ii,x,y = iixy\r\n--> 648             sp = self.get_spectrum(x,y)\r\n    649 \r\n    650             # very annoying - cannot use min/max without checking type\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspeckit-0.1.17.dev1838-py2.7.egg/pyspeckit/cubes/SpectralCube.pyc in get_spectrum(self, x, y)\r\n    432                 sp.specfit.fitter.npeaks = len(sp.specfit.modelpars) / sp.specfit.fitter.npars\r\n    433                 sp.specfit.fitter.parinfo = sp.specfit.parinfo\r\n--> 434                 sp.specfit.model = sp.specfit.fitter.n_modelfunc(sp.specfit.modelpars,**sp.specfit.fitter.modelfunc_kwargs)(sp.xarr)\r\n    435 \r\n    436         return sp\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspeckit-0.1.17.dev1838-py2.7.egg/pyspeckit/spectrum/models/ammonia.pyc in L(x)\r\n    365                     name = parnames[ii+jj*npars].strip('0123456789').lower()\r\n    366                     modelkwargs.update({name:parvals[ii+jj*npars]})\r\n--> 367                 v += ammonia(x,**modelkwargs)\r\n    368             return v\r\n    369         return L\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspeckit-0.1.17.dev1838-py2.7.egg/pyspeckit/spectrum/models/ammonia.pyc in ammonia(xarr, tkin, tex, ntot, width, xoff_v, fortho, tau, fillingfraction, return_tau, background_tb, thin, verbose, return_components, debug)\r\n     91 \r\n     92     # Convert X-units to frequency in GHz\r\n---> 93     xarr = xarr.as_unit('GHz')\r\n     94 \r\n     95     if tex is not None:\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyspeckit-0.1.17.dev1838-py2.7.egg/pyspeckit/spectrum/units.pyc in as_unit(self, unit, equivalencies, velocity_convention, refX, refX_unit, center_frequency, center_frequency_unit, **kwargs)\r\n    638             self._unit = u.Unit(self.unit)\r\n    639 \r\n--> 640         return self.to(unit, equivalencies=self.equivalencies)\r\n    641 \r\n    642     def make_dxarr(self, coordinate_location='center'):\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/units/quantity.pyc in to(self, unit, equivalencies)\r\n    603         unit = Unit(unit)\r\n    604         new_val = np.asarray(\r\n--> 605             self.unit.to(unit, self.value, equivalencies=equivalencies))\r\n    606         return self._new_view(new_val, unit)\r\n    607 \r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/units/core.pyc in to(self, other, value, equivalencies)\r\n    943             If units are inconsistent\r\n    944         \"\"\"\r\n--> 945         return self._get_converter(other, equivalencies=equivalencies)(value)\r\n    946 \r\n    947     def in_units(self, other, value=1.0, equivalencies=[]):\r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/units/core.pyc in _get_converter(self, other, equivalencies)\r\n    847         except UnitsError:\r\n    848             return self._apply_equivalences(\r\n--> 849                 self, other, self._normalize_equivalencies(equivalencies))\r\n    850         return lambda val: scale * _condition_arg(val)\r\n    851 \r\n\r\n/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/units/core.pyc in _apply_equivalences(self, unit, other, equivalencies)\r\n    838         raise UnitsError(\r\n    839             \"{0} and {1} are not convertible\".format(\r\n--> 840                 unit_str, other_str))\r\n    841 \r\n    842     def _get_converter(self, other, equivalencies=[]):\r\n\r\nUnitsError: 'm / s' (speed) and 'GHz' (frequency) are not convertible\r\n```"},"comment":{"url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/comments/125040365","html_url":"https://github.com/pyspeckit/pyspeckit/issues/86#issuecomment-125040365","issue_url":"https://api.github.com/repos/pyspeckit/pyspeckit/issues/86","id":125040365,"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":"2015-07-26T21:05:22Z","updated_at":"2015-07-26T21:05:22Z","body":"This is a UI bug, then.  Did the FAQ help?  I wrote it yesterday for a similar issue."}}