https://github.com/alleninstitute/licking_behavior_np

Analysis of mouse licking behavior during visually guided behavior

https://github.com/alleninstitute/licking_behavior_np

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Analysis of mouse licking behavior during visually guided behavior

Basic Info
  • Host: GitHub
  • Owner: AllenInstitute
  • Language: Python
  • Default Branch: master
  • Size: 7.54 MB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Created about 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme

README.md

licking_behavior

Analysis of mouse licking behavior during visually guided behavior. Primarily, this repo develops a time-varying logistic regression model that learns the probability of licking on a flash by flash basis, using weights that vary over time by following random walk priors.

This repository is specific to the Visual Behavior Neuropixels dataset. If you want to look at the Visual Behavior Optical Physiology dataset use github.com/alexpiet/licking_behavior. The model works the same but the data is loaded and processed slightly differently due to the VBN sessions being structured differently.

Installation

git clone https://github.com/AllenInstitute/lickingbehaviorNP
pip install -e . #run in directory with setup.py

Time varying regression model

The model predicts the probability of the mouse starting a licking bout on each image presentation. Its described as the sum of several time-varying strategies.

  • Bias, is a strategy that wants to lick on every image
  • Visual/Task0, is a strategy that only wants to lick on the image-changes
  • Timing1D, is a strategy that wants to lick every 4-5 images after the end of the last licking bout
  • Omission0, is a strategy that wants to lick on every omission
  • Omission1, is a strategy that wants to lick on the image after every omission

Fitting the time varying regression model

import lickingbehaviorNP.psytools as ps
for bsid in behavior
sessionids:
ps.process
session(bsid)

Model outputs

The key output dataframes are:

  • summary_df, each behavioral session is a row, and columns contain model metrics and other behavioral metrics
  • change_df, each image change across all behavioral sessions is a row
  • licks_df, each lick across all behavioral sessions is a row
  • bouts_df, each licking bout across all behavioral sessions is a row

Diagram of information flow

code_diagram

summary_df

import lickingbehaviorNP.psyoutputtools as po
summarydf = po.getnpsummarytable(BEHAVIOR_VERSION)

The columns of summarydf are: - sessionroc (float) The cross validated area under the ROC curve for this session
- strategydropoutindex (float) The strategy index for this session
- visualstrategysession (bool) Whether the visual strategy was dominant in this session
- strategylabels (str) Either 'visual' or 'timing' - priorbias (float) the smoothing prior for the licking bias strategy
- prioromissions (float) the smoothing prior for the licking omissions strategy
- prior
omissions1 (float) the smoothing prior for the post omissions strategy
- priortask0 (float) the smoothing prior for the visual strategy
- prior
timing1D (float) the smoothing prior for the timing strategy
- dropoutbias (float) the dropout index for the licking bias strategy
- dropout
omissions (float) the dropout index for the licking omissions strategy
- dropoutomissions1 (float) the dropout index for the post omissions strategy
- dropout
task0 (float) the dropout index for the visual strategy
- dropouttiming1D (float) the dropout index for the timing strategy
- dropout
cvbias (float) the cross validated dropout index for the licking bias strategy
- dropout
cvomissions (float) the cross validated dropout index for the licking omissions strategy
- dropout
cvomissions1 (float) the cross validated dropout index for the post omissions strategy
- dropout
cvtask0 (float) the cross validated dropout index for the visual strategy
- dropout
cvtiming1D (float) the cross validated dropout index for the timing strategy
- avg
weightbias (float) the average weight for the licking bias strategy
- avg
weightomissions (float) the average weight for the licking omissions strategy
- avg
weightomissions1 (float) the average weight for the post omissions strategy
- avg
weighttask0 (float) the average weight for the visual strategy
- avg
weighttiming1D (float) the average weight for the timing strategy
- num
hits (float) number of hits in this session
- nummiss (float) number of misses in this session
- num
omissionlicks (float) number of licking bouts that started during an omission
- num
postomissionlicks (float) number of licking bouts that started on the image after an omission
- numlatetasklicks (float) number of licking bouts that started on the image after an image change - numchanges (float) number of image changes
- numomissions (float) number of omissions
- num
imagefalsealarm (float) number of licking bouts that started on a non-change image - numimagecorrectreject (float) number of non-change images that did not contain the start of a licking bout
- num
lickbouts (float) number of licking bouts - lickfraction (float) the percentage of images with the start of a licking bout - omissionlickfraction (float) the percentage of omissions with the start of a licking bout - postomissionlickfraction (float) the percentage of post-omission images with the start of a licking bout - lickhitfraction (float) the percentage of licking bouts that resulted in a reward
- trial
hitfraction (float) the percentage of image changes that were rewarded
- strategy
weightindex (float) the difference in average strategy weights between visual and timing strategies
- fraction
engaged (float) the percentage of the session when the mouse was engaged

