-
Notifications
You must be signed in to change notification settings - Fork 8
/
spikeTemplateGenerator.py
31 lines (23 loc) · 1.03 KB
/
spikeTemplateGenerator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python3
from sys import argv
def getInputVariables(varsList):
vars = varsList.split("\n")
for _vars in vars:
"""
Uncomment the below line if you think we don't need to sent \r after out input buffer
"""
# spikeTemplate = f's_readline();\ns_string("{_vars} ");\ns_string_variable("0");\n'
spikeTemplate = f's_readline();\ns_string("{_vars} ");\ns_string_variable("0");\ns_string("\\r\\n");\n'
print("-----------------------")
print(spikeTemplate)
print("-----------------------\n")
fileName = f"{argv[1]}_{_vars}.spk"
with open(fileName, 'w+') as f:
f.write(spikeTemplate)
print(f"[#] Spike Tempalte written in: {fileName}")
def main():
varFile = argv[1]
with open(varFile, 'r') as f:
getInputVariables(f.read().strip())
if __name__ == '__main__':
main()