{"action":"created","issue":{"url":"https://api.github.com/repos/NeuralEnsemble/python-neo/issues/525","repository_url":"https://api.github.com/repos/NeuralEnsemble/python-neo","labels_url":"https://api.github.com/repos/NeuralEnsemble/python-neo/issues/525/labels{/name}","comments_url":"https://api.github.com/repos/NeuralEnsemble/python-neo/issues/525/comments","events_url":"https://api.github.com/repos/NeuralEnsemble/python-neo/issues/525/events","html_url":"https://github.com/NeuralEnsemble/python-neo/pull/525","id":315825686,"number":525,"title":"extract epoch based signal","user":{"login":"lungsi","id":12233689,"avatar_url":"https://avatars3.githubusercontent.com/u/12233689?v=4","gravatar_id":"","url":"https://api.github.com/users/lungsi","html_url":"https://github.com/lungsi","followers_url":"https://api.github.com/users/lungsi/followers","following_url":"https://api.github.com/users/lungsi/following{/other_user}","gists_url":"https://api.github.com/users/lungsi/gists{/gist_id}","starred_url":"https://api.github.com/users/lungsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lungsi/subscriptions","organizations_url":"https://api.github.com/users/lungsi/orgs","repos_url":"https://api.github.com/users/lungsi/repos","events_url":"https://api.github.com/users/lungsi/events{/privacy}","received_events_url":"https://api.github.com/users/lungsi/received_events","type":"User","site_admin":false},"labels":[{"id":2726018,"url":"https://api.github.com/repos/NeuralEnsemble/python-neo/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/NeuralEnsemble/python-neo/milestones/15","html_url":"https://github.com/NeuralEnsemble/python-neo/milestone/15","labels_url":"https://api.github.com/repos/NeuralEnsemble/python-neo/milestones/15/labels","id":3028470,"number":15,"title":"0.7.0","description":"","creator":{"login":"apdavison","id":260552,"avatar_url":"https://avatars0.githubusercontent.com/u/260552?v=4","gravatar_id":"","url":"https://api.github.com/users/apdavison","html_url":"https://github.com/apdavison","followers_url":"https://api.github.com/users/apdavison/followers","following_url":"https://api.github.com/users/apdavison/following{/other_user}","gists_url":"https://api.github.com/users/apdavison/gists{/gist_id}","starred_url":"https://api.github.com/users/apdavison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apdavison/subscriptions","organizations_url":"https://api.github.com/users/apdavison/orgs","repos_url":"https://api.github.com/users/apdavison/repos","events_url":"https://api.github.com/users/apdavison/events{/privacy}","received_events_url":"https://api.github.com/users/apdavison/received_events","type":"User","site_admin":false},"open_issues":17,"closed_issues":0,"state":"open","created_at":"2018-01-11T12:48:53Z","updated_at":"2018-04-21T12:36:04Z","due_on":"2018-07-31T07:00:00Z","closed_at":null},"comments":5,"created_at":"2018-04-19T10:52:21Z","updated_at":"2018-04-23T10:46:04Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/NeuralEnsemble/python-neo/pulls/525","html_url":"https://github.com/NeuralEnsemble/python-neo/pull/525","diff_url":"https://github.com/NeuralEnsemble/python-neo/pull/525.diff","patch_url":"https://github.com/NeuralEnsemble/python-neo/pull/525.patch"},"body":"Added two methods within the class `BaseSignal` these are: (staticmethod) `_rescale_epoch_time` and `extract_for_epoch`. Therefore when a neo object signal is created (which in turn is an instance of the child class of `BaseSignal`) it has the method `extract_for_epoch`. Passing the epochs (created neo.Epoch) into this method will return a list of extracted signals (specific to the epochs).\r\n```\r\n>>> import neo\r\n>>> import quantities as pq\r\n>>> import numpy as np\r\n>>> sigarr = neo.AnalogSignal([[1], [2], [3], [4], [5], [6]], units='mV',\r\n                              sampling_rate=1*pq.Hz)\r\n>>> epc = neo.Epoch(times=np.array([0, 3000])*pq.ms, durations=[1000, 2000]*pq.ms,\r\n                    labels=np.array(['btn0', 'btn1'], dtype='S'))\r\n>>> epochsignals = sigarr.extract_for_epoch(epc)\r\n>>> epochsignals\r\n[<AnalogSignal(array([[1]]) * mV, [0.0 s, 1.0 s], sampling rate: 1.0 Hz)>,\r\n <AnalogSignal(array([], shape=(0, 1), dtype=int64) * mV, [3.0 s, 3.0 s],\r\n sampling rate: 1.0 Hz)>]\r\n>>> len(epochsignals)\r\n2\r\n>>> epochsignals[0]\r\n<AnalogSignal(array([[1]]) * mV, [0.0 s, 1.0 s], sampling rate: 1.0 Hz)>\r\n```"},"comment":{"url":"https://api.github.com/repos/NeuralEnsemble/python-neo/issues/comments/383533105","html_url":"https://github.com/NeuralEnsemble/python-neo/pull/525#issuecomment-383533105","issue_url":"https://api.github.com/repos/NeuralEnsemble/python-neo/issues/525","id":383533105,"user":{"login":"samuelgarcia","id":815627,"avatar_url":"https://avatars1.githubusercontent.com/u/815627?v=4","gravatar_id":"","url":"https://api.github.com/users/samuelgarcia","html_url":"https://github.com/samuelgarcia","followers_url":"https://api.github.com/users/samuelgarcia/followers","following_url":"https://api.github.com/users/samuelgarcia/following{/other_user}","gists_url":"https://api.github.com/users/samuelgarcia/gists{/gist_id}","starred_url":"https://api.github.com/users/samuelgarcia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuelgarcia/subscriptions","organizations_url":"https://api.github.com/users/samuelgarcia/orgs","repos_url":"https://api.github.com/users/samuelgarcia/repos","events_url":"https://api.github.com/users/samuelgarcia/events{/privacy}","received_events_url":"https://api.github.com/users/samuelgarcia/received_events","type":"User","site_admin":false},"created_at":"2018-04-23T10:46:04Z","updated_at":"2018-04-23T10:46:04Z","author_association":"CONTRIBUTOR","body":"Dear all.\r\nI made some coments about slicing here #526\r\n\r\nI have implemented proxy objects here #461.\r\nThis is not merged yet, but it is almost ready (except some side effect errors and pep87).\r\n\r\nFor doing this I would prefer to write external function as proposed by @JuliaSprenger and map them to method as proposed by @apdavison.\r\n\r\nSo with proxy objects the external function could be hacked easily to work with standard/proxy objects.\r\n\r\nMy proposal is AnalogSignal.extract_for_epoch should call external neo.io.utils_slice.slice_sig_by_epoch (or whatever)\r\n\r\nExternal function will also help for global slicing at segment/block level.\r\n"}}
{"actor":{"display_login":"samuelgarcia"}}