I might get an answer since I didn't call them arrays. :^)
Ok, I have 2 lists that I need to process individually, then merge
them into a 2x list and fill with data.
arinc429 = ['ab', '2b', '0b', '21', 'c1', '61', '11', 'db', '9b', '5b', 'eb',
'6b', '1b', '6e', '3e']
iPIDs = [300, 301, 320, 321]
merged[arinc429, iPIDs]
# PID & a429 are defined elsewhere
a_idx = iPIDs.index[PID]
p_idx = [arinc429.index[a429]
# shouldn't I be able to fill the lists simply by pointing to a location?
matrix[a_idx, p_idx] = 0x219 # and so on?
tia 1 1976
gonzlobo wrote:
I might get an answer since I didn't call them arrays. :^)
Ok, I have 2 lists that I need to process individually, then merge
them into a 2x list and fill with data.
arinc429 = ['ab', '2b', '0b', '21', 'c1', '61', '11', 'db', '9b', '5b',
'eb',
'6b', '1b', '6e', '3e']
iPIDs = [300, 301, 320, 321]
merged[arinc429, iPIDs]
# PID & a429 are defined elsewhere
a_idx = iPIDs.index[PID]
p_idx = [arinc429.index[a429]
# shouldn't I be able to fill the lists simply by pointing to a location?
matrix[a_idx, p_idx] = 0x219 # and so on?
The simplest approach is to go with a dictionary:
>>matrix = {} arinc = ['ab', '2b', '0b'] pids = [300, 321] for x in arinc:
.... for y in pids:
.... matrix[x, y] = y + int(x, 16) # replace with your actual data
....
>>matrix
{('ab', 300): 471, ('2b', 300): 343, ('ab', 321): 492, ('0b', 321): 332,
('2b', 321): 364, ('0b', 300): 311}
Get one entry:
>>matrix["2b", 321]
364
Get all items along an axis:
>>[matrix[x, 300] for x in arinc]
[471, 343, 311]
Peter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rodrigo Daunaravicius |
last post by:
Is there an elegant way to directly refer the 2nd dimension of a
multi-dimensional sequence (like the nth character in a list of strings).
An example would be deleting the newline in all the...
|
by: anthonyberet |
last post by:
Hello again - rather a newbie here...
I want to work on a sudoku brute-forcer, just for fun.
I am considering different strategies, but first I need to decide on the
data-structure to use for...
|
by: spam.noam |
last post by:
Hello,
I discovered that I needed a small change to the Python grammar. I
would like to hear what you think about it.
In two lines:
Currently, the expression "x" is a syntax error.
I suggest...
|
by: TG |
last post by:
Hi there !
I'm just starting to use Numeric here, and I'm wondering : how can I
efficiently initialize every values of a N-dimensional array, given I
don't know the number of dimensions ?
I'm...
|
by: acosgaya |
last post by:
Hi, I would like some help as how to approach the following problem:
I have a set of d-dimensional points (e.g (3,5,8,9,5) is a 5-dimensional point), and I need to sort the points on each of the...
|
by: bruce |
last post by:
hi...
basic question..
how do i define a multi dimensional array
a
is there a kind of a = array(10,10)
|
by: per9000 |
last post by:
Hi all,
I have a two-dimensional array of data, f.x int's. We can imagine that
the array is "really large". Now I want the data in it and store this
in a one-dimensional array.
The obvious...
|
by: Peter Olcott |
last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a
I think that the operator() member function does not work correctly, does
anyone else know how to make a template for making two...
|
by: agent-s |
last post by:
Basically I'm programming a board game and I have to use a list of
lists to represent the board (a list of 8 lists with 8 elements each).
I have to search the adjacent cells for existing pieces and...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |