utils
module¶
This module contains some utility programs used by the package.
change_indices(nests)
¶
subtracts 1 from the indices within the nest structure
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nests |
NestsList
|
the nest structure |
required |
Returns:
Type | Description |
---|---|
NestsList
|
a similar list |
Source code in cupid_matching/utils.py
55 56 57 58 59 60 61 62 63 64 |
|
find_nest_of(nests, y)
¶
find the index of the nest that contains y, or return -1
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nests |
NestsList
|
a nest structure |
required |
y |
int
|
the type we are looking for |
required |
Returns:
Type | Description |
---|---|
int
|
the nest of y, or -1 if not found |
Source code in cupid_matching/utils.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
make_XY_K_mat(xyk_array)
¶
Reshapes an (X,Y,K) array to an (XY,K) matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xyk_array |
np.ndarray
|
an (X, Y, K) array of bases |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
the same, (XY, K)-reshaped |
Source code in cupid_matching/utils.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
reshape4_to2(array4)
¶
Reshapes an array (X,Y,Z,T) to a matrix (XY,ZT).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
array4 |
np.ndarray
|
an (X, Y, Z, T) array |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
the same, (XY, ZT)-reshaped |
Source code in cupid_matching/utils.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|