-
Notifications
You must be signed in to change notification settings - Fork 159
Add function to check for existing column name in list of column names #1619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to check for existing column name in list of column names #1619
Conversation
Keys for the name of stimulus are different between eceephys and behavior ophys. This adds in a small function to get the key represented in each data type and raise an exception if one key is not found. This was added to allow ophys behavior experiments to write to nwb files.
I updated the function to be more generic and removed specific case verbaige. I also fixed the failing tests on Linux and Mac. The regex for the tests was returning an error on Linux and Mac.
Codecov Report
@@ Coverage Diff @@
## address-behavior-ophys-NWB-failures #1619 +/- ##
=======================================================================
+ Coverage 35.58% 35.60% +0.01%
=======================================================================
Files 344 345 +1
Lines 33568 33577 +9
=======================================================================
+ Hits 11946 11955 +9
Misses 21622 21622
Continue to review full report at Codecov.
|
| def get_column_name(table_cols: list, | ||
| possible_names: set) -> str: | ||
| """ | ||
| This function acts a identifier for which column name is present in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would reword this bit:
This function returns a column name, given a table with unknown
column names and a set of possible column names which are expected.
The table column name returned should be the only name contained in
the "expected" possible names.
Because stimulus presentation table column names (and contents)
differ between ecephys and visual behavior, this function determines
the proper column name to use in order to select the 'name' of a
presented stimulus (e.g. "gabors", "dot_motion", "natural_movie_1", etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, changed the doc string to what you have provided.
Updated the Docstring to better capture the puprose of the function. This better aligns with the expectation of functional performance.
61845d8
into
address-behavior-ophys-NWB-failures
Overview:
This pull request addresses a failure in NWB writing where Behavior Ophys experiments do not have the hard coded
stimulus_namekey available. This has now been rectified by adding in a small function that checks for the existance of equivalent keys in the stimulus table dataframe.Validation:
I've included test cases to test for the existance of the keys in the provided keys, ie: checking for a column name within a set of column names. These cases cover the cases where it finds the eccephys key or the behavior ophys key. It also covers the case where it finds no keys and the case where it finds more than one key.
I have also run the BehaviorOphysNWBAPI.save() function that calls this function and it proceeds past this point, correctly grabbing the names of the stimuli in the stimuli table.