Skip to content

Commit 112aa87

Browse files
API Brain.save_movie():
- parameter order - rm `orientation` - `interpolation` default -> ‘quadratic’ - `montage` DOC
1 parent 8f354b4 commit 112aa87

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

surfer/viz.py

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ def scale_data_colormap(self, fmin, fmid, fmax, transparent, verbose=None):
15431543
data["transparent"] = transparent
15441544
self._toggle_render(True, views)
15451545

1546-
def set_data_time_index(self, time_idx, interpolation='linear'):
1546+
def set_data_time_index(self, time_idx, interpolation='quadratic'):
15471547
"""Set the data time index to show
15481548
15491549
Parameters
@@ -1552,7 +1552,7 @@ def set_data_time_index(self, time_idx, interpolation='linear'):
15521552
Time index. Floats will cause samples to be interpolated.
15531553
interpolation : str
15541554
Interpolation method (``scipy.interpolate.interp1d`` parameter,
1555-
default 'linear').
1555+
default 'quadratic').
15561556
"""
15571557
if self.n_times is None:
15581558
raise RuntimeError('cannot set time index with no time data')
@@ -1946,9 +1946,8 @@ def save_imageset(self, prefix, views, filetype='png', colorbar='auto',
19461946
return images_written
19471947

19481948
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'):
19521951
"""Save a temporal image sequence
19531952
19541953
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,
19711970
montage: 'current' | 'single' | list
19721971
Views to include in the images: 'current' uses the currently
19731972
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.
19791977
border_size: int
19801978
Size of image border (more or less space between images).
19811979
colorbar: 'auto' | int | list of int | None
@@ -1984,7 +1982,7 @@ def save_image_sequence(self, time_idx, fname_pattern, use_abs_idx=True,
19841982
views. For ``None``, no colorbar is shown.
19851983
interpolation : str
19861984
Interpolation method (``scipy.interpolate.interp1d`` parameter,
1987-
default 'linear').
1985+
default 'quadratic').
19881986
19891987
Returns
19901988
-------
@@ -2002,8 +2000,8 @@ def save_image_sequence(self, time_idx, fname_pattern, use_abs_idx=True,
20022000
elif montage == 'current':
20032001
self.save_image(fname)
20042002
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)
20072005
images_written.append(fname)
20082006
rel_pos += 1
20092007

@@ -2088,11 +2086,16 @@ def save_montage(self, filename, order=['lat', 'ven', 'med'],
20882086
return out
20892087

20902088
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):
20942092
"""Save a movie (for data with a time axis)
20952093
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+
20962099
Parameters
20972100
----------
20982101
fname : str
@@ -2105,31 +2108,30 @@ def save_movie(self, fname, time_dilation=4., tmin=None, tmax=None,
21052108
First time point to include (default: all data).
21062109
tmax : float
21072110
Last time point to include (default: all data).
2108-
interpolation : str
2109-
Interpolation method (``scipy.interpolate.interp1d`` parameter,
2110-
default 'linear').
21112111
montage: 'current' | 'single' | list
21122112
Views to include in the images: 'current' (default) uses the
21132113
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.
21212118
colorbar: 'auto' | int | list of int | None
21222119
For 'auto', the colorbar is shown in the middle view (default).
21232120
For int or list of int, the colorbar is shown in the specified
21242121
views. For ``None``, no colorbar is shown.
2122+
border_size: int
2123+
Size of image border for montage (more or less space between images)
21252124
framerate : float
21262125
Framerate of the movie (frames per second, default 25).
2126+
interpolation : str
2127+
Interpolation method (``scipy.interpolate.interp1d`` parameter,
2128+
default 'quadratic').
21272129
codec : str
21282130
Codec to use (default 'mpeg4').
21292131
row : int
2130-
row index of the brain to use
2132+
row index of the brain to use (default -1).
21312133
col : int
2132-
column index of the brain to use
2134+
column index of the brain to use (default -1).
21332135
"""
21342136
if not has_ffmpeg():
21352137
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,
21682170
tempdir = mkdtemp()
21692171
frame_pattern = 'frame%%0%id.png' % (np.floor(np.log10(n_times)) + 1)
21702172
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)
21742175
ffmpeg(fname, fname_pattern, framerate, codec)
21752176

21762177
def animate(self, views, n_steps=180., fname=None, use_cache=False,

0 commit comments

Comments
 (0)