sorry, ich bin erst am Anfang und ich verstehe wirklich nicht, was in diesem Plot ist los:Valueerror: kann nicht Zeichenfolge konvertieren zu schweben: Spannung 1
#!/usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.dates as mdates
File = open('file.txt', 'r')
readFile = File.read()
data = []
split_data = readFile.split('\n')
for line in split_data:
split_line = line.split('\t')
if len(split_line) == 4:
if '[V]' not in line:
data.append(line)
voltage, current, abscurrent, time = np.loadtxt(data, delimiter='\t', unpack=True)
plt.plot(voltage, current)
Die datei.txt wie folgt aussieht:
Starttime: 28.11.2016, 12:01:11
Iterations SMU1: 1
Configuration: from -2.0V to 2.0V in 0.100V-steps, hold: 0.1s, stop: 0.0s, repeated: 1x
Voltage 1 Current 1 absCurrent 1 Time
[V] [A] [A] [s]
-1.99993e+00 -5.35746e-07 5.35746e-07 4.802936e+02
-1.89992e+00 -4.82880e-07 4.82880e-07 4.805996e+02
-1.79997e+00 -4.34462e-07 4.34462e-07 4.809054e+02
-1.69994e+00 -3.89697e-07 3.89697e-07 4.812115e+02
-1.59992e+00 -3.48121e-07 3.48121e-07 4.815175e+02
-1.50000e+00 -3.10000e-07 3.10000e-07 4.818237e+02
Dann habe ich immer diese Fehlermeldung erhalten:
ValueError: could not convert string to float: Voltage 1
Wenn ich diese Zeile löschen, wird der graph normaly aufgetragen ... Thanks :)
Nein, es gibt nur 3. Ich habe bereits versucht, eine andere Einschränkung [und ‚Voltage‘:] hinzuzufügen , um die Leitung zu beseitigen, aber das Problem bleibt –