samuroi.plugins package¶
Functions¶
-
samuroi.plugins.andor.
load_andor
(prefix)[source]¶ - todo fixme
- return the data of the tif file as numpy array it will have the shape (X,Y,N) where - X denotes the coordinate from left to right - Y denotes the coordinate from top to bottom - N denotes the frames return tuple of data, parsed dictionary
-
class
samuroi.plugins.swc.
SWCFile
(filename=None)[source]¶ Subclass of numpy.recarray for swc files.
-
branches
¶ Returns: A generator object that allows to iterate over all branches.
-
nbranches
¶ Returns: The number of branches in the file.
-
-
samuroi.plugins.baseline.
bandstop
(data, fs, start, stop, order=3)[source]¶ Apply bandstop filter on data.
Parameters: - data – 3D video data
- fs – sampling frequency
- order – the order of butter filter used.
- start – lower frequency where band starts
- stop – higher frequency where band ends
Returns: the filtered 3d data set.
-
samuroi.plugins.baseline.
linbleeched_F0
(data)[source]¶ Calculate a linear fit (\(y(t)=m t+y_0)\) for each pixel, which is assumed to correct for bleeching effects.
Parameters: data – he video data of shape (M,N,T). Returns: tuple (m,y0) with two images each with shape (M,N).
-
samuroi.plugins.baseline.
linbleeched_deltaF
(data, F0=None)[source]¶ Assumes that the fluorescence F0 follows linear bleeching (see
samuroi.plugins.baseline.linbleeched_F0()
). Determines the linear fit parameters m,y0 for \(F_0(t) = m f(t)+y_0\). Then uses \(F_0(t)\) to calculate \((F(t)-F_0(t))/F_0(t)\).Parameters: - data – The video data of shape (M,N,T).
- F0 –
Returns: deltaF/F0 for bleech corrected \(F_0(t)\).
-
samuroi.plugins.baseline.
median_F0
(data)[source]¶ Calculate a time dependent F0, which does not depend on spatial coordinates. The definition is as follows: \(F_0(t)\) = median(\(F(x,y,t)\) for all x,y)
Parameters: data – The video data of shape (M,N,T). Returns: F0 array of shape (T,).
-
samuroi.plugins.baseline.
median_deltaF
(data)[source]¶ Apply the deltaF/F transformation with \(F_0\) defined as in
samuroi.plugins.baseline.median_F0()
.Parameters: data – The video data of shape (M,N,T). Returns: deltaF/F0 for median \(F_0(t)\).
-
samuroi.plugins.baseline.
power_spectrum
(data, fs)[source]¶ Calculate the power spectrum for each pixel and then average over all pixels.
Parameters: - data – the 3D video data.
- fs – sampling frequency.
Returns: tuple(df,avgpower) where df is a 1d array of frequencies and avgpower is a 1D array with the respective average power.
-
samuroi.plugins.baseline.
stdv_F0
(data, windows=None)[source]¶ Calculate the baseline for each pixel of data. Subdivides data in blocks of B frames and calculate the standard deviation for each block. Then takes the block with minimum standard deviation and calculate the mean of that block. The above is done on a per pixel basis. I.e. different pixels can have the mean calculated for different blocks.
Parameters: - data – NxMxF array, where F is number of frames and NxM is image shape.
- windows – The number of windows to use. Default: split the data in blocks of 100 frames. If data.shape[2] mod 100 != 0 drop the frames that are remaining.
Returns: NxM array with baseline for each pixel.
-
samuroi.plugins.baseline.
stdv_deltaF
(data, F0=None, windows=None)[source]¶ Calculate the fraction dF/F0 for each pixel. F0 is assumed to not depend on time, but on spatial coordinates. for the definition of F0 see
samuroi.plugins.baseline.stdv_F0()
.Parameters: - data – The video data, shape M,N,T
- F0 – precalculated F0 or None(default calculate F0 internally)
- windows – The number of windows, forwarded to stdv_F0
Returns: numpy.array with shape M,N,T with values \((F(x,y,t)-F0(x,y))/F0(x,y)\)