Reorganise .dat files to lines
This commit is contained in:
parent
a71146a6bd
commit
7167d75313
1 changed files with 2 additions and 5 deletions
|
@ -13,11 +13,8 @@ class ReadSwash:
|
|||
|
||||
@classmethod
|
||||
def read_nohead(cls, path):
|
||||
with tempfile.TemporaryFile() as tmpfile:
|
||||
with open(path) as file:
|
||||
subprocess.run(("tr", "-d", "\n"), stdin=file, stdout=tmpfile)
|
||||
tmpfile.seek(0)
|
||||
return np.loadtxt(tmpfile)
|
||||
subprocess.run(("sed", "-i", "s/ /\n/g", path))
|
||||
return np.loadtxt(path)
|
||||
|
||||
def read_time(self, path):
|
||||
self._t = np.unique(self.read_nohead(path))
|
||||
|
|
Loading…
Reference in a new issue