AllenInstitute / mindscope_utilities

Utilities for loading, manipulating and visualizing data from the Allen Institute Mindscope program
Other
2 stars 1 forks source link

changing the sign of `t_before` input variable in `event_triggered_response()` #26

Closed yavorska-iryna closed 3 years ago

yavorska-iryna commented 3 years ago

Currently, t_before is passed as integer or float with a positive sign, then changed to a negative number, which is hardcoded in the function. This poses an issue because in order to be able to pass a t_before value that is post event onset, it needs to be negative. For instance, if you are aligning traces 3 seconds prior to an event and 3 seconds post event, you would pass t_before=3 and t_after=3. But if you are aligning traces 1 second post event to 3 seconds post event, you would need to pass t_before=-1 and t_after=3, which is confusing and unintuitive. This needs to be changed that t_before is passed with a desired sign, making it t_before=-3 and t_after=3 in the first case and t_before=1 and t_after=3 in the second case.

dougollerenshaw commented 3 years ago

Thanks @yavorska-iryna. I definitely understand the potential for confusion and I think it comes down to poor variable name choices on my part. But I'd argue that calling the variable t_before necessitates that this is the time before each event as a positive number. I.e., saying t_before = 1 implies that the time range should start 1 second before the event.

Alternately, if we were to change it, a user would pass t_before = -1 to maintain the current behavior. I'd argue that this would be more confusing because the time range would not be starting -1 seconds before the event, as the variable name implies.

So, how about this as an alternate solution?:

In addition to providing more clearly labeled variable names, this solution would have the additional benefit of not affecting existing behavior.

dougollerenshaw commented 3 years ago

@yavorska-iryna see this PR for my proposed solution: https://github.com/AllenInstitute/mindscope_utilities/pull/27