{"action":"created","comment":{"url":"https://api.github.com/repos/linetools/linetools/pulls/comments/45898430","id":45898430,"diff_hunk":"@@ -0,0 +1,202 @@\n+\"\"\" Class for  absorption systems\n+\"\"\"\n+from __future__ import print_function, absolute_import, division, unicode_literals\n+\n+# Python 2 & 3 compatibility\n+try:\n+    basestring\n+except NameError:\n+    basestring = str\n+\n+import numpy as np\n+import warnings\n+from abc import ABCMeta\n+\n+from astropy import units as u\n+from astropy.table import QTable\n+from astropy import constants as const\n+from astropy.coordinates import SkyCoord\n+\n+from linetools.isgm.abscomponent import AbsComponent\n+\n+class AbsSystem(object):\n+    \"\"\"\n+    Class for an absorption line system\n+\n+    Parameters\n+    ----------\n+    abs_type : str\n+      Type of absorption system, e.g. MgII, DLA, LLS\n+    radec : tuple or coordinate\n+        RA/Dec of the sightline or astropy.coordinate\n+    zabs : float\n+      Absorption redshift\n+    vlim : Quantity array (2)\n+      Velocity limits of the system\n+    zem : float, optional\n+      Emission redshift of background source\n+    NHI :  float, optional\n+      Log10 of the HI column density\n+    sigNHI :  np.array(2), optional\n+      Log10 error of the HI column density (-/+)\n+    name : str, optional\n+      Name for the system\n+\n+    Attributes\n+    ----------\n+        abs_type : str\n+        coord : SkyCoord\n+            RA/Dec of the sightline\n+        zabs : float\n+          Absorption redshift\n+        zem : float\n+          Emission redshift of background source\n+        vlim : Quantity array (2)\n+          Velocity limits of the system\n+        NHI :  float\n+          Log10 of the HI column density\n+        sigNHI :  np.array(2)\n+          Log10 error of the HI column density (-/+)\n+        MH :  float\n+          Metallicity (log10)\n+        name : str\n+            Name of the system\n+    \"\"\"\n+\n+    __metaclass__ = ABCMeta\n+\n+    @classmethod\n+    def from_components(cls, components):\n+        \"\"\"Instantiate from a list of AbsComponent objects\n+\n+        Parameters\n+        ----------\n+        components : list\n+          List of AbsComponent objects\n+        \"\"\"\n+        # Check\n+        if not isinstance(components,list):\n+            raise IOError('Need a list of AbsComponent objects')\n+        if not all(isinstance(x,AbsComponent) for x in components):\n+            raise IOError('List needs to contain AbsLine objects')\n+        # Instantiate with the first component\n+        init_comp = components[0]\n+        slf = cls(init_comp.coord, init_comp.zcomp, init_comp.vlim)\n+        if slf.chk_component(init_comp):\n+            slf._components.append(init_comp)\n+        else:\n+            raise IOError(\"Bad component input\")\n+        # Append with component checking\n+        if len(components) > 1:\n+            for component in components[1:]:\n+                slf.add_component(component)\n+        # Return\n+        return slf\n+\n+    def __init__(self, abs_type, radec, zabs, vlim, zem=0., NHI=0., sigNHI=np.zeros(2), name=''):\n+\n+        self.zabs = zabs\n+        self.zem = zem\n+        self.vlim = vlim\n+        self.NHI = NHI\n+        self.sigNHI = sigNHI\n+        # RA/DEC\n+        if isinstance(radec,(tuple)):\n+            self.coord = SkyCoord(ra=radec[0], dec=radec[1])\n+        elif isinstance(radec,SkyCoord):\n+            self.coord = radec\n+        self.name = name\n+\n+        # Abs type\n+        if abs_type == None:\n+            self.abs_type = 'NONE'\n+        else:\n+            self.abs_type = abs_type\n+\n+        # Components\n+        self._components = []  # List of AbsComponent objects\n+\n+        # Kinematics\n+        self.kin = {}\n+\n+        # Abundances\n+        self._EW = QTable()\n+        self._ionclms = QTable()\n+        self._ionstate = {}\n+        self._abund = QTable()\n+\n+        # Refs (list of references)\n+        self.Refs = []\n+\n+    def add_component(self, abscomp, toler=0.1*u.arcsec):\n+        \"\"\"Add an AbsComponent object it satisfies all of the rules.","path":"linetools/isgm/abssystem.py","position":132,"original_position":132,"commit_id":"3530a846f0e55b933020599404c02759dad4167b","original_commit_id":"3530a846f0e55b933020599404c02759dad4167b","user":{"login":"ntejos","id":2862340,"avatar_url":"https://avatars.githubusercontent.com/u/2862340?v=3","gravatar_id":"","url":"https://api.github.com/users/ntejos","html_url":"https://github.com/ntejos","followers_url":"https://api.github.com/users/ntejos/followers","following_url":"https://api.github.com/users/ntejos/following{/other_user}","gists_url":"https://api.github.com/users/ntejos/gists{/gist_id}","starred_url":"https://api.github.com/users/ntejos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntejos/subscriptions","organizations_url":"https://api.github.com/users/ntejos/orgs","repos_url":"https://api.github.com/users/ntejos/repos","events_url":"https://api.github.com/users/ntejos/events{/privacy}","received_events_url":"https://api.github.com/users/ntejos/received_events","type":"User","site_admin":false},"body":"'it satisfies' -> 'if it satisfies'","created_at":"2015-11-25T17:55:14Z","updated_at":"2015-11-25T17:55:14Z","html_url":"https://github.com/linetools/linetools/pull/92#discussion_r45898430","pull_request_url":"https://api.github.com/repos/linetools/linetools/pulls/92","_links":{"self":{"href":"https://api.github.com/repos/linetools/linetools/pulls/comments/45898430"},"html":{"href":"https://github.com/linetools/linetools/pull/92#discussion_r45898430"},"pull_request":{"href":"https://api.github.com/repos/linetools/linetools/pulls/92"}}},"pull_request":{"url":"https://api.github.com/repos/linetools/linetools/pulls/92","id":51815992,"html_url":"https://github.com/linetools/linetools/pull/92","diff_url":"https://github.com/linetools/linetools/pull/92.diff","patch_url":"https://github.com/linetools/linetools/pull/92.patch","issue_url":"https://api.github.com/repos/linetools/linetools/issues/92","number":92,"state":"open","locked":false,"title":"AbsSystem  --  First steps","user":{"login":"profxj","id":3998093,"avatar_url":"https://avatars.githubusercontent.com/u/3998093?v=3","gravatar_id":"","url":"https://api.github.com/users/profxj","html_url":"https://github.com/profxj","followers_url":"https://api.github.com/users/profxj/followers","following_url":"https://api.github.com/users/profxj/following{/other_user}","gists_url":"https://api.github.com/users/profxj/gists{/gist_id}","starred_url":"https://api.github.com/users/profxj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profxj/subscriptions","organizations_url":"https://api.github.com/users/profxj/orgs","repos_url":"https://api.github.com/users/profxj/repos","events_url":"https://api.github.com/users/profxj/events{/privacy}","received_events_url":"https://api.github.com/users/profxj/received_events","type":"User","site_admin":false},"body":"AbsSystem class\r\ninstantiation from __init__ and components\r\ntests\r\ndocs started\r\nexample notebook","created_at":"2015-11-25T16:26:10Z","updated_at":"2015-11-25T17:55:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3d0ef047644775824ae818b1e5750008af51a42","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/linetools/linetools/pulls/92/commits","review_comments_url":"https://api.github.com/repos/linetools/linetools/pulls/92/comments","review_comment_url":"https://api.github.com/repos/linetools/linetools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linetools/linetools/issues/92/comments","statuses_url":"https://api.github.com/repos/linetools/linetools/statuses/3530a846f0e55b933020599404c02759dad4167b","head":{"label":"profxj:abssystem","ref":"abssystem","sha":"3530a846f0e55b933020599404c02759dad4167b","user":{"login":"profxj","id":3998093,"avatar_url":"https://avatars.githubusercontent.com/u/3998093?v=3","gravatar_id":"","url":"https://api.github.com/users/profxj","html_url":"https://github.com/profxj","followers_url":"https://api.github.com/users/profxj/followers","following_url":"https://api.github.com/users/profxj/following{/other_user}","gists_url":"https://api.github.com/users/profxj/gists{/gist_id}","starred_url":"https://api.github.com/users/profxj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profxj/subscriptions","organizations_url":"https://api.github.com/users/profxj/orgs","repos_url":"https://api.github.com/users/profxj/repos","events_url":"https://api.github.com/users/profxj/events{/privacy}","received_events_url":"https://api.github.com/users/profxj/received_events","type":"User","site_admin":false},"repo":{"id":36232893,"name":"linetools","full_name":"profxj/linetools","owner":{"login":"profxj","id":3998093,"avatar_url":"https://avatars.githubusercontent.com/u/3998093?v=3","gravatar_id":"","url":"https://api.github.com/users/profxj","html_url":"https://github.com/profxj","followers_url":"https://api.github.com/users/profxj/followers","following_url":"https://api.github.com/users/profxj/following{/other_user}","gists_url":"https://api.github.com/users/profxj/gists{/gist_id}","starred_url":"https://api.github.com/users/profxj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profxj/subscriptions","organizations_url":"https://api.github.com/users/profxj/orgs","repos_url":"https://api.github.com/users/profxj/repos","events_url":"https://api.github.com/users/profxj/events{/privacy}","received_events_url":"https://api.github.com/users/profxj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/profxj/linetools","description":"","fork":true,"url":"https://api.github.com/repos/profxj/linetools","forks_url":"https://api.github.com/repos/profxj/linetools/forks","keys_url":"https://api.github.com/repos/profxj/linetools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/profxj/linetools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/profxj/linetools/teams","hooks_url":"https://api.github.com/repos/profxj/linetools/hooks","issue_events_url":"https://api.github.com/repos/profxj/linetools/issues/events{/number}","events_url":"https://api.github.com/repos/profxj/linetools/events","assignees_url":"https://api.github.com/repos/profxj/linetools/assignees{/user}","branches_url":"https://api.github.com/repos/profxj/linetools/branches{/branch}","tags_url":"https://api.github.com/repos/profxj/linetools/tags","blobs_url":"https://api.github.com/repos/profxj/linetools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/profxj/linetools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/profxj/linetools/git/refs{/sha}","trees_url":"https://api.github.com/repos/profxj/linetools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/profxj/linetools/statuses/{sha}","languages_url":"https://api.github.com/repos/profxj/linetools/languages","stargazers_url":"https://api.github.com/repos/profxj/linetools/stargazers","contributors_url":"https://api.github.com/repos/profxj/linetools/contributors","subscribers_url":"https://api.github.com/repos/profxj/linetools/subscribers","subscription_url":"https://api.github.com/repos/profxj/linetools/subscription","commits_url":"https://api.github.com/repos/profxj/linetools/commits{/sha}","git_commits_url":"https://api.github.com/repos/profxj/linetools/git/commits{/sha}","comments_url":"https://api.github.com/repos/profxj/linetools/comments{/number}","issue_comment_url":"https://api.github.com/repos/profxj/linetools/issues/comments{/number}","contents_url":"https://api.github.com/repos/profxj/linetools/contents/{+path}","compare_url":"https://api.github.com/repos/profxj/linetools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/profxj/linetools/merges","archive_url":"https://api.github.com/repos/profxj/linetools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/profxj/linetools/downloads","issues_url":"https://api.github.com/repos/profxj/linetools/issues{/number}","pulls_url":"https://api.github.com/repos/profxj/linetools/pulls{/number}","milestones_url":"https://api.github.com/repos/profxj/linetools/milestones{/number}","notifications_url":"https://api.github.com/repos/profxj/linetools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/profxj/linetools/labels{/name}","releases_url":"https://api.github.com/repos/profxj/linetools/releases{/id}","created_at":"2015-05-25T13:29:45Z","updated_at":"2015-05-25T13:29:45Z","pushed_at":"2015-11-25T16:16:04Z","git_url":"git://github.com/profxj/linetools.git","ssh_url":"git@github.com:profxj/linetools.git","clone_url":"https://github.com/profxj/linetools.git","svn_url":"https://github.com/profxj/linetools","homepage":null,"size":6154,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"linetools:master","ref":"master","sha":"8f48a2ce5e14546fc8a0f17678483dd3c8d4337e","user":{"login":"linetools","id":12589255,"avatar_url":"https://avatars.githubusercontent.com/u/12589255?v=3","gravatar_id":"","url":"https://api.github.com/users/linetools","html_url":"https://github.com/linetools","followers_url":"https://api.github.com/users/linetools/followers","following_url":"https://api.github.com/users/linetools/following{/other_user}","gists_url":"https://api.github.com/users/linetools/gists{/gist_id}","starred_url":"https://api.github.com/users/linetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linetools/subscriptions","organizations_url":"https://api.github.com/users/linetools/orgs","repos_url":"https://api.github.com/users/linetools/repos","events_url":"https://api.github.com/users/linetools/events{/privacy}","received_events_url":"https://api.github.com/users/linetools/received_events","type":"Organization","site_admin":false},"repo":{"id":36200517,"name":"linetools","full_name":"linetools/linetools","owner":{"login":"linetools","id":12589255,"avatar_url":"https://avatars.githubusercontent.com/u/12589255?v=3","gravatar_id":"","url":"https://api.github.com/users/linetools","html_url":"https://github.com/linetools","followers_url":"https://api.github.com/users/linetools/followers","following_url":"https://api.github.com/users/linetools/following{/other_user}","gists_url":"https://api.github.com/users/linetools/gists{/gist_id}","starred_url":"https://api.github.com/users/linetools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linetools/subscriptions","organizations_url":"https://api.github.com/users/linetools/orgs","repos_url":"https://api.github.com/users/linetools/repos","events_url":"https://api.github.com/users/linetools/events{/privacy}","received_events_url":"https://api.github.com/users/linetools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linetools/linetools","description":"A package for the analysis of 1d astronomical spectra, especially quasar and galaxy spectra.","fork":false,"url":"https://api.github.com/repos/linetools/linetools","forks_url":"https://api.github.com/repos/linetools/linetools/forks","keys_url":"https://api.github.com/repos/linetools/linetools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linetools/linetools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linetools/linetools/teams","hooks_url":"https://api.github.com/repos/linetools/linetools/hooks","issue_events_url":"https://api.github.com/repos/linetools/linetools/issues/events{/number}","events_url":"https://api.github.com/repos/linetools/linetools/events","assignees_url":"https://api.github.com/repos/linetools/linetools/assignees{/user}","branches_url":"https://api.github.com/repos/linetools/linetools/branches{/branch}","tags_url":"https://api.github.com/repos/linetools/linetools/tags","blobs_url":"https://api.github.com/repos/linetools/linetools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linetools/linetools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linetools/linetools/git/refs{/sha}","trees_url":"https://api.github.com/repos/linetools/linetools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linetools/linetools/statuses/{sha}","languages_url":"https://api.github.com/repos/linetools/linetools/languages","stargazers_url":"https://api.github.com/repos/linetools/linetools/stargazers","contributors_url":"https://api.github.com/repos/linetools/linetools/contributors","subscribers_url":"https://api.github.com/repos/linetools/linetools/subscribers","subscription_url":"https://api.github.com/repos/linetools/linetools/subscription","commits_url":"https://api.github.com/repos/linetools/linetools/commits{/sha}","git_commits_url":"https://api.github.com/repos/linetools/linetools/git/commits{/sha}","comments_url":"https://api.github.com/repos/linetools/linetools/comments{/number}","issue_comment_url":"https://api.github.com/repos/linetools/linetools/issues/comments{/number}","contents_url":"https://api.github.com/repos/linetools/linetools/contents/{+path}","compare_url":"https://api.github.com/repos/linetools/linetools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linetools/linetools/merges","archive_url":"https://api.github.com/repos/linetools/linetools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linetools/linetools/downloads","issues_url":"https://api.github.com/repos/linetools/linetools/issues{/number}","pulls_url":"https://api.github.com/repos/linetools/linetools/pulls{/number}","milestones_url":"https://api.github.com/repos/linetools/linetools/milestones{/number}","notifications_url":"https://api.github.com/repos/linetools/linetools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linetools/linetools/labels{/name}","releases_url":"https://api.github.com/repos/linetools/linetools/releases{/id}","created_at":"2015-05-25T00:15:17Z","updated_at":"2015-11-17T23:54:48Z","pushed_at":"2015-11-25T16:26:10Z","git_url":"git://github.com/linetools/linetools.git","ssh_url":"git@github.com:linetools/linetools.git","clone_url":"https://github.com/linetools/linetools.git","svn_url":"https://github.com/linetools/linetools","homepage":"","size":6139,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":7,"forks":4,"open_issues":7,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linetools/linetools/pulls/92"},"html":{"href":"https://github.com/linetools/linetools/pull/92"},"issue":{"href":"https://api.github.com/repos/linetools/linetools/issues/92"},"comments":{"href":"https://api.github.com/repos/linetools/linetools/issues/92/comments"},"review_comments":{"href":"https://api.github.com/repos/linetools/linetools/pulls/92/comments"},"review_comment":{"href":"https://api.github.com/repos/linetools/linetools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linetools/linetools/pulls/92/commits"},"statuses":{"href":"https://api.github.com/repos/linetools/linetools/statuses/3530a846f0e55b933020599404c02759dad4167b"}}}}