import dascore as dc
from dascore.utils.downloader import fetch
spool = dc.spool(fetch("example_dasdae_event_1.h5"))
lazy = spool.set_backend("lazy")
patch = lazy[0]
assert patch.backend == "lazy"
# Operations wait until the data are asked for.
out = patch.abs().load()
assert out.equals(spool[0].abs())set_backend
set_backend(
self ,
backend: str ,
)-> ‘Self’
Return a spool whose patches are handed out on another array backend.
Nothing is read or converted here. Each patch the new spool hands out, by indexing or iterating, is on the backend. load reads every patch into memory, on the library a lazy backend computes on.
Parameters
| Parameter | Description |
|---|---|
| backend |
The backend each patch is handed out on, named asPatch.set_backend names it.
|
Raises
ParameterError If the name is no backend, or the array library cannot be imported.
Examples
Note
Lazy operations says what a lazy backend reads and when, what cannot be lazy, and how the numpy_fallback setting decides that.