MCPcopy Create free account
hub / github.com/dask/dask / Array

Class Array

dask/array/core.py:1295–3025  ·  view source on GitHub ↗

Parallel Dask Array A parallel nd-array comprised of many numpy arrays arranged in a grid. This constructor is for advanced uses only. For normal use see the :func:`dask.array.from_array` function. Parameters ---------- dask : dict Task dependency graph name :

Source from the content-addressed store, hash-verified

1293
1294
1295class Array(DaskMethodsMixin):
1296 """Parallel Dask Array
1297
1298 A parallel nd-array comprised of many numpy arrays arranged in a grid.
1299
1300 This constructor is for advanced uses only. For normal use see the
1301 :func:`dask.array.from_array` function.
1302
1303 Parameters
1304 ----------
1305 dask : dict
1306 Task dependency graph
1307 name : string
1308 Name of array in dask
1309 chunks: iterable of tuples
1310 block sizes along each dimension
1311 dtype : str or dtype
1312 Typecode or data-type for the new Dask Array
1313 meta : empty ndarray
1314 empty ndarray created with same NumPy backend, ndim and dtype as the
1315 Dask Array being created (overrides dtype)
1316 shape : tuple of ints
1317 Shape of the entire array
1318
1319 See Also
1320 --------
1321 dask.array.from_array
1322 """
1323
1324 __slots__ = "dask", "__name", "_cached_keys", "__chunks", "_meta", "__dict__"
1325
1326 def __new__(cls, dask, name, chunks, dtype=None, meta=None, shape=None):
1327 self = super().__new__(cls)
1328 assert isinstance(dask, Mapping)
1329 if not isinstance(dask, HighLevelGraph):
1330 dask = HighLevelGraph.from_collections(name, dask, dependencies=())
1331 self.dask = dask
1332 self._name = str(name)
1333 meta = meta_from_array(meta, dtype=dtype)
1334
1335 if (
1336 isinstance(chunks, str)
1337 or isinstance(chunks, tuple)
1338 and chunks
1339 and any(isinstance(c, str) for c in chunks)
1340 ):
1341 dt = meta.dtype
1342 else:
1343 dt = None
1344 self._chunks = normalize_chunks(chunks, shape, dtype=dt)
1345 if self.chunks is None:
1346 raise ValueError(CHUNKS_NONE_ERROR_MESSAGE)
1347 self._meta = meta_from_array(meta, ndim=self.ndim, dtype=dtype)
1348
1349 for plugin in config.get("array_plugins", ()):
1350 result = plugin(self)
1351 if result is not None:
1352 self = result

Callers 15

tsqrFunction · 0.90
sfqrFunction · 0.90
luFunction · 0.90
solve_triangularFunction · 0.90
_choleskyFunction · 0.90
lstsqFunction · 0.90
partial_reduceFunction · 0.90
apply_gufuncFunction · 0.90
concatenate_array_chunksFunction · 0.90
imreadFunction · 0.90

Calls 1

globalmethodFunction · 0.90

Tested by 9

test_ArrayFunction · 0.72
test_uneven_chunksFunction · 0.72
test_keysFunction · 0.72
test_Array_computationFunction · 0.72
test_stackFunction · 0.72
test_concatenateFunction · 0.72
test_raise_on_no_chunksFunction · 0.72
test_no_chunksFunction · 0.72