Numpy with PyLynx VVP

PyLynx VVP arrays inherit from Pandas (and consequently Numpy) dataframes, so you can use the same notation for modifying them.

Initializing a VVPArray object creates an 8x12 dataframe of all zeros:

    0    1    2    3    4    5    6    7    8    9    10   11
A  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
B  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
C  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
D  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
E  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
F  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
G  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
H  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

You can reference ranges in this dataframe with the .loc method:

array.loc['A':'C',] = 20.0
array.loc['F':'H', 1:4] = 100.0
print(array)
     0      1      2      3      4     5     6     7     8     9     10    11
A  20.0   20.0   20.0   20.0   20.0  20.0  20.0  20.0  20.0  20.0  20.0  20.0
B  20.0   20.0   20.0   20.0   20.0  20.0  20.0  20.0  20.0  20.0  20.0  20.0
C  20.0   20.0   20.0   20.0   20.0  20.0  20.0  20.0  20.0  20.0  20.0  20.0
D   0.0    0.0    0.0    0.0    0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
E   0.0    0.0    0.0    0.0    0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
F   0.0  100.0  100.0  100.0  100.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
G   0.0  100.0  100.0  100.0  100.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
H   0.0  100.0  100.0  100.0  100.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0

This can get passed to VVP commands as the array variable

lynx.aspirate_96_vvp(plate = plate, array = array)
4 Likes

gamechanger for hitlisting. That’s ridiculously easy.

2 Likes

Right! And you can take an existing pandas df and initialize on that as well. For example:

data = [[10*col] * 12 for col in range(8)]
df = pd.DataFrame(data)
array = VVPArray(df)
   0   1   2   3   4   5   6   7   8   9   10  11
A   0   0   0   0   0   0   0   0   0   0   0   0
B  10  10  10  10  10  10  10  10  10  10  10  10
C  20  20  20  20  20  20  20  20  20  20  20  20
D  30  30  30  30  30  30  30  30  30  30  30  30
E  40  40  40  40  40  40  40  40  40  40  40  40
F  50  50  50  50  50  50  50  50  50  50  50  50
G  60  60  60  60  60  60  60  60  60  60  60  60
H  70  70  70  70  70  70  70  70  70  70  70  70
1 Like