Skip to content

Conversation

@jdppthk
Copy link

@jdppthk jdppthk commented Aug 25, 2018

No description provided.

@CLAassistant
Copy link

CLAassistant commented Aug 25, 2018

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ jdppthk
❌ EC2 Default User


EC2 Default User seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

…all the stimuli at different times in a given time window with a given sampling rate
import pandas as pd


def get_frame_at_time(time, stim_table):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of oddities about this function. One is that it selects the output column by integer index rather than name, which will fail if you run into a stim table with differently-ordered or inserted columns. The other is that you are looking at start times and not end times, so if you supply a time after the bounds of the experiment, this function will happily report the last value from the dataframe (rather than throwing an error or otherwise notifying the caller).

Maybe something like this (sans error handling):

def get_frame_at_time(time, stim_table):
    return stim_table.loc[(stim_table['start'] <= time) & (stim_table['end'] > time), 'frame'].values[0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants