{"action":"closed","issue":{"url":"https://api.github.com/repos/astropy/astropy/issues/5342","repository_url":"https://api.github.com/repos/astropy/astropy","labels_url":"https://api.github.com/repos/astropy/astropy/issues/5342/labels{/name}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/5342/comments","events_url":"https://api.github.com/repos/astropy/astropy/issues/5342/events","html_url":"https://github.com/astropy/astropy/issues/5342","id":177661719,"number":5342,"title":"Handling of logarithmic units in tables inconsistent and breaks matching","user":{"login":"jbrinchmann","id":3051221,"avatar_url":"https://avatars.githubusercontent.com/u/3051221?v=3","gravatar_id":"","url":"https://api.github.com/users/jbrinchmann","html_url":"https://github.com/jbrinchmann","followers_url":"https://api.github.com/users/jbrinchmann/followers","following_url":"https://api.github.com/users/jbrinchmann/following{/other_user}","gists_url":"https://api.github.com/users/jbrinchmann/gists{/gist_id}","starred_url":"https://api.github.com/users/jbrinchmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbrinchmann/subscriptions","organizations_url":"https://api.github.com/users/jbrinchmann/orgs","repos_url":"https://api.github.com/users/jbrinchmann/repos","events_url":"https://api.github.com/users/jbrinchmann/events{/privacy}","received_events_url":"https://api.github.com/users/jbrinchmann/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/astropy/astropy/labels/Bug","name":"Bug","color":"eb6420"},{"url":"https://api.github.com/repos/astropy/astropy/labels/table","name":"table","color":"c7def8"},{"url":"https://api.github.com/repos/astropy/astropy/labels/units","name":"units","color":"c7def8"}],"state":"closed","locked":false,"assignee":{"login":"mhvk","id":2789820,"avatar_url":"https://avatars.githubusercontent.com/u/2789820?v=3","gravatar_id":"","url":"https://api.github.com/users/mhvk","html_url":"https://github.com/mhvk","followers_url":"https://api.github.com/users/mhvk/followers","following_url":"https://api.github.com/users/mhvk/following{/other_user}","gists_url":"https://api.github.com/users/mhvk/gists{/gist_id}","starred_url":"https://api.github.com/users/mhvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhvk/subscriptions","organizations_url":"https://api.github.com/users/mhvk/orgs","repos_url":"https://api.github.com/users/mhvk/repos","events_url":"https://api.github.com/users/mhvk/events{/privacy}","received_events_url":"https://api.github.com/users/mhvk/received_events","type":"User","site_admin":false},"assignees":[{"login":"mhvk","id":2789820,"avatar_url":"https://avatars.githubusercontent.com/u/2789820?v=3","gravatar_id":"","url":"https://api.github.com/users/mhvk","html_url":"https://github.com/mhvk","followers_url":"https://api.github.com/users/mhvk/followers","following_url":"https://api.github.com/users/mhvk/following{/other_user}","gists_url":"https://api.github.com/users/mhvk/gists{/gist_id}","starred_url":"https://api.github.com/users/mhvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhvk/subscriptions","organizations_url":"https://api.github.com/users/mhvk/orgs","repos_url":"https://api.github.com/users/mhvk/repos","events_url":"https://api.github.com/users/mhvk/events{/privacy}","received_events_url":"https://api.github.com/users/mhvk/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/astropy/astropy/milestones/41","html_url":"https://github.com/astropy/astropy/milestones/v1.2.2","labels_url":"https://api.github.com/repos/astropy/astropy/milestones/41/labels","id":1847447,"number":41,"title":"v1.2.2","description":"","creator":{"login":"astrofrog","id":314716,"avatar_url":"https://avatars.githubusercontent.com/u/314716?v=3","gravatar_id":"","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},"open_issues":6,"closed_issues":34,"state":"open","created_at":"2016-06-24T16:24:28Z","updated_at":"2016-09-24T15:09:41Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-09-18T16:35:51Z","updated_at":"2016-09-24T15:09:40Z","closed_at":"2016-09-24T15:09:40Z","body":"I have tried to use logarithmic units in my table columns but this seems to work less than optimal - at least the way I have created them. I have an example piece of code below, but the two problems are:\r\n\r\n1. A column created to have  a logarithmic unit [e.g.: t['log_R'] = u.dex(u.pc)], is created as a Quantity column and has no 'physical' attribute:\r\n   e.g. t['log_R'].quantity.value works, but t['log_R'].quantity.physical gives\r\n\r\n```\r\n/Users/jarle/anaconda/lib/python2.7/site-packages/astropy/units/quantity.pyc in __getattr__(self, attr)\r\n    732                 \"'{0}' object has no '{1}' member\".format(\r\n    733                     self.__class__.__name__,\r\n--> 734                     attr))\r\n    735 \r\n    736         def get_virtual_unit_attribute():\r\n\r\nAttributeError: 'Quantity' object has no 'physical' member\r\n```\r\n\r\n\r\n2. When trying to join tables with logarithmic quantities, the join fails with:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/jarle/Desktop/example_problem.py\", line 27, in <module>\r\n    print astropy.table.join(tbl1, tbl2, keys=['col1'])\r\n  File \"/Users/jarle/anaconda/lib/python2.7/site-packages/astropy/table/operations.py\", line 188, in join\r\n    _merge_col_meta(out, [left, right], col_name_map, metadata_conflicts=metadata_conflicts)\r\n  File \"/Users/jarle/anaconda/lib/python2.7/site-packages/astropy/table/operations.py\", line 70, in _merge_col_meta\r\n    elif left_attr != right_attr:\r\n  File \"/Users/jarle/anaconda/lib/python2.7/site-packages/astropy/units/function/core.py\", line 291, in __ne__\r\n    self.funtional_unit != getattr(other, 'function_unit', other))\r\nAttributeError: 'DexUnit' object has no attribute 'funtional_unit'\r\n```\r\n\r\nAn example code that reproduces this is given below. \r\n\r\nThis is certainly not what I expected, but it might be that I have misunderstood the way I should indicate units on the columns! \r\n\r\n\r\n```\r\n# Show how joins break when logarithmic units are included  - the first join succeeds \r\n# and prints out the combined table, while the second fails\r\nimport astropy.units as u\r\nfrom astropy.io import ascii\r\nimport astropy.table\r\n\r\n# Create two simple example tables\r\nt1 = \"\"\"\r\na 5.2\r\nb 7.2\r\n\"\"\"\r\n\r\nt2 = \"\"\"\r\na 6.3\r\nc 7.4\r\nb 1.2\r\n\"\"\"\r\n\r\ntbl1 = ascii.read(t1, format='fixed_width_no_header', delimiter=' ')\r\ntbl2 = ascii.read(t2, format='fixed_width_no_header', delimiter=' ')\r\n\r\n# Simple units:\r\ntbl1['col2'].unit = u.kilometer\r\n\r\nprint astropy.table.join(tbl1, tbl2, keys=['col1'])\r\n\r\n# Logarithmic units\r\ntbl1['col2'].unit = u.dex()\r\nprint astropy.table.join(tbl1, tbl2, keys=['col1'])\r\n\r\n```"}}
{"actor":{"display_login":"mhvk"}}