savu.data.data_structures.preview module¶
-
class
Preview
(data_obj)[source] The Data class dynamically inherits from transport specific data class and holds the data array, along with associated information.
-
convert_indices
(idx, dim)[source] convert keywords to integers.
-
get_data_obj
()[source]
-
get_integer_entries
(plist)[source] Convert Savu preview syntax to python slicing (similar) syntax, by replacing Savu Built-in constants.
- Parameters
plist (list) – A Savu data preview list to reduce the data dimensions.
- Returns
A Savu preview list containing integers and no strings.
- Return type
list
-
get_starts_stops_steps
(key=None)[source] Returns preview parameter
starts
,stops
,steps
,chunks
lists.- Keyword Arguments
key (str) – the list to return.
- Returns
if key is none return separate preview_list components, where each list has length equal to number of dataset dimensions, else only the
key
list.- Return type
list(list(int))
-
set_preview
(preview_list, **kwargs)[source] Reduces the data to be processed to a subset of the original.
- Parameters
preview (list) – previewing parameters, where
len(preview_list)
equals the number of data dimensions.- Keyword Arguments
revert (bool) – revert input dataset to the original size after plugin processing.
Each
preview_list
element should be of the formstart:stop:step:chunk
, wherestop
,step
andchunk
are optional (defaults:stop
=start
+ 1,step
= 1,chunk
= 1) but must be given in that order.Note
- start:stop[:step]
represents the set of indices specified by:
>>> indices = range(start, stop[, step])
For more information see
range()
- start:stop:step:chunk (chunk > 1)
represents the set of indices specified by:
>>> a = np.tile(np.arange(start, stop, step), (chunk, 1)) >>> b = np.transpose(np.tile(np.arange(chunk)-chunk // 2, (a.shape[1], 1))) >>> indices = np.ravel(np.transpose(a + b))
Chunk indicates how many values to take around each value in
range(start, stop, step)
. It is only available for slicing dimensions.Warning
If any indices are out of range (or negative) then the list is invalid. When chunk > 1, new start and end values will be:
>>> new_start = start - int(chunk / 2) >>> new_end = range(start, stop, step)[-1] + (step - int(chunk / 2))
- accepted values:
Each entry is executed using
eval()
so simple formulas are allowed and may contain the following keywords::
is a simplification for 0:end:1:1 (all values)mid
is int(shape[dim] / 2)-1end
is shape[dim]
-