Post · 6 min read· pp. 849–852

aerosandbox.numpy.array

Functions

array(array_like[, dtype])Initializes a new array. Creates a NumPy array if possible; if not, creates a CasADi array.
concatenate(arrays[, axis])Join a sequence of arrays along an existing axis. Returns a NumPy array if possible; if not, returns a CasADi array.
stack(arrays[, axis])Join a sequence of arrays along a new axis. Returns a NumPy array if possible; if not, returns a CasADi array.
hstack(arrays)
vstack(arrays)
dstack(arrays)
length(array)Returns the length of an 1D-array-like object. An extension of len() with slightly different functionality.
diag(v[, k])Extract a diagonal or construct a diagonal array.
roll(a, shift[, axis])Roll array elements along a given axis.
max(a[, axis])Return the maximum of an array or maximum along an axis.
min(a[, axis])Return the minimum of an array or minimum along an axis.
reshape(a, newshape[, order])Gives a new shape to an array without changing its data.
ravel(a[, order])Returns a contiguous flattened array.
tile(A, reps)Construct an array by repeating A the number of times given by reps.
zeros_like(a[, dtype, order, subok, shape])Return an array of zeros with the same shape and type as a given array.
ones_like(a[, dtype, order, subok, shape])Return an array of ones with the same shape and type as a given array.
empty_like(prototype[, dtype, order, subok, shape])Return a new array with the same shape and type as a given array.
full_like(a, fill_value[, dtype, order, subok, shape])Return a full array with the same shape and type as a given array.
assert_equal_shape(arrays)Assert that all of the given arrays are the same shape. If this is not true, raise a ValueError.

Module Contents

aerosandbox.numpy.array.array(array_like, dtype=None) : Initializes a new array. Creates a NumPy array if possible; if not, creates a CasADi array.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.array.html>

aerosandbox.numpy.array.concatenate(arrays, axis=0) : Join a sequence of arrays along an existing axis. Returns a NumPy array if possible; if not, returns a CasADi array.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.concatenate.html>

Parameters:
:   - **arrays** (*Sequence*) –
    - **axis** (*int*) –

aerosandbox.numpy.array.stack(arrays, axis=0) : Join a sequence of arrays along a new axis. Returns a NumPy array if possible; if not, returns a CasADi array.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.stack.html>

Parameters:
:   - **arrays** (*Sequence*) –
    - **axis** (*int*) –

aerosandbox.numpy.array.hstack(arrays)

aerosandbox.numpy.array.vstack(arrays)

aerosandbox.numpy.array.dstack(arrays)

aerosandbox.numpy.array.length(array) : Returns the length of an 1D-array-like object. An extension of len() with slightly different functionality. :param array:

code
Returns:

Return type:
:   int

aerosandbox.numpy.array.diag(v, k=0) : Extract a diagonal or construct a diagonal array.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.diag.html>

aerosandbox.numpy.array.roll(a, shift, axis=None) : Roll array elements along a given axis.

code
Elements that roll beyond the last position are re-introduced at the first.

See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.roll.html>

Parameters:
:   - **a** (*array\_like*) – Input array.
    - **shift** (*int* *or* *tuple* *of* *ints*) – The number of places by which elements are shifted. If a tuple, then axis must be a tuple of the same size,
      and each of the given axes is shifted by the corresponding number. If an int while axis is a tuple of ints,
      then the same value is used for all given axes.
    - **axis** (*int* *or* *tuple* *of* *ints**,* *optional*) – Axis or axes along which elements are shifted. By default, the array is flattened before shifting,
      after which the original shape is restored.

Returns:
:   **res** – Output array, with the same shape as a.

Return type:
:   ndarray

aerosandbox.numpy.array.max(a, axis=None) : Return the maximum of an array or maximum along an axis.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.max.html>

aerosandbox.numpy.array.min(a, axis=None) : Return the minimum of an array or minimum along an axis.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.min.html>

aerosandbox.numpy.array.reshape(a, newshape, order='C') : Gives a new shape to an array without changing its data.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.reshape.html>

aerosandbox.numpy.array.ravel(a, order='C') : Returns a contiguous flattened array.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.ravel.html>

aerosandbox.numpy.array.tile(A, reps) : Construct an array by repeating A the number of times given by reps.

code
See syntax here: <https://numpy.org/doc/stable/reference/generated/numpy.tile.html>

aerosandbox.numpy.array.zeros_like(a, dtype=None, order='K', subok=True, shape=None) : Return an array of zeros with the same shape and type as a given array.

aerosandbox.numpy.array.ones_like(a, dtype=None, order='K', subok=True, shape=None) : Return an array of ones with the same shape and type as a given array.

aerosandbox.numpy.array.empty_like(prototype, dtype=None, order='K', subok=True, shape=None) : Return a new array with the same shape and type as a given array.

aerosandbox.numpy.array.full_like(a, fill_value, dtype=None, order='K', subok=True, shape=None) : Return a full array with the same shape and type as a given array.

aerosandbox.numpy.array.assert_equal_shape(arrays) : Assert that all of the given arrays are the same shape. If this is not true, raise a ValueError.

code
Args: arrays: The arrays to be evaluated.

> Can be provided as a:
>
> > - List, in which case a generic ValueError is thrown
> > - Dictionary consisting of name:array pairs for key:value, in which case the names are given in the ValueError.

Returns: None. Throws an error if leng

Parameters:
:   **arrays** (*Union**[**List**[**numpy.ndarray**]**,* *Dict**[**str**,* *numpy.ndarray**]**]*) –

Return type:
:   None