io
InputInterface
Bases: Protocol
Common stack interface for input and output.
Such objects must export NumPy-like dtype, shape and ndim
attributes.
Source code in src/spurt/io/_interface.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |
dtype
property
numpy.dtype : Data-type of the array's elements.
ndim
property
int : Number of array dimension.
shape
property
tuple of int : Tuple of array dimensions.
__getitem__(key)
Read a block of data.
Source code in src/spurt/io/_interface.py
39 40 | |
InputStackInterface
Bases: StackInterface, Protocol
An array-like interface for reading input datasets.
InputStackInterface defines the abstract interface that types must
conform to in order to be valid inputs to `spurt.unwrap() function.
Source code in src/spurt/io/_interface.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
get_spatial_slice(key)
Read a block of data in space.
Source code in src/spurt/io/_interface.py
115 116 | |
get_time_slice(key)
Read a block of data in time.
Source code in src/spurt/io/_interface.py
112 113 | |
Irreg3DInput
Bases: InputStackInterface
A single 2D array as input.
One axis represents time and the other some flattened representation
in space. time_dim is an optional input to indicate time axis.
Source code in src/spurt/io/_three_d.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
xcoords
property
Return the x-coordinate of the points as an array.
ycoords
property
Return the y-coordinate of the points as an array.
__init__(data, xy, time_dim=0)
Initialize a stack interface for a 2D numpy array.
One axis represents time axis and the other spatial axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
InputInterface
|
2D array as input |
required |
xy
|
InputInterface
|
N x 2 array of indices or coordinates of each pixel in space, where N is the number of spatial points. |
required |
time_dim
|
int
|
Axis of the array that represents the time dimension |
0
|
Source code in src/spurt/io/_three_d.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
get_spatial_slice(key)
Read a block of data in space.
Only makes a copy if absolutely needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
int
|
Index on the space axis |
required |
Source code in src/spurt/io/_three_d.py
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
get_time_slice(key)
Read a block of data in time.
Only makes a copy if absolutely needed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
int
|
Index on the time axis |
required |
Source code in src/spurt/io/_three_d.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
OutputInterface
Bases: Protocol
An array-like interface for writing output datasets.
OutputInterface must export NumPy-like dtype, shape, and ndim
attributes and must support NumPy-style slice-based indexing.
Source code in src/spurt/io/_interface.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
dtype
property
numpy.dtype : Data-type of the array's elements.
ndim
property
int : Number of array dimensions.
shape
property
tuple of int : Tuple of array dimensions.
__setitem__(key, value)
Write a block of data.
Source code in src/spurt/io/_interface.py
64 65 | |
OutputStackInterface
Bases: StackInterface, Protocol
An array-like interface for writing output datasets.
OutputStackInterface defines the abstract interface that types must
conform to in order to be valid outputs of the `spurt.unwrap() function.
Source code in src/spurt/io/_interface.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
set_spatial_slice(key, array)
Write a block of data in space.
Source code in src/spurt/io/_interface.py
131 132 | |
set_time_slice(key, array)
Write a block of data in time.
Source code in src/spurt/io/_interface.py
128 129 | |
Reg3DInput
Bases: InputStackInterface
A single 3D array as input.
A 2D image will just be a 3D array with size of time axis set to 1. This is
largely a helper class to assist in development. time_dim is an optional
input to indicate time axis.
Source code in src/spurt/io/_three_d.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
space_dim
property
We flatten spatial dimensions.
time_dim
property
We flatten spatial dimensions.
xcoords
property
Return the x-coordinate of the points as an array.
This is to mimic an irregular grid.
ycoords
property
Return the y-coordinate of the points as an array.
This is to mimic an irregular grid.
__init__(data, time_dim=0)
Initialize a stack interface for a numpy array.
Representing 3D data in a cube - regularly spaced in spatial dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
InputInterface
|
3D array as input |
required |
time_dim
|
int
|
Axis of the array that represents the time dimension |
0
|
Source code in src/spurt/io/_three_d.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
get_spatial_slice(key)
Read a block of data in space.
Only makes a copy if absolutely needed.
Source code in src/spurt/io/_three_d.py
128 129 130 131 132 133 134 135 136 137 138 | |
get_time_slice(key)
Read a block of data in time.
Only makes a copy if absolutely needed.
Source code in src/spurt/io/_three_d.py
117 118 119 120 121 122 123 124 125 126 | |