]> AND Private Git Repository - myo-class.git/blobdiff - tosampledir.py
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
stable, day after meeting
[myo-class.git] / tosampledir.py
index 1846c1d10a7f5764450d425288f18162fabb12a5..98d9aa5815a7f483fa5e370b68dcdb7a660cced9 100644 (file)
@@ -3,9 +3,9 @@ from os.path import join, splitext
 from shutil import move as mv, copyfile as cp
 import pathlib
 
 from shutil import move as mv, copyfile as cp
 import pathlib
 
-def move(indir, outdir, n, distinction_word='', copy=True):# move n ordered files from indir to outdir
+def move(indir, outdir, start=None, end=None, distinction_word='', copy=True):# move start ordered files from indir to outdir
        l = sorted(ls(indir))
        l = sorted(ls(indir))
-       for filename in l[:n]:
+       for filename in l[start:end]:
                # print(join(indir, filename), join(outdir, filename))
                pathlib.Path(outdir).mkdir(parents=True, exist_ok=True)
                fname, fextension = splitext(filename)
                # print(join(indir, filename), join(outdir, filename))
                pathlib.Path(outdir).mkdir(parents=True, exist_ok=True)
                fname, fextension = splitext(filename)
@@ -14,7 +14,10 @@ def move(indir, outdir, n, distinction_word='', copy=True):# move n ordered file
 
 if __name__ == '__main__':
        
 
 if __name__ == '__main__':
        
-       move('./generated/90/infarctus/crop-nomask', './sample/train/infarctus', 400, distinction_word="-crop-nomask") # move 400 ordered files from param 1 to param 2
-       move('./generated/90/noinfarctus/crop-nomask', './sample/train/noinfarctus', 400, distinction_word="-crop-nomask")
-       move('./generated/90/infarctus/crop-nomask', './sample/valid/infarctus', 100, distinction_word="-crop-nomask")
-       move('./generated/90/noinfarctus/crop-nomask', './sample/valid/noinfarctus', 100, distinction_word="-crop-nomask")
\ No newline at end of file
+       move('./generated/updated/infarctus/crop-mask', './sample/train/infarctus', 0, 800, distinction_word="-crop-mask") # move [0 -> 600] ordered files from param 1 to param 2
+       move('./generated/updated/infarctus/crop-mask', './sample/valid/infarctus', 800, 1100, distinction_word="-crop-mask")
+       move('./generated/updated/infarctus/crop-mask', './sample/test/infarctus', 1100, 1200, distinction_word="-crop-mask")
+       
+       move('./generated/updated/noinfarctus/crop-mask', './sample/train/noinfarctus', 0, 100, distinction_word="-crop-mask")
+       move('./generated/updated/noinfarctus/crop-mask', './sample/valid/noinfarctus', 100, 160, distinction_word="-crop-mask")
+       move('./generated/updated/noinfarctus/crop-mask', './sample/test/noinfarctus', 160, 200, distinction_word="-crop-mask")