Skip to main content

A free & open source python tool for population receptive field simulation of fMRI data.

Project description

# PyPRF
<img src="logo.png" width=200 align="right" />

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:

```bash
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](http://www.numpy.org/) | 1.14.0 |
| [Pandas](https://pandas.pydata.org/) | 0.22.0 |
| [SciPy](http://www.scipy.org/) | 1.0.0 |
| [Seaborn](https://seaborn.pydata.org/) | 0.8.1 |

## 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](https://github.com/arash-ash/prfsim/issues) for questions or bug reports.

## License
The project is licensed under [GNU General Public License Version 3](http://www.gnu.org/licenses/gpl.html).

## How to use
```bash
# 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 = hrf_double_gamma(t, n1, n2, lmbd1, lmbd2, t01, t02, a)
hrf_est = hrf_gen

pt = time.process_time()
stim = generateStim(radius=radius, precision=precision,
barWidth=barWidth, angles=angles,
nFrames=nFrames, length=length,
TR=TR, TRs=TRs)
elapsed_time = time.process_time() - pt
print('stimulus generated in %0.3f seconds'%elapsed_time)

pt = time.process_time()
neuronal_responses = getNeuronalResponse(stim=stim, nVoxels=nVoxels,
radius=radius, precision=precision,
duration=duration)
elapsed_time = time.process_time() - pt
print('Neuronal responses generated in %0.3f seconds'%elapsed_time)


pt = time.process_time()
bolds = generateData(neuronal_responses=neuronal_responses,
hrf=hrf_gen,
duration=duration, nVoxels=nVoxels)
elapsed_time = time.process_time() - pt
print('BOLD responses generated in %0.3f seconds'%elapsed_time)


pt = time.process_time()
print('pRF estimations started...')
results = estimateAll(bolds=bolds, stim=stim,
hrf=hrf_est, radius=radius,
precision=precision,
nVoxels=nVoxels, margin = 1)
elapsed_time = time.process_time() - pt
print('pRF estimation errors generated in %0.3f seconds'%elapsed_time)
```



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prfsim-0.1.2-py2.py3-none-any.whl (24.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file prfsim-0.1.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for prfsim-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6693bdcd15619b8211f4a8f82c5b290a206b3903aab955d54df8a0c48463ab44
MD5 1746863adca64d571a61f9c1291e4845
BLAKE2b-256 1463576c9787fd04fef0351a2da2677e1e7d3632d5670e1bdfdb9071d2413e03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page