ComputableList#

class abtem.array.ComputableList(iterable=(), /)[source]#

Bases: list

A list with methods for conveniently computing its items.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

append(object, /)

Append object to the end of the list.

clear()

Remove all items from list.

compute(**kwargs)

Turn a list of lazy ArrayObjects object into the in-memory equivalents.

copy()

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

index(value[, start, stop])

Return first index of value.

insert(index, object, /)

Insert object before index.

pop([index])

Remove and return item at index (default last).

remove(value, /)

Remove first occurrence of value.

reverse()

Reverse IN PLACE.

sort(*[, key, reverse])

Sort the list in ascending order and return None.

to_zarr(url[, compute, overwrite, progress_bar])

Write data to a zarr file.

append(object, /)#

Append object to the end of the list.

clear()#

Remove all items from list.

compute(**kwargs)[source]#

Turn a list of lazy ArrayObjects object into the in-memory equivalents.

Return type:

list[ArrayObject] | tuple[list[ArrayObject], tuple]

kwargs :

Keyword arguments passed to ArrayObject.compute.

copy()#

Return a shallow copy of the list.

count(value, /)#

Return number of occurrences of value.

extend(iterable, /)#

Extend list by appending elements from the iterable.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

insert(index, object, /)#

Insert object before index.

pop(index=-1, /)#

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

remove(value, /)#

Remove first occurrence of value.

Raises ValueError if the value is not present.

reverse()#

Reverse IN PLACE.

sort(*, key=None, reverse=False)#

Sort the list in ascending order and return None.

The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).

If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.

The reverse flag can be set to sort in descending order.

to_zarr(url, compute=True, overwrite=False, progress_bar=None, **kwargs)[source]#

Write data to a zarr file.

Parameters:
  • url (str) – Location of the data, typically a path to a local file. A URL can also include a protocol specifier like s3:// for remote data.

  • compute (bool) – If true compute immediately; return dask.delayed.Delayed otherwise.

  • overwrite (bool) – If given array already exists, overwrite=False will cause an error, where overwrite=True will replace the existing data.

  • progress_bar (bool) – Display a progress bar in the terminal or notebook during computation. The progress bar is only displayed with a local scheduler.

  • kwargs – Keyword arguments passed to dask.array.to_zarr.