2021-05-23 11:43:31 +02:00
|
|
|
import json
|
|
|
|
import mine_parameters as param
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
# this module is self contained, used to generate a json file
|
2021-05-23 13:38:16 +02:00
|
|
|
DIR_DATA = os.path.join("../../resources", "data")
|
2021-05-23 11:43:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
# just to show, how mine parameters works
|
|
|
|
def param_presents():
|
|
|
|
mine = param.MineParameters()
|
|
|
|
print(mine.jsonifyable_dict())
|
|
|
|
|
|
|
|
json_mine = json.dumps(mine.jsonifyable_dict())
|
|
|
|
print(json_mine)
|
|
|
|
|
|
|
|
new_mine = param.MineParameters(json.loads(json_mine))
|
|
|
|
print(new_mine.get_parameters())
|
|
|
|
|
|
|
|
|
|
|
|
def generate_data(file_name: str, lines: int):
|
|
|
|
file = open(os.path.join(DIR_DATA, file_name), "w")
|
|
|
|
|
|
|
|
for x in range(lines):
|
|
|
|
new_params = json.dumps(param.MineParameters().jsonifyable_dict())
|
|
|
|
file.write(new_params)
|
|
|
|
file.write("\n")
|
|
|
|
|
|
|
|
file.close()
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
generate_data("params3.txt", 20000)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|