class Array(sieve.File)

Overview

sieve.Array is a utility class that helps with dealing with numpy.ndarray. sieve.Array is backed by sieve.File, so it has the same network overhead benefits, with some added properties and constructor to help work with arrays.

Example

import sieve
import numpy as np

# initialize a new sieve array
array = sieve.Array(array=np.arange(6).reshape(3,2))

print(array.path)   # /example/path.npy
print(array.array)  # array([[0, 1], [2, 3], [4, 5]])
print(array.height) # 3
print(array.width)  # 2

Constructor Arguments

  • array (numpy.ndarray): The array to be initialized
import sieve
import numpy as np

# initialize a new sieve array
array = sieve.Array(array=np.arange(5))
  • path (str): The local path of a npy file to load
  • url (str): The external url of a npy file to load

For examples of path and url constructor arguments, see sieve.File

Properties

path

@property
path(self) -> str

The path to the array on disk, as a .npy file (see sieve.File).

array

@property
array(self) -> numpy.ndarray

The array as a numpy.ndarray.

height

@property
height(self) -> int

The height of the array.

width

@property
width(self) -> int

The width of the array.