Skip to content
Snippets Groups Projects
Commit a626b376 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Chaged the post-processing mechanism

parent dc5c2528
No related branches found
No related tags found
2 merge requests!188Score normalizations,!180[dask] Preparing bob.bio.base for dask pipelines
Pipeline #40059 passed
...@@ -150,6 +150,11 @@ class CSVScoreWriter(ScoreWriter): ...@@ -150,6 +150,11 @@ class CSVScoreWriter(ScoreWriter):
return filenames return filenames
def post_process(self, score_paths, path): def post_process(self, score_paths, path):
"""
Removing the HEADER of all files
but the first
"""
def _post_process(score_paths, path): def _post_process(score_paths, path):
post_process_scores = [] post_process_scores = []
os.makedirs(path, exist_ok=True) os.makedirs(path, exist_ok=True)
...@@ -159,6 +164,14 @@ class CSVScoreWriter(ScoreWriter): ...@@ -159,6 +164,14 @@ class CSVScoreWriter(ScoreWriter):
if i==0: if i==0:
shutil.move(score, fname) shutil.move(score, fname)
continue continue
# Not memory intensive score writing
with open(score,'r') as f:
with open(fname,'w') as f1:
f.readline() # skip header line
for line in f:
f1.write(line)
open(fname, "w").writelines(open(score, "r").readlines()[1:]) open(fname, "w").writelines(open(score, "r").readlines()[1:])
os.remove(score) os.remove(score)
return post_process_scores return post_process_scores
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment