{"action":"created","issue":{"url":"https://api.github.com/repos/isetbio/isetbio/issues/47","labels_url":"https://api.github.com/repos/isetbio/isetbio/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/isetbio/isetbio/issues/47/comments","events_url":"https://api.github.com/repos/isetbio/isetbio/issues/47/events","html_url":"https://github.com/isetbio/isetbio/issues/47","id":92120234,"number":47,"title":"photon rate in sensor","user":{"login":"fmrieke","id":8126585,"avatar_url":"https://avatars.githubusercontent.com/u/8126585?v=3","gravatar_id":"","url":"https://api.github.com/users/fmrieke","html_url":"https://github.com/fmrieke","followers_url":"https://api.github.com/users/fmrieke/followers","following_url":"https://api.github.com/users/fmrieke/following{/other_user}","gists_url":"https://api.github.com/users/fmrieke/gists{/gist_id}","starred_url":"https://api.github.com/users/fmrieke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmrieke/subscriptions","organizations_url":"https://api.github.com/users/fmrieke/orgs","repos_url":"https://api.github.com/users/fmrieke/repos","events_url":"https://api.github.com/users/fmrieke/events{/privacy}","received_events_url":"https://api.github.com/users/fmrieke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-06-30T15:12:23Z","updated_at":"2015-06-30T17:08:25Z","closed_at":null,"body":"The photon rate in sensor appears to be discretized in a way I don't completely understand.  Thus if I do something like\r\n\r\nstimulus(1:100) = 0;\r\nstimulus(1) = 1;\r\nsensor = sensorSet(sensor, 'photon rate', stimulus)\r\nfoo = sensorGet(sensor, 'photon rate')\r\n\r\nfoo(1) is 0.  I might have it wrong, but it seems like it is getting rounded so we have discrete photon counts in each time window - but for the cone model the time windows will be 1 ms or less (for the DEQs to run stably), and certainly can have only a few photons in that window.  And that will be worse for rods!  \r\n\r\nFred"},"comment":{"url":"https://api.github.com/repos/isetbio/isetbio/issues/comments/117260071","html_url":"https://github.com/isetbio/isetbio/issues/47#issuecomment-117260071","issue_url":"https://api.github.com/repos/isetbio/isetbio/issues/47","id":117260071,"user":{"login":"fmrieke","id":8126585,"avatar_url":"https://avatars.githubusercontent.com/u/8126585?v=3","gravatar_id":"","url":"https://api.github.com/users/fmrieke","html_url":"https://github.com/fmrieke","followers_url":"https://api.github.com/users/fmrieke/followers","following_url":"https://api.github.com/users/fmrieke/following{/other_user}","gists_url":"https://api.github.com/users/fmrieke/gists{/gist_id}","starred_url":"https://api.github.com/users/fmrieke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmrieke/subscriptions","organizations_url":"https://api.github.com/users/fmrieke/orgs","repos_url":"https://api.github.com/users/fmrieke/repos","events_url":"https://api.github.com/users/fmrieke/events{/privacy}","received_events_url":"https://api.github.com/users/fmrieke/received_events","type":"User","site_admin":false},"created_at":"2015-06-30T17:08:25Z","updated_at":"2015-06-30T17:08:25Z","body":"I think I should keep poking around a bit and collect a set of related issues (this is one, which I can work around by setting straight to volts, another is that there are multiple time scales floating around with the implementation of the cone model, and which gets used to do what can lead to some confusion).  I’ll flag issues as they come up - and maybe we can discuss re James’ code as some of this relates to how the cone model works.\n\nFred\n\n\n> On Jun 30, 2015, at 10:01 AM, Brian Wandell <notifications@github.com> wrote:\n> \n> Yes, the photons stored in a sensor are the sample from that particular exposure. So when you call sensorGet you are returned the number of recorded photons in a particular exposure. This is always an integer.\n> \n> Fred’s original code appear to set a rate (hence ‘photon rate’) and not a number of photons. That was the basic reason he discovered this issue. We added a case that converts from a mean rate to a mean number of photons for that exposure. This seems to be confusing.\n> \n> In summary, the stored data is not a mean of a distribution. It is a number of photons. The Poisson distribution is used during the computation, and it is not used on every sensorGet().\n> \n> Perhaps we should collaborate on creating a script that does what Fred wants. Or maybe we are doing well by having Fred poke here and there to see where the confusions can arise. Not sure what’s best.\n> \n> Brian\n> \n> \n> > On Jun 30, 2015, at 9:52 AM, David Brainard <notifications@github.com> wrote:\n> > \n> > \n> > I haven’t looked at the code, but I can sort of believe this.\n> > \n> > That is, a calculation of mean rate is done and rounded to an integer, and then Poisson noise added in cases where noise is desired, using integer mean rate.\n> > \n> > But really, the mean rate of a Poisson process should not be constrained to integer values, it should be carried around as a real and then instantiated as either a draw from a Poisson distribution (in the case where we model noise) and something else (when we want no noise.)\n> > \n> > I am not quite sure what we want for the no noise case. Returning real mean values seems most sensible, except that you then can get non-integer photon counts and that might screw up something someone was assuming. But I think it might be better for someone who wants integers to have to round in this case (in essence adding a non-realistic noise at that stage if it suits immediate purposes) than for mean rates of less than 0.5 photons/integration time to always come back as 0.\n> > \n> > > On Jun 30, 2015, at 12:44 PM, Fred Rieke <notifications@github.com> wrote:\n> > > \n> > > I think a similar issue applies there - sensorGet(sensor, ‘photons’) seems to return an integer only (even when sensor.data.volts is nonzero). It also appears deterministic (i.e. not a draw from a Poisson dist).\n> > > \n> > > Fred\n> > > > On Jun 30, 2015, at 9:23 AM, Brian Wandell <notifications@github.com> wrote:\n> > > > \n> > > > One more note \n> > > > \n> > > > If you wish to set the number of photons, not the 'photon rate', then the call \n> > > > \n> > > > sensor = sensorSet(s, 'photons', stimulus)\n> > > > \n> > > > would work OK. \n> > > > \n> > > > Still, we should fix the other stuff. Perhaps not allow 'photon rate' when the exp time is zero (auto-exposure).\n> > > > \n> > > > Brian\n> > > > \n> > > > > On Jun 30, 2015, at 8:47 AM, Brian Wandell <wandell@stanford.edu> wrote:\n> > > > > \n> > > > > That’s interesting. Here is the ‘set’ code from sensorSet()\n> > > > > \n> > > > > case {'photonrate', 'isomerizationrate'}\n> > > > > if ~sensorCheckHuman(sensor)\n> > > > > error('Set photon to sensor can be only used in human cases');\n> > > > > end\n> > > > > cg = sensorGet(sensor, 'conversion gain');\n> > > > > expTime = sensorGet(sensor, 'exposure time');\n> > > > > sensor = sensorSet(sensor, 'volts', val * cg * expTime);\n> > > > > \n> > > > > A few things -\n> > > > > \n> > > > > - It will use ‘photon rate’ only if the word ‘human’ is in the name. That should probably be removed for ISETBIO (it was useful in ISET).\n> > > > > - Photons is not a fundamental variable in the sensor. Rather volts is, and these are related So, the volts are set by multiplying the value sent in (the rate) times the exposure time and conversion gain. \n> > > > > - It is possible that the exposure time is set to zero in this case. That is the value when we use ‘auto exposure’. I just tried this and 0 is the default for sensor, but not for a human sensor.\n> > > > > \n> > > > > >> s = sensorCreate; sensorGet(s,'exp time')\n> > > > > \n> > > > > ans =\n> > > > > \n> > > > > 0\n> > > > > \n> > > > > Note that the default for a human sensor is 50 ms.\n> > > > > \n> > > > > >> s = sensorCreate('human'); sensorGet(s,'exp time')\n> > > > > \n> > > > > ans =\n> > > > > \n> > > > > 0.0500\n> > > > > \n> > > > > I am kind of thinking that for ISETBIO, we should always assume the ‘human’ conditions. This is a really big difference from ISET, which rarely uses the human condition. But making this move now could save us a lot of grief with other people down the road.\n> > > > > \n> > > > > Brian\n> > > > > \n> > > > > \n> > > > >> On Jun 30, 2015, at 8:12 AM, Fred Rieke <notifications@github.com <mailto:notifications@github.com>> wrote:\n> > > > >> \n> > > > >> The photon rate in sensor appears to be discretized in a way I don't completely understand. Thus if I do something like\n> > > > >> \n> > > > >> stimulus(1:100) = 0;\n> > > > >> stimulus(1) = 1;\n> > > > >> sensor = sensorSet(sensor, 'photon rate', stimulus)\n> > > > >> foo = sensorGet(sensor, 'photon rate')\n> > > > >> \n> > > > >> foo(1) is 0. I might have it wrong, but it seems like it is getting rounded so we have discrete photon counts in each time window - but for the cone model the time windows will be 1 ms or less (for the DEQs to run stably), and certainly can have only a few photons in that window. And that will be worse for rods!\n> > > > >> \n> > > > >> Fred\n> > > > >> \n> > > > >> —\n> > > > >> Reply to this email directly or view it on GitHub <https://github.com/isetbio/isetbio/issues/47>.\n> > > > >> \n> > > > > \n> > > > > _____________________________________\n> > > > > Brian A. Wandell\n> > > > > Stein Family Professor\n> > > > > Cognitive and Neurobiological Imaging (CNI)\n> > > > > Psychology Department\n> > > > > Phone: 1-650-725-2466\n> > > > > http://www.stanford.edu/~wandell <http://www.stanford.edu/~wandell>\n> > > > > \n> > > > > \n> > > > > \n> > > > > \n> > > > \n> > > > _____________________________________\n> > > > Brian A. Wandell\n> > > > Stein Family Professor\n> > > > Cognitive and Neurobiological Imaging (CNI)\n> > > > Psychology Department\n> > > > Phone: 1-650-725-2466\n> > > > http://www.stanford.edu/~wandell\n> > > > \n> > > > \n> > > > \n> > > > \n> > > > —\n> > > > Reply to this email directly or view it on GitHub <https://github.com/isetbio/isetbio/issues/47#issuecomment-117244460>.\n> > > > \n> > > \n> > > —\n> > > Reply to this email directly or view it on GitHub <https://github.com/isetbio/isetbio/issues/47#issuecomment-117250708>.\n> > > \n> > \n> > David H. Brainard\n> > Professor of Psychology\n> > Director, Penn Vision Research Center\n> > Director, Institute for Research in Cognitive Science\n> > University of Pennsylvania\n> > 3401 Walnut Street, Suite 400A (mail address)\n> > 3401 Walnut Street, Room 315C (office location)\n> > Philadelphia, PA, 19104\n> > Phone: 215-573-7579\n> > Email: brainard@psych.upenn.edu\n> > Web: http://color.psych.upenn.edu/brainard\n> > \n> > —\n> > Reply to this email directly or view it on GitHub <https://github.com/isetbio/isetbio/issues/47#issuecomment-117254035>.\n> > \n> \n> _____________________________________\n> Brian A. Wandell\n> Stein Family Professor\n> Cognitive and Neurobiological Imaging (CNI)\n> Psychology Department\n> Phone: 1-650-725-2466\n> http://www.stanford.edu/~wandell\n> \n> —\n> Reply to this email directly or view it on GitHub <https://github.com/isetbio/isetbio/issues/47#issuecomment-117257175>.\n> \n\n"}}