I have a standard list of numpy arrays because each item doesn't have an equal amount of dimensions, I convert it to uint8 (huge amounts of hex values), then perform operations to normalise the dimensions of each numpy array, so I can then convert it from a list to multi dimension numpy array.
To achieve this I need to use a few methods to make the code readable, but when I pass one numpy array from the list into a method I also have to pass the entire list and the iterator:
def push_bytes(messages, message, start_byte, i):
messages[i] = np.insert(messages[1], start_byte, 0, 0)
I call this method many times so would like to not have to pass the entire list and iterator so I can do something like this:
def push_bytes(message, start_byte):
message = np.insert(message, start_byte, 0, 0)
I believe the reason this doesn't work is because message =
is creating a new numpy array and not pointing to the original one, is there a way I can point to the original one without having to pass the entire list and an iterator?
Sample data:
messages = [
[ 5 1 0 0 0 47 69 222 10 221 242 132 0 0 0 79 0 0 ]
[ 5 1 0 0 0 27 68 222 10 86 7 133 95 126 220 38 0 ]
[ 5 1 0 0 45 48 0 0 7 10 86 7 133 95 126 220 30 0 0 0 79 0 0 ]
[ 5 1 0 0 0 47 69 222 10 129 10 133 95 126 220 5 0 0 0 75 0 0 ]
[ 5 1 0 0 17 39 0 0 112 66 222 10 129 10 133 ]
[ 5 1 0 0 7 69 222 10 138 0 0 55 0 0 0 79 0 0 ]
[ 5 222 10 138 10 133 95 126 0 0 24 0 0 0 79 0 0 ]
[ 17 39 0 0 232 66 222 10 138 10 133 0 0 0 0 0 93 0 0 ]
]