Changeset 2820 for trunk/python
- Timestamp:
- 07/02/13 13:11:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r2818 r2820 2067 2067 2068 2068 @asaplog_post_dec 2069 def history(self, filename=None ):2069 def history(self, filename=None, nrows=-1, start=0): 2070 2070 """\ 2071 2071 Print the history. Optionally to a file. … … 2076 2076 2077 2077 """ 2078 hist = list(self._gethistory()) 2078 n = self._historylength() 2079 if nrows == -1: 2080 nrows = n 2081 if start+nrows > n: 2082 nrows = nrows-start 2083 if n > 1000 and nrows == n: 2084 nrows = 1000 2085 start = n-1000 2086 asaplog.push("Warning: History has {0} entries. Displaying last " 2087 "1000".format(n)) 2088 hist = list(self._gethistory(nrows, start)) 2079 2089 out = "-"*80 2080 2090 for h in hist: 2081 if h.startswith("---"): 2082 out = "\n".join([out, h]) 2091 if not h.strip(): 2092 continue 2093 if h.find("---") >-1: 2094 continue 2083 2095 else: 2084 2096 items = h.split("##") … … 2093 2105 s = i.split("=") 2094 2106 out += "\n %s = %s" % (s[0], s[1]) 2095 out = "\n".join([out, " -"*80])2107 out = "\n".join([out, "*"*80]) 2096 2108 if filename is not None: 2097 2109 if filename is "": 2098 2110 filename = 'scantable_history.txt' 2099 import os2100 2111 filename = os.path.expandvars(os.path.expanduser(filename)) 2101 2112 if not os.path.isdir(filename):
Note:
See TracChangeset
for help on using the changeset viewer.