GitHub PullRequestReviewCommentEvent at 2014-04-19 15:33:41
Repository: spectral-cube
Actor: astrofrog
Payload: {"comment":{"url":"https://api.github.com/repos/radio-tools/spectral-cube/pulls/comments/11794192","id":11794192,"diff_hunk":"@@ -321,6 +321,17 @@ def __init__(self, data, wcs, mask=None, meta=None):\n                            # object or array-like object, given that WCS needs to be consistent with data?\n         #assert mask._wcs == self._wcs\n         self._meta = meta or {}\n+        if 'BUNIT' in self._meta:\n+            self._unit = u.Unit(self._meta['BUNIT'])\n+        else:\n+            self._unit = None\n+\n+    @property\n+    def unit(self):\n+        if self._unit:\n+            return self._unit\n+        else:\n+            return 1","path":"spectral_cube/spectral_cube.py","position":null,"original_position":14,"commit_id":"b29a95ba0704346ebfc1f66d718599ad8eacf7eb","original_commit_id":"661697549309c95006a8f7d04c1d8a34c1216128","user":{"login":"astrofrog","id":314716,"avatar_url":"https://avatars.githubusercontent.com/u/314716?","gravatar_id":"f586e2a9879fe0a55fd1e3ea529c664f","url":"https://api.github.com/users/astrofrog","html_url":"https://github.com/astrofrog","followers_url":"https://api.github.com/users/astrofrog/followers","following_url":"https://api.github.com/users/astrofrog/following{/other_user}","gists_url":"https://api.github.com/users/astrofrog/gists{/gist_id}","starred_url":"https://api.github.com/users/astrofrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astrofrog/subscriptions","organizations_url":"https://api.github.com/users/astrofrog/orgs","repos_url":"https://api.github.com/users/astrofrog/repos","events_url":"https://api.github.com/users/astrofrog/events{/privacy}","received_events_url":"https://api.github.com/users/astrofrog/received_events","type":"User","site_admin":false},"body":"I think we should use ``u.one` in that case:\r\n\r\n```\r\nIn [5]: %timeit u.Unit(1)\r\n100000 loops, best of 3: 11.3 µs per loop\r\n\r\nIn [6]: %timeit u.one\r\n10000000 loops, best of 3: 134 ns per loop\r\n```","created_at":"2014-04-19T15:33:41Z","updated_at":"2014-04-19T15:33:41Z","html_url":"https://github.com/radio-tools/spectral-cube/pull/53#discussion_r11794192","pull_request_url":"https://api.github.com/repos/radio-tools/spectral-cube/pulls/53","_links":{"self":{"href":"https://api.github.com/repos/radio-tools/spectral-cube/pulls/comments/11794192"},"html":{"href":"https://github.com/radio-tools/spectral-cube/pull/53#discussion_r11794192"},"pull_request":{"href":"https://api.github.com/repos/radio-tools/spectral-cube/pulls/53"}}}}