Commit 968c5456 authored by Jorn Baayen's avatar Jorn Baayen Committed by Tjerk Vreeken

CSVMixin: Output CSV files with time stamps from times() method

The data interpolation assumes that self.times() dictates the time stamps
for the output data. The time stamps in the CSV output file, however, were
taken from the input CSV file and not from the times() method. This
implicitly assumed that self.times() equates the time steps from the CSV
input file. This is not always the case, as self.times() may be overridden
by a subclass.
parent a1a3e66f
......@@ -324,8 +324,8 @@ class CSVMixin(OptimizationProblem):
names = ['time'] + sorted({ for sym in self.output_variables})
formats = ['O'] + (len(names) - 1) * ['f8']
dtype = {'names': names, 'formats': formats}
data = np.zeros(len(self.__timeseries_times), dtype=dtype)
data['time'] = self.__timeseries_times
data = np.zeros(len(times), dtype=dtype)
data['time'] = [self.__timeseries_times[0] + timedelta(seconds=s) for s in times]
for output_variable in self.output_variables:
output_variable =
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment