aim2dat.fct.discretization

Module to create grids to discretize a function.

Module Contents

Classes

DiscretizedAxis

Class to create an axis to discretize a 1d function i.e. a 2d plot

DiscretizedGrid

Class to create a grid to discretize a 1d function i.e. a 2d plot.

Functions

limit_array(→ numpy.array)

Limit an array to a given minimum and maximum value.

class aim2dat.fct.discretization.DiscretizedAxis(axis_type, **kwargs)[source]

Class to create an axis to discretize a 1d function i.e. a 2d plot in a grid. Different methods for the discretization are available.

Overview

Properties

T

x –> y or y –> x.

axis

Axis array. Contains the discrete values.

axis_type

Specify whether this axis should be used as x or y axis in a grid.

discretization_method

Discretize the specified range.

is_empty

Check whether the axis is empty.

shape

Tuple specifying the dimensions of the axis (like numpy).

Methods

discretize_axis(**kwargs)

Perform the discretization of the specified range.

transpose()

Change the axis_type: x –> y or y –> x.

property T : DiscretizedAxis

x –> y or y –> x.

Returns:

DiscretizedAxis – Transposed axis.

Type:

Change the axis_type

property axis : numpy.array

Axis array. Contains the discrete values.

Returns:

np.array – The discretized range.

property axis_type : str

Specify whether this axis should be used as x or y axis in a grid.

Returns:

str – indicating whether this axis should be used as x or y axis in case of a merge into a grid.

Raises:

ValueError – The axis_type attribute needs to be specified

property discretization_method : collections.abc.Callable

Discretize the specified range. Can be chosen via a string, accepting the methods specified in _available_discretization_methods or by passing a callable function.

Returns:

Callable – Method to discretize the axis.

property is_empty : bool

Check whether the axis is empty.

Returns:

bool – Whether the axis is empty.

property shape : tuple

Tuple specifying the dimensions of the axis (like numpy).

Returns:

tuple – The shape of the axis.

discretize_axis(**kwargs) DiscretizedAxis[source]

Perform the discretization of the specified range.

Returns:

DiscretizedAxis

transpose() DiscretizedAxis[source]

Change the axis_type: x –> y or y –> x.

Returns:

DiscretizedAxis – Transposed axis.

class aim2dat.fct.discretization.DiscretizedGrid(**kwargs)[source]

Class to create a grid to discretize a 1d function i.e. a 2d plot.

Use the plot_grid method to visualize the created grid.

Overview

Properties

grid

Return the internal grid as a list of lists.

is_empty

Check whether the axis is empty.

Methods

create_grid()

Create the internal grid which is based on a list of lists.

plot_grid()

Plot the grid.

property grid : list

Return the internal grid as a list of lists.

Returns:

type – list: List of lists representing the x-values and discretized y-values.

property is_empty : bool

Check whether the axis is empty.

Returns:

bool – Whether the axis is empty.

create_grid() DiscretizedGrid[source]

Create the internal grid which is based on a list of lists. Each list contains the energy-value (x) as the first argument and the DOS-values (y) as a list in the second argument.

Returns:

DiscretizedGrid – Discretized grid.

plot_grid()[source]

Plot the grid.

aim2dat.fct.discretization.limit_array(input_array: numpy.array, min_value: float | int, max_value: float | int) numpy.array[source]

Limit an array to a given minimum and maximum value.

In case the range is not covered, the corresponding values are added at the first or last index.

Parameters:
  • input_list (np.array) – array that should be limited

  • min_value (int) – minimum value

  • max_value (int) – max_value

Returns:

np.array – limited array