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

Class Array

dask/array/core.py:1302–3036  ·  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

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