{"action":"created","comment":{"url":"https://api.github.com/repos/DataMedSci/beprof/pulls/comments/70168738","id":70168738,"diff_hunk":"@@ -0,0 +1,122 @@\n+import numpy as np\n+import unittest\n+from beprof.curve import Curve\n+\n+\n+class TestCurveInit(unittest.TestCase):\n+    \"\"\"\n+    Testing Curve initialization and .x .y\n+    \"\"\"\n+    def test_list_init(self):\n+        simple_lists = [[-12, 1], [-1, 7], [0, 3], [3, 17]]\n+        c = Curve(simple_lists)\n+        assert list(c.x) == [e[0] for e in simple_lists]\n+        assert list(c.y) == [e[1] for e in simple_lists]\n+\n+    def test_numpy_array_init(self):\n+        numpy_array = np.array([[-12, 1], [-1, 7], [0, 3], [3, 17]])\n+        c = Curve(numpy_array)\n+        assert np.array_equal(c, numpy_array)\n+\n+    def test_numpy_view_init(self):\n+        # todo\n+        pass\n+\n+    def test_empty_init(self):\n+        with self.assertRaises(TypeError):\n+            Curve()\n+        with self.assertRaises(IndexError):\n+            Curve([])\n+\n+    def test_one_point_init(self):\n+        c = Curve([[1, 2]])\n+        assert c.x == 1\n+        assert c.y == 2\n+\n+    def test_two_point_init(self):\n+        array = [[-1, 3], [1, 7]]\n+        c = Curve(array)\n+        assert np.array_equal(c, array)\n+\n+\n+class TestCurveRescale(unittest.TestCase):\n+    def setUp(self):\n+        # two the same Curves - one for modification/testing,\n+        # one for comparison (unmodified)\n+        self.compare_curve = Curve([[0, 0], [5, 5], [10, 10]])\n+        # todo: check the x[0] element why it cannot be int\n+        self.test_curve = Curve([[0.0, 0], [5, 5], [10, 10]])\n+\n+    def test_rescale_by_one(self):\n+        self.test_curve.rescale(factor=1)\n+        assert list(self.compare_curve.x) == list(self.test_curve.x)\n+        assert list(self.compare_curve.y) == list(self.test_curve.y)\n+\n+    def test_rescale_by_negative_one(self):\n+        self.test_curve.rescale(factor=-1)\n+        assert list(self.compare_curve.x) == list(self.test_curve.x)\n+        assert list(self.compare_curve.y) == list(self.test_curve.y * -1)\n+\n+    def test_rescale_by_zero(self):\n+        # post.y should contain some nans and infs\n+        self.test_curve.rescale(factor=0)\n+        assert list(self.compare_curve.x) == list(self.test_curve.x)\n+        assert list(self.compare_curve.y) != list(self.test_curve.y)\n+        assert np.isnan(self.test_curve.y[0])\n+        assert np.isinf(self.test_curve.y[1])\n+\n+\n+class TestCurveSmooth(unittest.TestCase):","path":"tests/unit_test/test_curve.py","position":69,"original_position":69,"commit_id":"a5f14c8782b761d2524c0f2ea1a5c645830c8b8d","original_commit_id":"a5f14c8782b761d2524c0f2ea1a5c645830c8b8d","user":{"login":"grzanka","id":7374733,"avatar_url":"https://avatars.githubusercontent.com/u/7374733?v=3","gravatar_id":"","url":"https://api.github.com/users/grzanka","html_url":"https://github.com/grzanka","followers_url":"https://api.github.com/users/grzanka/followers","following_url":"https://api.github.com/users/grzanka/following{/other_user}","gists_url":"https://api.github.com/users/grzanka/gists{/gist_id}","starred_url":"https://api.github.com/users/grzanka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grzanka/subscriptions","organizations_url":"https://api.github.com/users/grzanka/orgs","repos_url":"https://api.github.com/users/grzanka/repos","events_url":"https://api.github.com/users/grzanka/events{/privacy}","received_events_url":"https://api.github.com/users/grzanka/received_events","type":"User","site_admin":false},"body":"What about other window lengths (2,3,4,5) ?\r\nDoes smooth method works with all window sizes, even and odd ?\r\n\r\nCheck this one:\r\nhttp://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.medfilt.html\r\n`Elements of kernel_size should be odd`","created_at":"2016-07-09T15:58:16Z","updated_at":"2016-07-09T15:58:16Z","html_url":"https://github.com/DataMedSci/beprof/pull/85#discussion_r70168738","pull_request_url":"https://api.github.com/repos/DataMedSci/beprof/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/DataMedSci/beprof/pulls/comments/70168738"},"html":{"href":"https://github.com/DataMedSci/beprof/pull/85#discussion_r70168738"},"pull_request":{"href":"https://api.github.com/repos/DataMedSci/beprof/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/DataMedSci/beprof/pulls/85","id":76496836,"html_url":"https://github.com/DataMedSci/beprof/pull/85","diff_url":"https://github.com/DataMedSci/beprof/pull/85.diff","patch_url":"https://github.com/DataMedSci/beprof/pull/85.patch","issue_url":"https://api.github.com/repos/DataMedSci/beprof/issues/85","number":85,"state":"open","locked":false,"title":"Feature/19 unit tests","user":{"login":"ant6","id":5757700,"avatar_url":"https://avatars.githubusercontent.com/u/5757700?v=3","gravatar_id":"","url":"https://api.github.com/users/ant6","html_url":"https://github.com/ant6","followers_url":"https://api.github.com/users/ant6/followers","following_url":"https://api.github.com/users/ant6/following{/other_user}","gists_url":"https://api.github.com/users/ant6/gists{/gist_id}","starred_url":"https://api.github.com/users/ant6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant6/subscriptions","organizations_url":"https://api.github.com/users/ant6/orgs","repos_url":"https://api.github.com/users/ant6/repos","events_url":"https://api.github.com/users/ant6/events{/privacy}","received_events_url":"https://api.github.com/users/ant6/received_events","type":"User","site_admin":false},"body":"For discussion","created_at":"2016-07-06T20:34:16Z","updated_at":"2016-07-09T15:58:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb9b1b23cf301d0117ae139a3385c116afe257a2","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/DataMedSci/beprof/milestones/1","html_url":"https://github.com/DataMedSci/beprof/milestones/0.1.0","labels_url":"https://api.github.com/repos/DataMedSci/beprof/milestones/1/labels","id":1811798,"number":1,"title":"0.1.0","description":"","creator":{"login":"ant6","id":5757700,"avatar_url":"https://avatars.githubusercontent.com/u/5757700?v=3","gravatar_id":"","url":"https://api.github.com/users/ant6","html_url":"https://github.com/ant6","followers_url":"https://api.github.com/users/ant6/followers","following_url":"https://api.github.com/users/ant6/following{/other_user}","gists_url":"https://api.github.com/users/ant6/gists{/gist_id}","starred_url":"https://api.github.com/users/ant6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant6/subscriptions","organizations_url":"https://api.github.com/users/ant6/orgs","repos_url":"https://api.github.com/users/ant6/repos","events_url":"https://api.github.com/users/ant6/events{/privacy}","received_events_url":"https://api.github.com/users/ant6/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":64,"state":"open","created_at":"2016-06-06T19:51:50Z","updated_at":"2016-07-06T20:34:16Z","due_on":"2016-07-09T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/DataMedSci/beprof/pulls/85/commits","review_comments_url":"https://api.github.com/repos/DataMedSci/beprof/pulls/85/comments","review_comment_url":"https://api.github.com/repos/DataMedSci/beprof/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataMedSci/beprof/issues/85/comments","statuses_url":"https://api.github.com/repos/DataMedSci/beprof/statuses/a5f14c8782b761d2524c0f2ea1a5c645830c8b8d","head":{"label":"ant6:feature/19-unit-tests","ref":"feature/19-unit-tests","sha":"a5f14c8782b761d2524c0f2ea1a5c645830c8b8d","user":{"login":"ant6","id":5757700,"avatar_url":"https://avatars.githubusercontent.com/u/5757700?v=3","gravatar_id":"","url":"https://api.github.com/users/ant6","html_url":"https://github.com/ant6","followers_url":"https://api.github.com/users/ant6/followers","following_url":"https://api.github.com/users/ant6/following{/other_user}","gists_url":"https://api.github.com/users/ant6/gists{/gist_id}","starred_url":"https://api.github.com/users/ant6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant6/subscriptions","organizations_url":"https://api.github.com/users/ant6/orgs","repos_url":"https://api.github.com/users/ant6/repos","events_url":"https://api.github.com/users/ant6/events{/privacy}","received_events_url":"https://api.github.com/users/ant6/received_events","type":"User","site_admin":false},"repo":{"id":59137778,"name":"beprof","full_name":"ant6/beprof","owner":{"login":"ant6","id":5757700,"avatar_url":"https://avatars.githubusercontent.com/u/5757700?v=3","gravatar_id":"","url":"https://api.github.com/users/ant6","html_url":"https://github.com/ant6","followers_url":"https://api.github.com/users/ant6/followers","following_url":"https://api.github.com/users/ant6/following{/other_user}","gists_url":"https://api.github.com/users/ant6/gists{/gist_id}","starred_url":"https://api.github.com/users/ant6/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ant6/subscriptions","organizations_url":"https://api.github.com/users/ant6/orgs","repos_url":"https://api.github.com/users/ant6/repos","events_url":"https://api.github.com/users/ant6/events{/privacy}","received_events_url":"https://api.github.com/users/ant6/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ant6/beprof","description":"Beam Profile Analysing Tools","fork":true,"url":"https://api.github.com/repos/ant6/beprof","forks_url":"https://api.github.com/repos/ant6/beprof/forks","keys_url":"https://api.github.com/repos/ant6/beprof/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ant6/beprof/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ant6/beprof/teams","hooks_url":"https://api.github.com/repos/ant6/beprof/hooks","issue_events_url":"https://api.github.com/repos/ant6/beprof/issues/events{/number}","events_url":"https://api.github.com/repos/ant6/beprof/events","assignees_url":"https://api.github.com/repos/ant6/beprof/assignees{/user}","branches_url":"https://api.github.com/repos/ant6/beprof/branches{/branch}","tags_url":"https://api.github.com/repos/ant6/beprof/tags","blobs_url":"https://api.github.com/repos/ant6/beprof/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ant6/beprof/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ant6/beprof/git/refs{/sha}","trees_url":"https://api.github.com/repos/ant6/beprof/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ant6/beprof/statuses/{sha}","languages_url":"https://api.github.com/repos/ant6/beprof/languages","stargazers_url":"https://api.github.com/repos/ant6/beprof/stargazers","contributors_url":"https://api.github.com/repos/ant6/beprof/contributors","subscribers_url":"https://api.github.com/repos/ant6/beprof/subscribers","subscription_url":"https://api.github.com/repos/ant6/beprof/subscription","commits_url":"https://api.github.com/repos/ant6/beprof/commits{/sha}","git_commits_url":"https://api.github.com/repos/ant6/beprof/git/commits{/sha}","comments_url":"https://api.github.com/repos/ant6/beprof/comments{/number}","issue_comment_url":"https://api.github.com/repos/ant6/beprof/issues/comments{/number}","contents_url":"https://api.github.com/repos/ant6/beprof/contents/{+path}","compare_url":"https://api.github.com/repos/ant6/beprof/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ant6/beprof/merges","archive_url":"https://api.github.com/repos/ant6/beprof/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ant6/beprof/downloads","issues_url":"https://api.github.com/repos/ant6/beprof/issues{/number}","pulls_url":"https://api.github.com/repos/ant6/beprof/pulls{/number}","milestones_url":"https://api.github.com/repos/ant6/beprof/milestones{/number}","notifications_url":"https://api.github.com/repos/ant6/beprof/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ant6/beprof/labels{/name}","releases_url":"https://api.github.com/repos/ant6/beprof/releases{/id}","deployments_url":"https://api.github.com/repos/ant6/beprof/deployments","created_at":"2016-05-18T17:37:37Z","updated_at":"2016-05-18T17:37:38Z","pushed_at":"2016-07-09T15:35:57Z","git_url":"git://github.com/ant6/beprof.git","ssh_url":"git@github.com:ant6/beprof.git","clone_url":"https://github.com/ant6/beprof.git","svn_url":"https://github.com/ant6/beprof","homepage":null,"size":166,"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":"DataMedSci:master","ref":"master","sha":"c3d92792ffe914c4fa954dbc3d273924181bcf97","user":{"login":"DataMedSci","id":19749591,"avatar_url":"https://avatars.githubusercontent.com/u/19749591?v=3","gravatar_id":"","url":"https://api.github.com/users/DataMedSci","html_url":"https://github.com/DataMedSci","followers_url":"https://api.github.com/users/DataMedSci/followers","following_url":"https://api.github.com/users/DataMedSci/following{/other_user}","gists_url":"https://api.github.com/users/DataMedSci/gists{/gist_id}","starred_url":"https://api.github.com/users/DataMedSci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataMedSci/subscriptions","organizations_url":"https://api.github.com/users/DataMedSci/orgs","repos_url":"https://api.github.com/users/DataMedSci/repos","events_url":"https://api.github.com/users/DataMedSci/events{/privacy}","received_events_url":"https://api.github.com/users/DataMedSci/received_events","type":"Organization","site_admin":false},"repo":{"id":49129024,"name":"beprof","full_name":"DataMedSci/beprof","owner":{"login":"DataMedSci","id":19749591,"avatar_url":"https://avatars.githubusercontent.com/u/19749591?v=3","gravatar_id":"","url":"https://api.github.com/users/DataMedSci","html_url":"https://github.com/DataMedSci","followers_url":"https://api.github.com/users/DataMedSci/followers","following_url":"https://api.github.com/users/DataMedSci/following{/other_user}","gists_url":"https://api.github.com/users/DataMedSci/gists{/gist_id}","starred_url":"https://api.github.com/users/DataMedSci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataMedSci/subscriptions","organizations_url":"https://api.github.com/users/DataMedSci/orgs","repos_url":"https://api.github.com/users/DataMedSci/repos","events_url":"https://api.github.com/users/DataMedSci/events{/privacy}","received_events_url":"https://api.github.com/users/DataMedSci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataMedSci/beprof","description":"Beam Profile Analysing Tools","fork":false,"url":"https://api.github.com/repos/DataMedSci/beprof","forks_url":"https://api.github.com/repos/DataMedSci/beprof/forks","keys_url":"https://api.github.com/repos/DataMedSci/beprof/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataMedSci/beprof/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataMedSci/beprof/teams","hooks_url":"https://api.github.com/repos/DataMedSci/beprof/hooks","issue_events_url":"https://api.github.com/repos/DataMedSci/beprof/issues/events{/number}","events_url":"https://api.github.com/repos/DataMedSci/beprof/events","assignees_url":"https://api.github.com/repos/DataMedSci/beprof/assignees{/user}","branches_url":"https://api.github.com/repos/DataMedSci/beprof/branches{/branch}","tags_url":"https://api.github.com/repos/DataMedSci/beprof/tags","blobs_url":"https://api.github.com/repos/DataMedSci/beprof/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataMedSci/beprof/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataMedSci/beprof/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataMedSci/beprof/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataMedSci/beprof/statuses/{sha}","languages_url":"https://api.github.com/repos/DataMedSci/beprof/languages","stargazers_url":"https://api.github.com/repos/DataMedSci/beprof/stargazers","contributors_url":"https://api.github.com/repos/DataMedSci/beprof/contributors","subscribers_url":"https://api.github.com/repos/DataMedSci/beprof/subscribers","subscription_url":"https://api.github.com/repos/DataMedSci/beprof/subscription","commits_url":"https://api.github.com/repos/DataMedSci/beprof/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataMedSci/beprof/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataMedSci/beprof/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataMedSci/beprof/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataMedSci/beprof/contents/{+path}","compare_url":"https://api.github.com/repos/DataMedSci/beprof/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataMedSci/beprof/merges","archive_url":"https://api.github.com/repos/DataMedSci/beprof/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataMedSci/beprof/downloads","issues_url":"https://api.github.com/repos/DataMedSci/beprof/issues{/number}","pulls_url":"https://api.github.com/repos/DataMedSci/beprof/pulls{/number}","milestones_url":"https://api.github.com/repos/DataMedSci/beprof/milestones{/number}","notifications_url":"https://api.github.com/repos/DataMedSci/beprof/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataMedSci/beprof/labels{/name}","releases_url":"https://api.github.com/repos/DataMedSci/beprof/releases{/id}","deployments_url":"https://api.github.com/repos/DataMedSci/beprof/deployments","created_at":"2016-01-06T10:36:02Z","updated_at":"2016-06-15T17:46:21Z","pushed_at":"2016-07-09T15:35:58Z","git_url":"git://github.com/DataMedSci/beprof.git","ssh_url":"git@github.com:DataMedSci/beprof.git","clone_url":"https://github.com/DataMedSci/beprof.git","svn_url":"https://github.com/DataMedSci/beprof","homepage":null,"size":187,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":14,"forks":2,"open_issues":14,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataMedSci/beprof/pulls/85"},"html":{"href":"https://github.com/DataMedSci/beprof/pull/85"},"issue":{"href":"https://api.github.com/repos/DataMedSci/beprof/issues/85"},"comments":{"href":"https://api.github.com/repos/DataMedSci/beprof/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/DataMedSci/beprof/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/DataMedSci/beprof/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataMedSci/beprof/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/DataMedSci/beprof/statuses/a5f14c8782b761d2524c0f2ea1a5c645830c8b8d"}}}}
{"actor":{"display_login":"grzanka"}}