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