{"action":"created","comment":{"url":"https://api.github.com/repos/lsst/meas_base/pulls/comments/61098051","id":61098051,"diff_hunk":"@@ -0,0 +1,181 @@\n+import numpy as np\n+\n+import unittest\n+import lsst.utils.tests as utilsTests\n+\n+import lsst.meas.base.afterburner as AB\n+import lsst.afw.table as afwTable\n+from lsst.meas.base.pluginsBase import BasePlugin\n+from lsst.meas.base.pluginRegistry import register\n+from lsst.meas.base.baseLib import MeasurementError\n+\n+@register(\"afterburnerFail\")\n+class FailAb(AB.AfterburnerPlugin):\n+    '''\n+    Afterburner plugin which is guaranteed to fail, testing the failure framework\n+    '''\n+    @classmethod\n+    def getExecutionOrder(cls):\n+        return cls.DEFAULT_AFTERBURNER\n+\n+    def __init__(self, config, name, schema, metadata):\n+        AB.AfterburnerPlugin.__init__(self, config, name, schema, metadata)\n+        self.failKey = schema.addField(name+\"_fail\", type=\"Flag\", doc=\"Failure test\")\n+\n+    def burn(self, measRecord):\n+        raise MeasurementError(\"Supposed to fail\", 0)\n+\n+    def fail(self, measRecord, error=None):\n+        measRecord.set(self.failKey, True)\n+\n+@register(\"singleRecordAfterburner\")\n+class SingleRecordAb(AB.AfterburnerPlugin):\n+    '''\n+    Afterburner plugin which works in single mode. It takes a single record, reads a value, squares it, and\n+    writes out the results to the record\n+    '''\n+    @classmethod\n+    def getExecutionOrder(cls):\n+        return cls.DEFAULT_AFTERBURNER\n+\n+    def __init__(self, config, name, schema, metadata):\n+        AB.AfterburnerPlugin.__init__(self, config, name, schema, metadata)\n+        self.failKey = schema.addField(name+\"_fail\", type=\"Flag\", doc=\"Failure flag\")\n+        self.squareKey = schema.addField(name+\"_square\", type=\"D\", doc=\"Square of input catalog\")\n+\n+    def burn(self, measRecord):\n+        value = measRecord.get(\"start\")\n+        measRecord.set(self.squareKey, value**2)\n+\n+    def fail(self, measRecord, error=None):\n+        measRecord.set(self.failKey, True)\n+\n+@register(\"multiRecordAfterburner\")\n+class MultiRecordAb(AB.AfterburnerPlugin):\n+    '''\n+    Afterburner plugin to test the framework in multimode. This plugin takes the whole source catalog at\n+    onece, and loops over the catalog internally. The algorithm simply reads a value, cubes it, and writes the\n+    results out to the table\n+    '''\n+    @classmethod\n+    def getExecutionOrder(cls):\n+        return cls.DEFAULT_AFTERBURNER\n+\n+    @property\n+    def PlugType(self):\n+        return 'multi'\n+\n+    def __init__(self, config, name, schema, metadata):\n+        AB.AfterburnerPlugin.__init__(self, config, name, schema, metadata)\n+        self.failKey = schema.addField(name+\"_fail\", type=\"Flag\", doc=\"Failure flag\")\n+        self.cubeKey = schema.addField(name+\"_cube\", type=\"D\", doc=\"Cube of input catalog\")","path":"tests/testAfterburners.py","position":71,"original_position":71,"commit_id":"7dd3a6d0f087bc8a6cc88f13bb5b1b8a2f546295","original_commit_id":"2e56c762c32d00efc90b6204f9a34513b815babb","user":{"login":"natelust","id":6371766,"avatar_url":"https://avatars.githubusercontent.com/u/6371766?v=3","gravatar_id":"","url":"https://api.github.com/users/natelust","html_url":"https://github.com/natelust","followers_url":"https://api.github.com/users/natelust/followers","following_url":"https://api.github.com/users/natelust/following{/other_user}","gists_url":"https://api.github.com/users/natelust/gists{/gist_id}","starred_url":"https://api.github.com/users/natelust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natelust/subscriptions","organizations_url":"https://api.github.com/users/natelust/orgs","repos_url":"https://api.github.com/users/natelust/repos","events_url":"https://api.github.com/users/natelust/events{/privacy}","received_events_url":"https://api.github.com/users/natelust/received_events","type":"User","site_admin":false},"body":"done","created_at":"2016-04-26T14:42:31Z","updated_at":"2016-04-26T14:42:31Z","html_url":"https://github.com/lsst/meas_base/pull/33#discussion_r61098051","pull_request_url":"https://api.github.com/repos/lsst/meas_base/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/lsst/meas_base/pulls/comments/61098051"},"html":{"href":"https://github.com/lsst/meas_base/pull/33#discussion_r61098051"},"pull_request":{"href":"https://api.github.com/repos/lsst/meas_base/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/lsst/meas_base/pulls/33","id":67549221,"html_url":"https://github.com/lsst/meas_base/pull/33","diff_url":"https://github.com/lsst/meas_base/pull/33.diff","patch_url":"https://github.com/lsst/meas_base/pull/33.patch","issue_url":"https://api.github.com/repos/lsst/meas_base/issues/33","number":33,"state":"open","locked":false,"title":"DM-4887: Refactor measurement afterburners into a new plugin system","user":{"login":"PaulPrice","id":1334980,"avatar_url":"https://avatars.githubusercontent.com/u/1334980?v=3","gravatar_id":"","url":"https://api.github.com/users/PaulPrice","html_url":"https://github.com/PaulPrice","followers_url":"https://api.github.com/users/PaulPrice/followers","following_url":"https://api.github.com/users/PaulPrice/following{/other_user}","gists_url":"https://api.github.com/users/PaulPrice/gists{/gist_id}","starred_url":"https://api.github.com/users/PaulPrice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaulPrice/subscriptions","organizations_url":"https://api.github.com/users/PaulPrice/orgs","repos_url":"https://api.github.com/users/PaulPrice/repos","events_url":"https://api.github.com/users/PaulPrice/events{/privacy}","received_events_url":"https://api.github.com/users/PaulPrice/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-22T17:56:00Z","updated_at":"2016-04-26T14:42:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea07c7bbe6ff66f7be34ebd47c8178a96d7b041a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lsst/meas_base/pulls/33/commits","review_comments_url":"https://api.github.com/repos/lsst/meas_base/pulls/33/comments","review_comment_url":"https://api.github.com/repos/lsst/meas_base/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lsst/meas_base/issues/33/comments","statuses_url":"https://api.github.com/repos/lsst/meas_base/statuses/7dd3a6d0f087bc8a6cc88f13bb5b1b8a2f546295","head":{"label":"lsst:tickets/DM-4887","ref":"tickets/DM-4887","sha":"7dd3a6d0f087bc8a6cc88f13bb5b1b8a2f546295","user":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"repo":{"id":23013356,"name":"meas_base","full_name":"lsst/meas_base","owner":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst/meas_base","description":"LSST Data Management: core astronomical measurement algorithms","fork":false,"url":"https://api.github.com/repos/lsst/meas_base","forks_url":"https://api.github.com/repos/lsst/meas_base/forks","keys_url":"https://api.github.com/repos/lsst/meas_base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst/meas_base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst/meas_base/teams","hooks_url":"https://api.github.com/repos/lsst/meas_base/hooks","issue_events_url":"https://api.github.com/repos/lsst/meas_base/issues/events{/number}","events_url":"https://api.github.com/repos/lsst/meas_base/events","assignees_url":"https://api.github.com/repos/lsst/meas_base/assignees{/user}","branches_url":"https://api.github.com/repos/lsst/meas_base/branches{/branch}","tags_url":"https://api.github.com/repos/lsst/meas_base/tags","blobs_url":"https://api.github.com/repos/lsst/meas_base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst/meas_base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst/meas_base/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst/meas_base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst/meas_base/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst/meas_base/languages","stargazers_url":"https://api.github.com/repos/lsst/meas_base/stargazers","contributors_url":"https://api.github.com/repos/lsst/meas_base/contributors","subscribers_url":"https://api.github.com/repos/lsst/meas_base/subscribers","subscription_url":"https://api.github.com/repos/lsst/meas_base/subscription","commits_url":"https://api.github.com/repos/lsst/meas_base/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst/meas_base/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst/meas_base/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst/meas_base/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst/meas_base/contents/{+path}","compare_url":"https://api.github.com/repos/lsst/meas_base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst/meas_base/merges","archive_url":"https://api.github.com/repos/lsst/meas_base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst/meas_base/downloads","issues_url":"https://api.github.com/repos/lsst/meas_base/issues{/number}","pulls_url":"https://api.github.com/repos/lsst/meas_base/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst/meas_base/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst/meas_base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst/meas_base/labels{/name}","releases_url":"https://api.github.com/repos/lsst/meas_base/releases{/id}","deployments_url":"https://api.github.com/repos/lsst/meas_base/deployments","created_at":"2014-08-16T07:45:37Z","updated_at":"2016-01-15T17:08:47Z","pushed_at":"2016-04-24T15:51:19Z","git_url":"git://github.com/lsst/meas_base.git","ssh_url":"git@github.com:lsst/meas_base.git","clone_url":"https://github.com/lsst/meas_base.git","svn_url":"https://github.com/lsst/meas_base","homepage":"http://dm.lsst.org/","size":2581,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"lsst:master","ref":"master","sha":"095ee0acfa1b36e09972ce337749a3c12cdfc9fd","user":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"repo":{"id":23013356,"name":"meas_base","full_name":"lsst/meas_base","owner":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst/meas_base","description":"LSST Data Management: core astronomical measurement algorithms","fork":false,"url":"https://api.github.com/repos/lsst/meas_base","forks_url":"https://api.github.com/repos/lsst/meas_base/forks","keys_url":"https://api.github.com/repos/lsst/meas_base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst/meas_base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst/meas_base/teams","hooks_url":"https://api.github.com/repos/lsst/meas_base/hooks","issue_events_url":"https://api.github.com/repos/lsst/meas_base/issues/events{/number}","events_url":"https://api.github.com/repos/lsst/meas_base/events","assignees_url":"https://api.github.com/repos/lsst/meas_base/assignees{/user}","branches_url":"https://api.github.com/repos/lsst/meas_base/branches{/branch}","tags_url":"https://api.github.com/repos/lsst/meas_base/tags","blobs_url":"https://api.github.com/repos/lsst/meas_base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst/meas_base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst/meas_base/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst/meas_base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst/meas_base/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst/meas_base/languages","stargazers_url":"https://api.github.com/repos/lsst/meas_base/stargazers","contributors_url":"https://api.github.com/repos/lsst/meas_base/contributors","subscribers_url":"https://api.github.com/repos/lsst/meas_base/subscribers","subscription_url":"https://api.github.com/repos/lsst/meas_base/subscription","commits_url":"https://api.github.com/repos/lsst/meas_base/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst/meas_base/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst/meas_base/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst/meas_base/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst/meas_base/contents/{+path}","compare_url":"https://api.github.com/repos/lsst/meas_base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst/meas_base/merges","archive_url":"https://api.github.com/repos/lsst/meas_base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst/meas_base/downloads","issues_url":"https://api.github.com/repos/lsst/meas_base/issues{/number}","pulls_url":"https://api.github.com/repos/lsst/meas_base/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst/meas_base/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst/meas_base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst/meas_base/labels{/name}","releases_url":"https://api.github.com/repos/lsst/meas_base/releases{/id}","deployments_url":"https://api.github.com/repos/lsst/meas_base/deployments","created_at":"2014-08-16T07:45:37Z","updated_at":"2016-01-15T17:08:47Z","pushed_at":"2016-04-24T15:51:19Z","git_url":"git://github.com/lsst/meas_base.git","ssh_url":"git@github.com:lsst/meas_base.git","clone_url":"https://github.com/lsst/meas_base.git","svn_url":"https://github.com/lsst/meas_base","homepage":"http://dm.lsst.org/","size":2581,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lsst/meas_base/pulls/33"},"html":{"href":"https://github.com/lsst/meas_base/pull/33"},"issue":{"href":"https://api.github.com/repos/lsst/meas_base/issues/33"},"comments":{"href":"https://api.github.com/repos/lsst/meas_base/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/lsst/meas_base/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/lsst/meas_base/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lsst/meas_base/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/lsst/meas_base/statuses/7dd3a6d0f087bc8a6cc88f13bb5b1b8a2f546295"}}}}