{"action":"created","issue":{"url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/591","repository_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy","labels_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/591/labels{/name}","comments_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/591/comments","events_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/591/events","html_url":"https://github.com/PlasmaPy/PlasmaPy/pull/591","id":394800158,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxNDQ5Mzcz","number":591,"title":"Put isotope data into JSON","user":{"login":"StanczakDominik","id":11289391,"node_id":"MDQ6VXNlcjExMjg5Mzkx","avatar_url":"https://avatars0.githubusercontent.com/u/11289391?v=4","gravatar_id":"","url":"https://api.github.com/users/StanczakDominik","html_url":"https://github.com/StanczakDominik","followers_url":"https://api.github.com/users/StanczakDominik/followers","following_url":"https://api.github.com/users/StanczakDominik/following{/other_user}","gists_url":"https://api.github.com/users/StanczakDominik/gists{/gist_id}","starred_url":"https://api.github.com/users/StanczakDominik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StanczakDominik/subscriptions","organizations_url":"https://api.github.com/users/StanczakDominik/orgs","repos_url":"https://api.github.com/users/StanczakDominik/repos","events_url":"https://api.github.com/users/StanczakDominik/events{/privacy}","received_events_url":"https://api.github.com/users/StanczakDominik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-29T14:27:53Z","updated_at":"2018-12-29T18:44:56Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/pulls/591","html_url":"https://github.com/PlasmaPy/PlasmaPy/pull/591","diff_url":"https://github.com/PlasmaPy/PlasmaPy/pull/591.diff","patch_url":"https://github.com/PlasmaPy/PlasmaPy/pull/591.patch"},"body":"Continues [a discussion we've had on Matrix](https://matrix.to/#/!hkWCiyhQyxiYJlUtKF:matrix.org/$1546027415314043ntuti:matrix.org?via=matrix.org&via=openastronomy.org&via=cadair.com&via=t2bot.io). I dumped everything into json like this:\r\n```python\r\nIn [41]: def convert(x): \r\n    ...:     if x.unit == u.u: \r\n    ...:         return x.value \r\n    ...:     else: \r\n    ...:         return x.si.value \r\n    ...:           \r\nIn [42]: with open(\"isotopes.json\", \"w\") as f: \r\n    ...:     json.dump(isotopes._Isotopes, f, default=convert, indent=2) \r\n```\r\n\r\nAnd, given that the diff is large, this is how I was able to recreate the dict with units:\r\n\r\n```python\r\n\"\"\"\r\nCreate a dictionary containing basic information for isotopes and\r\nneutrons.\r\n\"\"\"\r\n\r\nimport astropy.units as u\r\nimport json\r\nimport os\r\n\r\nwith open(os.path.join(os.path.dirname(__file__), \"isotopes.json\")) as f:\r\n    _Isotopes = json.load(f)\r\n\r\nfor isotope in _Isotopes:         # I'm kind of suspecting that something smarter than a for loop could be done here\r\n    _Isotopes[isotope][\"mass\"] *= u.u\r\n    if \"half-life\" in _Isotopes[isotope] and not isinstance(\r\n            _Isotopes[isotope][\"half-life\"], str):\r\n        _Isotopes[isotope][\"half-life\"] *= u.s\r\n````\r\n\r\nAs a check, with the old version imported and the new version in local scope:\r\n```python\r\nIn [40]: isotopes._Isotopes == _Isotopes                                                                                                                           \r\nOut[40]: True\r\n```"},"comment":{"url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/comments/450512222","html_url":"https://github.com/PlasmaPy/PlasmaPy/pull/591#issuecomment-450512222","issue_url":"https://api.github.com/repos/PlasmaPy/PlasmaPy/issues/591","id":450512222,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDUxMjIyMg==","user":{"login":"namurphy","id":8931994,"node_id":"MDQ6VXNlcjg5MzE5OTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8931994?v=4","gravatar_id":"","url":"https://api.github.com/users/namurphy","html_url":"https://github.com/namurphy","followers_url":"https://api.github.com/users/namurphy/followers","following_url":"https://api.github.com/users/namurphy/following{/other_user}","gists_url":"https://api.github.com/users/namurphy/gists{/gist_id}","starred_url":"https://api.github.com/users/namurphy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namurphy/subscriptions","organizations_url":"https://api.github.com/users/namurphy/orgs","repos_url":"https://api.github.com/users/namurphy/repos","events_url":"https://api.github.com/users/namurphy/events{/privacy}","received_events_url":"https://api.github.com/users/namurphy/received_events","type":"User","site_admin":false},"created_at":"2018-12-29T18:44:56Z","updated_at":"2018-12-29T18:44:56Z","author_association":"MEMBER","body":"Putting the isotopes information into json format is a worthwhile idea.  It would probably make sense to do the same for `elements.py` for consistency.  Another possibility would be to create a json file containing information for particles and antiparticles, though this would be a little more involved since `special_particles.py` contains code that sets some of the particle attributes, so it could be relegated to another issue.  \r\n\r\nRelated issues: #18, #104, #275"}}
{"actor":{"display_login":"namurphy"}}