Additionally, there are columns that are split by whether the mouse was engaged or disengaged. These should be self-explanatory based on the corresponding column that isn't split by engagement.

Finally, there are columns that are lists of length 4800 that correspond to each image presented during the active behavior period:
- weightbias (float) the weight of the licking bias strategy
- weight
omissions (float) the weight of the omission strategy
- weightomissions1 (float) the weight of the post omission strategy
- weight
task0 (float) the weight of the visual strategy
- weighttiming1D (float) the weight of the timing strategy
- lick
boutrate (float) the rate of licking bouts (units=licking bouts / second)
- hit (float) was it a hit? Nan=image repeat, 1=hit, 0=miss
- RT (float) reaction time from stimulus onset. Nan=no licking bout start - image
name (str) stimulus name
- imagecorrectreject (float) 0=licked, 1=did not lick, nan=in licking bout, or image change - imagefalsealarm (floaT), 1=licked, 0=did not lick, nan=image change - engaged (bool) Was the animal engaged?
- omitted (bool) was the stimulus omitted
- ischange (bool) was the stimulus and image change
- lick
boutstart (bool) did a lick bout start on this image
- miss (float) nan=image repeat, 0=hit, 1=miss
- reward
rate (float) reward rate (units=rewards/second)
- strategyweightindexbyimage (float) different in weight of visual and timing strategies
- lickhitfraction_rate (float) the rolling percentage of licking bouts that resulted in a reward (units=%)

change_df

import lickingbehaviorNP.psyoutputtools as po
changedf = po.getchangetable(BEHAVIORVERSION)

licks_df

import lickingbehaviorNP.psyoutputtools as po
licksdf = po.getlickstable(BEHAVIORVERSION)

The columns of licksdf are:
- timestamps (float) time of lick
- pre
ili (float) time from last lick
- postili (float) time until next lick
- bout
start (bool) whether this lick was the start of a licking bout
- boutend (bool) whether this lick was the end of a licking bout
- bout
number (bool) oridinal numbering of bouts in this session
- rewarded (bool) whether this lick was rewarded
- numrewards (int) number of rewards resulting from this lick. Can be > 1 from auto-rewards getting assigned to nearest lick
- bout
rewarded (bool) whether this licking bout was rewarded
- boutnumrewards (int) number of rewards resulting from this lick bout. Can be > 1 from auto-rewards getting assigned to nearest lick
- behaviorsessionid (int64)

bouts_df

import lickingbehaviorNP.psyoutputtools as po
licksdf = po.getlickstable(BEHAVIORVERSION)
boutsdf = po.buildbouttable(licksdf)

The columns of boutsdf are:
- behavior
sessionid (int)
- bout
number (int) ordinal count within each session
- boutlength (int) number of licks in bout
- bout
duration (float) duration of bout in seconds
- boutrewarded (bool) whether this bout was rewarded
- pre
ibi (float) time from the end of the last bout to the start of this bout
- postibi (float) time until the start of the next bout from the end of this bout
- pre
ibifromstart (float) time from the start of the last bout to the start of this bout
- postibifrom_start (float) time from the start of this bout to the start of the next

figure script

import lickingbehaviorNP.figurescript as f
f.make
figure1supplementbehavior()
f.make
figure1timingendoflickbout()
f.makefigure1supplementtask()
f.makefigure1supplementlicking()
f.makefigure2()
f.makefigure2supplementmodelvalidation()
f.make
figure2supplementstrategycharacterization()
f.makefigure2supplementstrategycharacterizationrates()
f.makefigure2supplmentpca()
f.makefigure2novelty()
f.make
figure_3()

Owner

  • Name: Allen Institute
  • Login: AllenInstitute
  • Kind: organization
  • Location: Seattle, WA

Please visit http://alleninstitute.github.io/ for more information.

GitHub Events

Total
  • Push event: 2
Last Year
  • Push event: 2

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 18
  • Total pull requests: 2
  • Average time to close issues: 3 days
  • Average time to close pull requests: about 3 hours
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.67
  • Average comments per pull request: 0.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 2
  • Average time to close issues: 8 days
  • Average time to close pull requests: about 3 hours
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • alexpiet (14)
  • RobertoDF (3)
Pull Request Authors
  • RobertoDF (2)
  • alexpiet (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

setup.py pypi