-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsaveToFile.py
More file actions
18 lines (17 loc) · 855 Bytes
/
saveToFile.py
File metadata and controls
18 lines (17 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
import math
import argparse
import numpy as np
from core import Symbol
import core
from encoder import encode
from decoder import decode
def saveToFile(file_blocks, drops_quantity, subdirectoryName):
f = open("demofile.txt", "w")
print("________________________encode & write to file start_________________________________")
for curr_symbol in encode(file_blocks, drops_quantity=drops_quantity):
f.write(str(curr_symbol.index) + ";" + str(curr_symbol.degree) + ";" + str(curr_symbol.index) + "-" + str(curr_symbol.degree) + ".npy" + ";;")
dir = os.path.dirname(__file__)
np.save(os.path.join(dir, subdirectoryName + "/" + str(curr_symbol.index) + "-" + str(curr_symbol.degree)), curr_symbol.data)
print("_________________________encode & write to file end_________________________________")
f.close()