Closed yavorska-iryna closed 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?:
t_before
and t_after
as is, but we are clearer about their behavior in the docstring.t_start
and t_end
, that would act exactly as you described above.t_before
and t_start
, or both t_after
and t_end
.In addition to providing more clearly labeled variable names, this solution would have the additional benefit of not affecting existing behavior.
@yavorska-iryna see this PR for my proposed solution: https://github.com/AllenInstitute/mindscope_utilities/pull/27
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 at_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 passt_before=3
andt_after=3
. But if you are aligning traces 1 second post event to 3 seconds post event, you would need to passt_before=-1
andt_after=3
, which is confusing and unintuitive. This needs to be changed thatt_before
is passed with a desired sign, making itt_before=-3
andt_after=3
in the first case andt_before=1
andt_after=3
in the second case.