@@ -1543,7 +1543,7 @@ def scale_data_colormap(self, fmin, fmid, fmax, transparent, verbose=None):
1543
1543
data ["transparent" ] = transparent
1544
1544
self ._toggle_render (True , views )
1545
1545
1546
- def set_data_time_index (self , time_idx , interpolation = 'linear ' ):
1546
+ def set_data_time_index (self , time_idx , interpolation = 'quadratic ' ):
1547
1547
"""Set the data time index to show
1548
1548
1549
1549
Parameters
@@ -1552,7 +1552,7 @@ def set_data_time_index(self, time_idx, interpolation='linear'):
1552
1552
Time index. Floats will cause samples to be interpolated.
1553
1553
interpolation : str
1554
1554
Interpolation method (``scipy.interpolate.interp1d`` parameter,
1555
- default 'linear ').
1555
+ default 'quadratic ').
1556
1556
"""
1557
1557
if self .n_times is None :
1558
1558
raise RuntimeError ('cannot set time index with no time data' )
@@ -1946,9 +1946,8 @@ def save_imageset(self, prefix, views, filetype='png', colorbar='auto',
1946
1946
return images_written
1947
1947
1948
1948
def save_image_sequence (self , time_idx , fname_pattern , use_abs_idx = True ,
1949
- row = - 1 , col = - 1 , montage = 'single' , orientation = 'h' ,
1950
- border_size = 15 , colorbar = 'auto' ,
1951
- interpolation = 'linear' ):
1949
+ row = - 1 , col = - 1 , montage = 'single' , border_size = 15 ,
1950
+ colorbar = 'auto' , interpolation = 'quadratic' ):
1952
1951
"""Save a temporal image sequence
1953
1952
1954
1953
The files saved are named "fname_pattern % (pos)" where "pos" is a
@@ -1971,11 +1970,10 @@ def save_image_sequence(self, time_idx, fname_pattern, use_abs_idx=True,
1971
1970
montage: 'current' | 'single' | list
1972
1971
Views to include in the images: 'current' uses the currently
1973
1972
displayed image; 'single' (default) uses a single view, specified
1974
- by the ``row`` and ``col`` parameters; a list can be used to
1975
- specify a complete montage (see :meth:`save_montage`).
1976
- orientation: {'h' | 'v'}
1977
- Montage image orientation (horizontal of vertical alignment; only
1978
- applies if ``montage`` is a flat list).
1973
+ by the ``row`` and ``col`` parameters; a 1 or 2 dimensional list
1974
+ can be used to specify a complete montage. Examples:
1975
+ ``['lat', 'med']`` lateral and ventral views ordered horizontally;
1976
+ ``[['fro'], ['ven']]`` frontal and ventral views ordered vertically.
1979
1977
border_size: int
1980
1978
Size of image border (more or less space between images).
1981
1979
colorbar: 'auto' | int | list of int | None
@@ -1984,7 +1982,7 @@ def save_image_sequence(self, time_idx, fname_pattern, use_abs_idx=True,
1984
1982
views. For ``None``, no colorbar is shown.
1985
1983
interpolation : str
1986
1984
Interpolation method (``scipy.interpolate.interp1d`` parameter,
1987
- default 'linear ').
1985
+ default 'quadratic ').
1988
1986
1989
1987
Returns
1990
1988
-------
@@ -2002,8 +2000,8 @@ def save_image_sequence(self, time_idx, fname_pattern, use_abs_idx=True,
2002
2000
elif montage == 'current' :
2003
2001
self .save_image (fname )
2004
2002
else :
2005
- self .save_montage (fname , montage , orientation , border_size ,
2006
- colorbar , row , col )
2003
+ self .save_montage (fname , montage , 'h' , border_size , colorbar ,
2004
+ row , col )
2007
2005
images_written .append (fname )
2008
2006
rel_pos += 1
2009
2007
@@ -2088,11 +2086,16 @@ def save_montage(self, filename, order=['lat', 'ven', 'med'],
2088
2086
return out
2089
2087
2090
2088
def save_movie (self , fname , time_dilation = 4. , tmin = None , tmax = None ,
2091
- interpolation = 'linear ' , montage = 'current ' , orientation = 'h' ,
2092
- border_size = 15 , colorbar = 'auto ' , framerate = 25 ,
2093
- codec = 'mpeg4' , row = - 1 , col = - 1 ):
2089
+ montage = 'current ' , colorbar = 'auto ' , border_size = 15 ,
2090
+ framerate = 25 , interpolation = 'quadratic ' , codec = 'mpeg4' ,
2091
+ row = - 1 , col = - 1 ):
2094
2092
"""Save a movie (for data with a time axis)
2095
2093
2094
+ .. Warning::
2095
+ This method assumes that time is specified in seconds when adding
2096
+ data. If time is specified in milliseconds this will result in
2097
+ movies 1000 times longer than expected.
2098
+
2096
2099
Parameters
2097
2100
----------
2098
2101
fname : str
@@ -2105,31 +2108,30 @@ def save_movie(self, fname, time_dilation=4., tmin=None, tmax=None,
2105
2108
First time point to include (default: all data).
2106
2109
tmax : float
2107
2110
Last time point to include (default: all data).
2108
- interpolation : str
2109
- Interpolation method (``scipy.interpolate.interp1d`` parameter,
2110
- default 'linear').
2111
2111
montage: 'current' | 'single' | list
2112
2112
Views to include in the images: 'current' (default) uses the
2113
2113
currently displayed image; 'single' uses a single view, specified
2114
- by the ``row`` and ``col`` parameters; a list can be used to
2115
- specify a complete montage (see :meth:`save_montage`).
2116
- orientation: {'h' | 'v'}
2117
- montage image orientation (horizontal of vertical alignment; only
2118
- applies if ``montage`` is a flat list)
2119
- border_size: int
2120
- Size of image border (more or less space between images)
2114
+ by the ``row`` and ``col`` parameters; a 1 or 2 dimensional list
2115
+ can be used to specify a complete montage. Examples:
2116
+ ``['lat', 'med']`` lateral and ventral views ordered horizontally;
2117
+ ``[['fro'], ['ven']]`` frontal and ventral views ordered vertically.
2121
2118
colorbar: 'auto' | int | list of int | None
2122
2119
For 'auto', the colorbar is shown in the middle view (default).
2123
2120
For int or list of int, the colorbar is shown in the specified
2124
2121
views. For ``None``, no colorbar is shown.
2122
+ border_size: int
2123
+ Size of image border for montage (more or less space between images)
2125
2124
framerate : float
2126
2125
Framerate of the movie (frames per second, default 25).
2126
+ interpolation : str
2127
+ Interpolation method (``scipy.interpolate.interp1d`` parameter,
2128
+ default 'quadratic').
2127
2129
codec : str
2128
2130
Codec to use (default 'mpeg4').
2129
2131
row : int
2130
- row index of the brain to use
2132
+ row index of the brain to use (default -1).
2131
2133
col : int
2132
- column index of the brain to use
2134
+ column index of the brain to use (default -1).
2133
2135
"""
2134
2136
if not has_ffmpeg ():
2135
2137
err = ("FFmpeg is needed for saving movies and was not found in "
@@ -2168,9 +2170,8 @@ def save_movie(self, fname, time_dilation=4., tmin=None, tmax=None,
2168
2170
tempdir = mkdtemp ()
2169
2171
frame_pattern = 'frame%%0%id.png' % (np .floor (np .log10 (n_times )) + 1 )
2170
2172
fname_pattern = os .path .join (tempdir , frame_pattern )
2171
- self .save_image_sequence (time_idx , fname_pattern , False , row ,
2172
- col , montage , orientation , border_size ,
2173
- colorbar , interpolation )
2173
+ self .save_image_sequence (time_idx , fname_pattern , False , row , col ,
2174
+ montage , border_size , colorbar , interpolation )
2174
2175
ffmpeg (fname , fname_pattern , framerate , codec )
2175
2176
2176
2177
def animate (self , views , n_steps = 180. , fname = None , use_cache = False ,
0 commit comments