{"action":"closed","issue":{"url":"https://api.github.com/repos/jrsmith3/tec/issues/68","labels_url":"https://api.github.com/repos/jrsmith3/tec/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/jrsmith3/tec/issues/68/comments","events_url":"https://api.github.com/repos/jrsmith3/tec/issues/68/events","html_url":"https://github.com/jrsmith3/tec/issues/68","id":54380152,"number":68,"title":"`tec.TECBase.calc_contact_potential` raises TypeError","user":{"login":"jrsmith3","id":204215,"avatar_url":"https://avatars.githubusercontent.com/u/204215?v=3","gravatar_id":"","url":"https://api.github.com/users/jrsmith3","html_url":"https://github.com/jrsmith3","followers_url":"https://api.github.com/users/jrsmith3/followers","following_url":"https://api.github.com/users/jrsmith3/following{/other_user}","gists_url":"https://api.github.com/users/jrsmith3/gists{/gist_id}","starred_url":"https://api.github.com/users/jrsmith3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrsmith3/subscriptions","organizations_url":"https://api.github.com/users/jrsmith3/orgs","repos_url":"https://api.github.com/users/jrsmith3/repos","events_url":"https://api.github.com/users/jrsmith3/events{/privacy}","received_events_url":"https://api.github.com/users/jrsmith3/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jrsmith3/tec/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-14T21:36:40Z","updated_at":"2015-01-15T22:27:08Z","closed_at":"2015-01-15T22:27:08Z","body":"Upon successful instantiation of a `tec.TECBase` object, the `tec.TECBase.calc_contact_potential` unexpectedly raises a `TypeError`. This exception was first noted in commit 95082ca3f9ab54b85ae7a5cc1091aab9c0d1bfea.\r\n \r\n\r\nExample code\r\n============\r\n```python\r\nfrom tec.electrode import Metal\r\nfrom tec import TECBase\r\n\r\nem = Metal(temp=1000., barrier=2., richardson=10.)\r\nco = Metal(temp=300., barrier=1., richardson=10., position=10.)\r\nt = TECBase(em, co)\r\nt.calc_contact_potential()\r\n```\r\n\r\n\r\nTraceback\r\n=========\r\n```\r\n---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\n<ipython-input-1-a7c76885e5d7> in <module>()\r\n      5 co = Metal(temp=300., barrier=1., richardson=10., position=10.)\r\n      6 t = TECBase(em, co)\r\n----> 7 t.calc_contact_potential()\r\n\r\n/Users/jrsmith3/Documents/work/tec/tec/base.pyc in calc_contact_potential(self)\r\n    110         The contact potential is defined as the difference in barrier height between the emitter and collector. This value should not be confused with the quantity returned by :meth:`calc_output_voltage` which is the voltage difference between the collector and emitter.\r\n    111         \"\"\"\r\n--> 112         return (self.emitter.barrier - self.collector.barrier) / constants.e\r\n    113 \r\n    114 \r\n\r\n/Users/jrsmith3/anaconda/lib/python2.7/site-packages/astropy/constants/constant.pyc in wrapper(self, *args, **kwargs)\r\n     55                         'combined with other values without specifying a '\r\n     56                         'system (eg. {1}.{2})'.format(self.abbrev, self.abbrev,\r\n---> 57                                                       systems[0]))\r\n     58 \r\n     59                 return meth(self, *args, **kwargs)\r\n\r\nTypeError: Constant u'e' does not have physically compatible units across all systems of units and cannot be combined with other values without specifying a system (eg. e.emu)\r\n```\r\n\r\nEnvironment\r\n===========\r\nSee issue #66.\r\n\r\n\r\nAdditional information\r\n======================\r\nI first experienced this bug after writing `test/test_TECBase.py:CalculatorsReturnType.test_calc_contact_potential` in commit 95082ca3f9ab54b85ae7a5cc1091aab9c0d1bfea.\r\n\r\nThe offending code was introduced in a6764d23.\r\n\r\n\r\nSolution\r\n========\r\nI'm pretty sure I had a similar issue in `tec.electrode.Metal.calc_motive` (see 24b82b1e). I fixed the problem before I was doing more careful issue tracking, so there's no associated issue. \r\n\r\nThe solution to the present issue is to replace `constants.e` with `constants.e.si`.\r\n"}}