I'm pretty new to Python, so I'm sorry if this one is quite easy. (it seems easy to me, but I'm struggling...)
I have a list of numbers kicked back from a Keithley SMU 2400 from an IV sweep I've done, and there resulting list is ordered like the following:
[v0, c0, t0, v1, c1, t1, v2, c2, t2, ...]
The list appears to be a list of numbers (not a list of ascii values thanks to PyVisa's query_ascii_values command).
How can I parse these into either columns of numbers (for output in csv or similar) or three separate lists for plotting in matplotlib.
The output I'd love would be similar to this in the end:
volts = [v0, v1, v2, v3...]
currents = [c0, c1, c2, c3...]
times = [t0, t1, t2, t3...]
that should enable easier plotting in matplotlib (or outputting into a csv text file).
Please note that my v0, v1 etc., are just my names for them, they are numbers currently.
I would have attempted this in Matlab similar to this:
volts = mydata(1:3:length(mydata));
(calling the index by counting every third item from 1)
Thanks for your thoughts and help! Also- are there any good resources for simple data munging like this that I should get a copy of?
Simply slicing works. Thus, with A as the input list, we would have -
volts, currents, times = A[::3], A[1::3], A[2::3]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With