Skip to content

Instantly share code, notes, and snippets.

@FrancescAlted
Created May 10, 2022 11:01
Show Gist options
  • Save FrancescAlted/3caab571d1bd143e6f1dad42f6a453fa to your computer and use it in GitHub Desktop.
Save FrancescAlted/3caab571d1bd143e6f1dad42f6a453fa to your computer and use it in GitHub Desktop.
# Examples on getting orthogonal slices
import iarray as ia
import numpy as np
dtype = np.float32
ia.set_config_defaults(dtype=dtype)
a = ia.full((10, 10), 3.14, chunks=(4, 6), blocks=(3, 3))
print(a.info)
a[5:10, 7:10] = np.ones(5 * 3, dtype=dtype)
a[1:3] = np.zeros(10 * 2, dtype=dtype)
a[6:9, 2:4] = -1.2
selection = [slice(2, 8), -6]
a.set_orthogonal_selection(selection, -0.01)
print(a.data)
b = a.get_orthogonal_selection(selection)
print(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment