Giter Site home page Giter Site logo

arash-ashra / prfsim Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 41.5 MB

A free & open source python package for population receptive field (PRF) simulation

Home Page: https://pypi.org/project/prfsim/

License: GNU General Public License v3.0

Python 7.25% Jupyter Notebook 0.89% TeX 91.53% Shell 0.14% Makefile 0.19%

prfsim's Introduction

PyPRF

Binder

A free & open source python package for population receptive field (PRF) simulation. This package is mainly developed for functional magnetic resonance imaging (fMRI) experiments.

Installation

The prfsim package can directly be installed from PyPI, in the following way:

pip install prfsim

Dependencies

prfsim is implemented in [Python 3.6.4]

If you install pyprf using pip (as described above), all of the following dependencies are installed automatically - you do not have to take care of this yourself. Simply follow the above installation instructions.

pRFsim dependencies Tested version
NumPy 1.14.0
Pandas 0.22.0
SciPy 1.0.0
Seaborn 0.8.1
Pillow 5.0.0

Contributions

For contributors, we suggest the following procedure:

  • Create your own branch (in the web interface, or by git checkout -b new_branch)
    • If you create the branch in the web interface, pull changes to your local repository (git pull)
  • Change to new branch: git checkout new_branch
  • Make changes
  • Commit changes to new branch (git add . and git commit -m)
  • Push changes to new branch (git push origin new_branch)
  • Create a pull request using the web interface

References

This application is based on the following work:

[1] Dumoulin, S. O. & Wandell, B. A. (2008). Population receptive field estimates in human visual cortex. NeuroImage 39, 647โ€“660.

Support

Please use the github issues for questions or bug reports.

License

The project is licensed under GNU General Public License Version 3.

How to use

import prfsim.sim as psim
import numpy as np

# experiment parameters
radius = 10
precision = 0.1
barWidth = radius / 4
angles = [-90, 45, -180, 315, 90, 225, 0, 135]
nFrames = len(angles)*3
TR = 3.0
TRs = 5 # number of TRs for each frame
duration = nFrames*TRs

x, y = np.mgrid[-radius:radius:precision,
                -radius:radius:precision]
pos = np.dstack((x, y))
length = len(x[0])
nVoxels = 6

# parameters for double gamma distribution function hrf:
n1 = 4
lmbd1 = 2.0
t01 = 0
n2 = 7
lmbd2 = 3
t02 = 0
a = 0.3

t = np.arange(0,nFrames*TRs*TR,TR)
hrf_gen = psim.hrf_double_gamma(t, n1, n2, lmbd1, lmbd2, t01, t02, a)
hrf_est = hrf_gen

stim = psim.generateStim(radius=radius, precision=precision,
                    barWidth=barWidth, angles=angles,
                    nFrames=nFrames, length=length,
		            TR=TR, TRs=TRs, isCheckerboard=False)
print('stimulus generated')


neuronal_responses = psim.getNeuronalResponse(stim=stim, nVoxels=nVoxels,
                                        radius=radius, precision=precision,
                                        duration=duration)
print('Neuronal responses generated')


bolds = psim.generateData(neuronal_responses=neuronal_responses,
                     hrf=hrf_gen,
                     duration=duration, nVoxels=nVoxels)
print('BOLD responses generated')


print('pRF estimations started...')
results = psim.estimateAll(bolds=bolds, stim=stim,
                      hrf=hrf_est, radius=radius,
                      precision=precision,
                      nVoxels=nVoxels, margin = 1)
print('pRF estimation errors generated')

prfsim's People

Contributors

arash-ashra avatar

Stargazers

 avatar Can Koz 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.