vtem.vtem.VTEM_IAF

vtem.vtem.VTEM_IAF(videofile, output_filename, Wt, rf, Wx=25.132741228718345, Wy=25.132741228718345, start_frame=0, end_frame=None, dx=0.0625, dy=0.0625, fps=100, domain=None, h5input=True, npinput=False)

Encode a video with IAF neurons and the specified Receptive field

Parameters:

videofile : string

Either
1. Filename of a file containing the input video
must be stored using write_memory_to_file in simpleio.py
or using h5write in matlab
Video array with shape (a,b,c)
a: total number of frames
b: number of pixels in y direction
c: number of pixels in x direction
c is the leading dimension
in matlab should be (c,b,a)
2. Or filename of a video file if h5input is set to False. 
Will throw an error if OpenCV and the required codec are
not installed         

output_filename : string

output filename that will contain the spike info

Wt : float

bandwidth in t variable if not specified, will use the info in spikefile

rf : vrf

Receptive field object.

Wx : float, optional

bandwidth in x variable if not specified, will use the info in spikefile

Wy : float, optional

bandwidth in y variable if not specified, will use the info in spikefile

start_frame : integer, optional

starting frame to be encoded in the video

end_frame : integer, optional

ending frame to be encoded if not specified, will encoding to the end of the video

dx : integer, optional

spatial resolution in x direction, distance between two pixels

dy : integer, optional

spatial resolution in y direction, distance between two pixels

fps : integer, optional

frames per second of the video

domain : list, optional

list of 2, [a,b], specifying the domain to encode a in x direction, b in y direction will only encode the center of the video with size [a,b] if not specified, the whole video screen will be encoded.

h5input : bool, optional

True if the file specified is an h5 file. False if the file specified is a video file. If not specified, is set to True

npinput : bool, optional

True if videofile is a numpy array. If not specified, will be set to False.

Notes

The coordinate system is given by the following

Row (width / X) major

-----------------------------------------> width
|   Y
|   ^-------------------->
|   |-------------------->
|   |-------------------->
|   |--------------------> X
| 
|
v
height

Examples

>>> import atexit
>>> import pycuda.driver as cuda
>>> import numpy as np
>>> from vtem import vtem,vtdm
>>> cuda.init()
>>> context1 = cuda.Device(0).make_context()
>>> atexit.register(cuda.Context.pop)
>>> gb = vrf.vrf_gabor((Py,Px), domain=domain, dx=dx, dy=dy)
>>> gb.load_parameters()
>>> gb.get_gabor_parameters(dilations = [1, 0, -1, -2, -3], num_rotations = 8, 
                            alpha0 = np.float64(2), b0 = np.float64(1.5), 
                            b0scalebase=np.sqrt(2), KAPPA = 3)
>>> gb.load_parameters(set=1)
>>> vtem.VTEM_Gabor_IAF('video.h5', 'spikes.h5', 2*np.pi*10, gb)