Core Module#

The Core package implements general Python functions required by the thermoengine package. Typically, these are focused on interfacing with Objective-C vectors, arrays, matrices, etc.

class thermoengine_utils.core.UnorderedList(initlist=None)#

Methods

append(item)

S.append(value) -- append value to the end of the sequence

clear()

count(value)

extend(other)

S.extend(iterable) -- extend sequence by appending elements from the iterable

index(value, [start, [stop]])

Raises ValueError if the value is not present.

insert(i, item)

S.insert(index, value) -- insert value before index

pop([index])

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

remove(item)

S.remove(value) -- remove first occurrence of value.

reverse()

S.reverse() -- reverse IN PLACE

copy

sort

thermoengine_utils.core.fill_array(var1, var2)#

Equilizes the dimension (shape) of two arrays or an array/scalar pair.

This function is not normally called outside the equilibratepy module.

On input var1 and var2 are either scalar/array pairs or arrays of the same shape. On output, the function returns a tuple with both arrays of the same shape. A scalar is extended with contant entries if that action is required to match the dimension of a scalar/array pair. Two scalars are converted to two single dimension numpy arrays of length one.

Uses the numpy.full_like function.

Parameters:
var1scalar or array

If var1 is an array, var2 must be either a scalar or an array of the same shape.

var2scalar or array

If var2 is an array, var1 must be either a scalar or an array of the same shape.

Returns:
resulttuple, (numpy array, numpy array)

var1 and var2 converted to numpy arrays

Examples

>>> t = [500.0, 600.0]
>>> p = 1000.0
>>> t_a, p_a = fill_array(t, p)
>>> print (t_a)
[500.0, 600.0]
>>> print (p_a)
[1000.0, 1000.0]