GithubHelp home page GithubHelp logo

collectivedetection's Introduction

collectivedetection

Contains codes to produce the results in the paper: Davidson, J.D., Sosna, M.M.G., Twomey, C.R., Sridhar, V.H., Leblanc, S.P., Couzin, I.D., 2021. Collective detection based on visual information in animal groups. Journal of The Royal Society Interface 18, 20210142. https://doi.org/10.1098/rsif.2021.0142

Associated data is available at:
https://datadryad.org/stash/share/UH5t3WTf-PJPjzxmgDk1V2B7HwcsJiz1Nk6UVrSuO6A

Note: Only the files '4 - Data figures.ipynb' and '5 - Model.ipynb' are needed to reproduce results in the paper, if the simplified data and processed results are used (zip file saved_data_and_results.zip in the Dryad archive).

Files to reproduce figures and results in the paper

4 - Data figures.ipynb

Code to make all figures in the paper except Fig 7 (which is for the model)

5 - Model.ipynb

Code to fit model and make Figure 7, which is associated with the model and data comparison

Analytical Approx.nb

Mathematica code to do the series expansion for the analytical approximation to model detection coverage

detectionfunctions.py, raycastingfunctions.py

Contain functions used in other files

Files to process data, calculate detection results, and save in a simpler format:

1 - Process data.ipynb

Reads in .h5 data files and saves simpler format '*basicdata-v3.pklz', which can then be read in with, for example:

[positions,orientations,tailcoords,lefteye,righteye,groupcentroid,groupheading,groupheadingxy,groupstates,pixelwidth,pixelheight,rotcoords] = pickle.load(gzip.open('10-fish/0066/basicdata-v3.pklz','rb'))

2 - Detection-run simulation.ipynb

Runs collective detection algorithm and saves for each trial, saving in the format (for example):

pickle.dump([pointdist,allseen,allseen_high,allseen_low,allrelangle,processing_skipvalue],gzip.open('10-fish/0066/detection-probabilistic-perfish.pklz',"wb"),protocol=4)

3 - Process Detection results.ipynb

Processes detection and tracking results and saves in condensed form. This saves the 4 files found in saved_data_and_results.zip in the Dryad archive, which can be read in as follows:

[grid_allseen, grid_allseen_problow, grid_allseen_probhigh, grid_allseen_blind,processing_skipvalue] = pickle.load(gzip.open('detectionresults.pklz','rb'))   
[grid_frontbackdist,grid_sidesidedist,grid_groupstates,grid_groupheading,grid_orientations,grid_tailcoords,grid_positions,grid_groupcentroid,grid_lefteye,grid_righteye] = pickle.load(gzip.open('data-grid.pklz','rb'))
[degreebins,distbins,d1D,exampledata] = pickle.load(open('distributions+exampledata.pkl','rb'))
[indiv_mean,indiv_std,group_mean,group_std] = pickle.load(open('ind-groupmeans.pkl','rb'))

collectivedetection's People

Contributors

jacobdavidson avatar

Stargazers

Zodiac Wang (王涛) avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.