{"action":"created","comment":{"url":"https://api.github.com/repos/tshort/Sims.jl/pulls/comments/24303969","id":24303969,"diff_hunk":"@@ -0,0 +1,75 @@\n+\n+###########################################\n+## Interpolated event grid (requires Grid)\n+###########################################\n+\n+@comment \"\"\"\n+# Interpolated event grid\n+\"\"\"\n+\n+using Requires\n+\n+@require Grid begin\n+\n+    using Grid\n+    \n+    function search_grid (g::InterpGrid, x::Float64)\n+        i = searchsortedfirst (g, x)\n+        g[i]\n+    end\n+\n+    function grid_point (x::Float64, v::Float64)\n+        x - v\n+    end\n+    \n+@doc* \"\"\"\n+Interpolated event grid (requires Grid library).\n+\n+```julia\n+\n+EventGrid(events, tf, dt)\n+```\n+\n+Given a vector with event times and a sampling step, creates a\n+continuous interpolated function that has a negative value between\n+events, and crosses zero at each event time.\n+The function `grid_input` can be used to detect events in model equations.\n+\n+### Arguments\n+\n+* `event` : Vector of event times\n+* `tf` : grid end time\n+* `dt` : event grid sampling time\n+\n+### Example\n+\n+```julia\n+\n+input = EventGrid([1.0,2.0,3.0],tstop,0.1)\n+\n+Event(grid_input(input),\n+      Equation[\n+                reinit(x, x + k)\n+              ],\n+      Equation[])\n+\n+```\n+\"\"\" ->\n+\n+function EventGrid(events,tf,dt)\n+    \n+    g0 = InterpGrid(events, 0.0, InterpNearest)","path":"lib/event_grid.jl","position":61,"original_position":61,"commit_id":"c3ee814635e592a1cd59f028fa9605febba3da14","original_commit_id":"c3ee814635e592a1cd59f028fa9605febba3da14","user":{"login":"tshort","id":636420,"avatar_url":"https://avatars.githubusercontent.com/u/636420?v=3","gravatar_id":"","url":"https://api.github.com/users/tshort","html_url":"https://github.com/tshort","followers_url":"https://api.github.com/users/tshort/followers","following_url":"https://api.github.com/users/tshort/following{/other_user}","gists_url":"https://api.github.com/users/tshort/gists{/gist_id}","starred_url":"https://api.github.com/users/tshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tshort/subscriptions","organizations_url":"https://api.github.com/users/tshort/orgs","repos_url":"https://api.github.com/users/tshort/repos","events_url":"https://api.github.com/users/tshort/events{/privacy}","received_events_url":"https://api.github.com/users/tshort/received_events","type":"User","site_admin":false},"body":"For methods from Grid, it'd be good to fully qualify them. It's not absolutely necessary, but it might help reduce conflicts in the future, and it's clearer where they come from.\r\n","created_at":"2015-02-08T23:30:51Z","updated_at":"2015-02-08T23:30:51Z","html_url":"https://github.com/tshort/Sims.jl/pull/52#discussion_r24303969","pull_request_url":"https://api.github.com/repos/tshort/Sims.jl/pulls/52","_links":{"self":{"href":"https://api.github.com/repos/tshort/Sims.jl/pulls/comments/24303969"},"html":{"href":"https://github.com/tshort/Sims.jl/pull/52#discussion_r24303969"},"pull_request":{"href":"https://api.github.com/repos/tshort/Sims.jl/pulls/52"}}},"pull_request":{"url":"https://api.github.com/repos/tshort/Sims.jl/pulls/52","id":28887388,"html_url":"https://github.com/tshort/Sims.jl/pull/52","diff_url":"https://github.com/tshort/Sims.jl/pull/52.diff","patch_url":"https://github.com/tshort/Sims.jl/pull/52.patch","issue_url":"https://api.github.com/repos/tshort/Sims.jl/issues/52","number":52,"state":"open","locked":false,"title":"Support for interpolated event grids","user":{"login":"iraikov","id":2263283,"avatar_url":"https://avatars.githubusercontent.com/u/2263283?v=3","gravatar_id":"","url":"https://api.github.com/users/iraikov","html_url":"https://github.com/iraikov","followers_url":"https://api.github.com/users/iraikov/followers","following_url":"https://api.github.com/users/iraikov/following{/other_user}","gists_url":"https://api.github.com/users/iraikov/gists{/gist_id}","starred_url":"https://api.github.com/users/iraikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iraikov/subscriptions","organizations_url":"https://api.github.com/users/iraikov/orgs","repos_url":"https://api.github.com/users/iraikov/repos","events_url":"https://api.github.com/users/iraikov/events{/privacy}","received_events_url":"https://api.github.com/users/iraikov/received_events","type":"User","site_admin":false},"body":"This pull request adds functionality to the standard library for \"event grids\" which is to say a vector of event times that is interpolated with the Grids.jl library, so that it can be represented in a Sims model as a function that is negative between event times and crosses the zero threshold at the times when event occur.","created_at":"2015-02-08T21:50:37Z","updated_at":"2015-02-08T23:30:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ef70d08d15fe3d6e680b1321d54678e554c22029","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tshort/Sims.jl/pulls/52/commits","review_comments_url":"https://api.github.com/repos/tshort/Sims.jl/pulls/52/comments","review_comment_url":"https://api.github.com/repos/tshort/Sims.jl/pulls/comments/{number}","comments_url":"https://api.github.com/repos/tshort/Sims.jl/issues/52/comments","statuses_url":"https://api.github.com/repos/tshort/Sims.jl/statuses/c3ee814635e592a1cd59f028fa9605febba3da14","head":{"label":"iraikov:grids","ref":"grids","sha":"c3ee814635e592a1cd59f028fa9605febba3da14","user":{"login":"iraikov","id":2263283,"avatar_url":"https://avatars.githubusercontent.com/u/2263283?v=3","gravatar_id":"","url":"https://api.github.com/users/iraikov","html_url":"https://github.com/iraikov","followers_url":"https://api.github.com/users/iraikov/followers","following_url":"https://api.github.com/users/iraikov/following{/other_user}","gists_url":"https://api.github.com/users/iraikov/gists{/gist_id}","starred_url":"https://api.github.com/users/iraikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iraikov/subscriptions","organizations_url":"https://api.github.com/users/iraikov/orgs","repos_url":"https://api.github.com/users/iraikov/repos","events_url":"https://api.github.com/users/iraikov/events{/privacy}","received_events_url":"https://api.github.com/users/iraikov/received_events","type":"User","site_admin":false},"repo":{"id":22903078,"name":"Sims.jl","full_name":"iraikov/Sims.jl","owner":{"login":"iraikov","id":2263283,"avatar_url":"https://avatars.githubusercontent.com/u/2263283?v=3","gravatar_id":"","url":"https://api.github.com/users/iraikov","html_url":"https://github.com/iraikov","followers_url":"https://api.github.com/users/iraikov/followers","following_url":"https://api.github.com/users/iraikov/following{/other_user}","gists_url":"https://api.github.com/users/iraikov/gists{/gist_id}","starred_url":"https://api.github.com/users/iraikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iraikov/subscriptions","organizations_url":"https://api.github.com/users/iraikov/orgs","repos_url":"https://api.github.com/users/iraikov/repos","events_url":"https://api.github.com/users/iraikov/events{/privacy}","received_events_url":"https://api.github.com/users/iraikov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iraikov/Sims.jl","description":"Experiments with non-causal, equation-based modeling in Julia","fork":true,"url":"https://api.github.com/repos/iraikov/Sims.jl","forks_url":"https://api.github.com/repos/iraikov/Sims.jl/forks","keys_url":"https://api.github.com/repos/iraikov/Sims.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iraikov/Sims.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iraikov/Sims.jl/teams","hooks_url":"https://api.github.com/repos/iraikov/Sims.jl/hooks","issue_events_url":"https://api.github.com/repos/iraikov/Sims.jl/issues/events{/number}","events_url":"https://api.github.com/repos/iraikov/Sims.jl/events","assignees_url":"https://api.github.com/repos/iraikov/Sims.jl/assignees{/user}","branches_url":"https://api.github.com/repos/iraikov/Sims.jl/branches{/branch}","tags_url":"https://api.github.com/repos/iraikov/Sims.jl/tags","blobs_url":"https://api.github.com/repos/iraikov/Sims.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iraikov/Sims.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iraikov/Sims.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/iraikov/Sims.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iraikov/Sims.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/iraikov/Sims.jl/languages","stargazers_url":"https://api.github.com/repos/iraikov/Sims.jl/stargazers","contributors_url":"https://api.github.com/repos/iraikov/Sims.jl/contributors","subscribers_url":"https://api.github.com/repos/iraikov/Sims.jl/subscribers","subscription_url":"https://api.github.com/repos/iraikov/Sims.jl/subscription","commits_url":"https://api.github.com/repos/iraikov/Sims.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/iraikov/Sims.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/iraikov/Sims.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/iraikov/Sims.jl/issues/comments/{number}","contents_url":"https://api.github.com/repos/iraikov/Sims.jl/contents/{+path}","compare_url":"https://api.github.com/repos/iraikov/Sims.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iraikov/Sims.jl/merges","archive_url":"https://api.github.com/repos/iraikov/Sims.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iraikov/Sims.jl/downloads","issues_url":"https://api.github.com/repos/iraikov/Sims.jl/issues{/number}","pulls_url":"https://api.github.com/repos/iraikov/Sims.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/iraikov/Sims.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/iraikov/Sims.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iraikov/Sims.jl/labels{/name}","releases_url":"https://api.github.com/repos/iraikov/Sims.jl/releases{/id}","created_at":"2014-08-13T04:56:03Z","updated_at":"2015-02-07T02:30:05Z","pushed_at":"2015-02-07T17:17:39Z","git_url":"git://github.com/iraikov/Sims.jl.git","ssh_url":"git@github.com:iraikov/Sims.jl.git","clone_url":"https://github.com/iraikov/Sims.jl.git","svn_url":"https://github.com/iraikov/Sims.jl","homepage":null,"size":1958,"stargazers_count":0,"watchers_count":0,"language":"Julia","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":"tshort:master","ref":"master","sha":"7597067332d6463970e56484a79fc7ca22d78ac3","user":{"login":"tshort","id":636420,"avatar_url":"https://avatars.githubusercontent.com/u/636420?v=3","gravatar_id":"","url":"https://api.github.com/users/tshort","html_url":"https://github.com/tshort","followers_url":"https://api.github.com/users/tshort/followers","following_url":"https://api.github.com/users/tshort/following{/other_user}","gists_url":"https://api.github.com/users/tshort/gists{/gist_id}","starred_url":"https://api.github.com/users/tshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tshort/subscriptions","organizations_url":"https://api.github.com/users/tshort/orgs","repos_url":"https://api.github.com/users/tshort/repos","events_url":"https://api.github.com/users/tshort/events{/privacy}","received_events_url":"https://api.github.com/users/tshort/received_events","type":"User","site_admin":false},"repo":{"id":4448292,"name":"Sims.jl","full_name":"tshort/Sims.jl","owner":{"login":"tshort","id":636420,"avatar_url":"https://avatars.githubusercontent.com/u/636420?v=3","gravatar_id":"","url":"https://api.github.com/users/tshort","html_url":"https://github.com/tshort","followers_url":"https://api.github.com/users/tshort/followers","following_url":"https://api.github.com/users/tshort/following{/other_user}","gists_url":"https://api.github.com/users/tshort/gists{/gist_id}","starred_url":"https://api.github.com/users/tshort/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tshort/subscriptions","organizations_url":"https://api.github.com/users/tshort/orgs","repos_url":"https://api.github.com/users/tshort/repos","events_url":"https://api.github.com/users/tshort/events{/privacy}","received_events_url":"https://api.github.com/users/tshort/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tshort/Sims.jl","description":"Experiments with non-causal, equation-based modeling in Julia","fork":false,"url":"https://api.github.com/repos/tshort/Sims.jl","forks_url":"https://api.github.com/repos/tshort/Sims.jl/forks","keys_url":"https://api.github.com/repos/tshort/Sims.jl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tshort/Sims.jl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tshort/Sims.jl/teams","hooks_url":"https://api.github.com/repos/tshort/Sims.jl/hooks","issue_events_url":"https://api.github.com/repos/tshort/Sims.jl/issues/events{/number}","events_url":"https://api.github.com/repos/tshort/Sims.jl/events","assignees_url":"https://api.github.com/repos/tshort/Sims.jl/assignees{/user}","branches_url":"https://api.github.com/repos/tshort/Sims.jl/branches{/branch}","tags_url":"https://api.github.com/repos/tshort/Sims.jl/tags","blobs_url":"https://api.github.com/repos/tshort/Sims.jl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tshort/Sims.jl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tshort/Sims.jl/git/refs{/sha}","trees_url":"https://api.github.com/repos/tshort/Sims.jl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tshort/Sims.jl/statuses/{sha}","languages_url":"https://api.github.com/repos/tshort/Sims.jl/languages","stargazers_url":"https://api.github.com/repos/tshort/Sims.jl/stargazers","contributors_url":"https://api.github.com/repos/tshort/Sims.jl/contributors","subscribers_url":"https://api.github.com/repos/tshort/Sims.jl/subscribers","subscription_url":"https://api.github.com/repos/tshort/Sims.jl/subscription","commits_url":"https://api.github.com/repos/tshort/Sims.jl/commits{/sha}","git_commits_url":"https://api.github.com/repos/tshort/Sims.jl/git/commits{/sha}","comments_url":"https://api.github.com/repos/tshort/Sims.jl/comments{/number}","issue_comment_url":"https://api.github.com/repos/tshort/Sims.jl/issues/comments/{number}","contents_url":"https://api.github.com/repos/tshort/Sims.jl/contents/{+path}","compare_url":"https://api.github.com/repos/tshort/Sims.jl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tshort/Sims.jl/merges","archive_url":"https://api.github.com/repos/tshort/Sims.jl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tshort/Sims.jl/downloads","issues_url":"https://api.github.com/repos/tshort/Sims.jl/issues{/number}","pulls_url":"https://api.github.com/repos/tshort/Sims.jl/pulls{/number}","milestones_url":"https://api.github.com/repos/tshort/Sims.jl/milestones{/number}","notifications_url":"https://api.github.com/repos/tshort/Sims.jl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tshort/Sims.jl/labels{/name}","releases_url":"https://api.github.com/repos/tshort/Sims.jl/releases{/id}","created_at":"2012-05-25T17:52:54Z","updated_at":"2015-02-07T00:11:37Z","pushed_at":"2015-02-08T02:18:15Z","git_url":"git://github.com/tshort/Sims.jl.git","ssh_url":"git@github.com:tshort/Sims.jl.git","clone_url":"https://github.com/tshort/Sims.jl.git","svn_url":"https://github.com/tshort/Sims.jl","homepage":null,"size":3019,"stargazers_count":25,"watchers_count":25,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":6,"mirror_url":null,"open_issues_count":7,"forks":6,"open_issues":7,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tshort/Sims.jl/pulls/52"},"html":{"href":"https://github.com/tshort/Sims.jl/pull/52"},"issue":{"href":"https://api.github.com/repos/tshort/Sims.jl/issues/52"},"comments":{"href":"https://api.github.com/repos/tshort/Sims.jl/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/tshort/Sims.jl/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/tshort/Sims.jl/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/tshort/Sims.jl/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/tshort/Sims.jl/statuses/c3ee814635e592a1cd59f028fa9605febba3da14"}}}}