1 """Output of time-dependent data"""
2
3 from BasicFile import BasicFile
4
6 """output of time dependent data"""
7
9 """
10 @param name: name of the file
11 @param titles: Titles of the columns
12 """
13 BasicFile.__init__(self,name)
14
15 self.setTitles(titles)
16
17
18
19
21 """
22 Sets the titles anew. Only has an effect if the file hasn't been opened yet
23
24 @param titles: The new titles
25 """
26 self.titles=titles
27
29 """
30 Write column titles if present
31 """
32 if len(self.titles)>0:
33 fh=self.getHandle()
34 fh.write("# time")
35 for c in self.titles:
36 fh.write(" \t"+c)
37 fh.write("\n")
38
39 - def write(self,time,data):
40 """write data set
41
42 @param time: the current time
43 @param data: tuple with data"""
44 self.writeLine( (time,)+data)
45