Skip to content

Conversation

@yangsunhwang
Copy link

very preliminary. contains a few steps of functions briefly average - merge - plot. Added a few more functions for further steps but needs to be discussed.

@calderast
Copy link
Owner

Thoughts:

  • function average_hex_z_scored_green_dFF should be named more general for any phot series

  • for group_dff_by_hexes_from_end it would be good to be able to specify multiple hex_types (I would imagine we often only want to exclude dead_end_hexes, but are ok with both optimal and non_optimal)

  • it would also be nice to be able to filter based on maze_portion (I could imagine we might want to filter to only chosen section, or maybe exclude unchosen section)

  • also could be nice to filter by duration (we may want to only include hexes where rat spent <1s, or <.5s, so he is actually on the path to the goal and not just hanging out)

-> although actually, we maybe just want to filter the df before passing it in. so the function doesn't have to do this filtering. or if the function does this it should def be optional

for averaging DA (or any phot signal), make sure to account for the duration of each sample. the true mean is actually avg_in_that_hex*duration_in_that_hex , and then all divided by the total duration (python probs has a weighted avg function)

General comments

  • when passing a dataframe into a function and modifying it, it modifies the original df. so consider copying the df before you modify
  • i think dopamine should be green. <3

Copy link
Owner

@calderast calderast left a comment

Choose a reason for hiding this comment

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

See prev comment

@yangsunhwang
Copy link
Author

pls review my code <3

Copy link
Owner

@calderast calderast left a comment

Choose a reason for hiding this comment

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

for add_averaged_series_column you could even get soooo crazy and just grab the name from the series object itself instead of new_col_name as an argument. but that's totally optional, this function rocks!

for weighted_mean_and_sem if you're always using it with the hexpath df, the duration column name will always be duration so you might not need that as an argument. Not sure if the weighted part would make sense with any other column that isn't duration, but I also understand keeping it for flexibility

for group_series_by_hex_path_col you actually do a lot of filtering etc that I would maybe do separately from this function? like I would probably filter the df first (or have a filtering function for all filtering - like how you do then duration filtering earlier - these should probably all be filtered all at once) and then the function just for the grouping. so then it's easier to have a pipeline of df -> add series col -> filter -> group

also the plots are so cute I LOVE THESE RAMPS. YOU ROCK

you already KNOW i LOVE the maze hexes colored by DA !!!! perfect incredible!! (I will add more comments on the filtering by conditions part after this flight! but PR is approved you can merge if you wish)

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.

2 participants