diff synpy/parameter_setter.py @ 76:90b68f259541 tip

updated parameter_setter to be able to find the TimeSignature.pkl file without putting it in the pwd
author christopherh <christopher.harte@eecs.qmul.ac.uk>
date Wed, 13 May 2015 09:27:36 +0100
parents ef891481231e
children
line wrap: on
line diff
--- a/synpy/parameter_setter.py	Tue May 12 23:10:58 2015 +0100
+++ b/synpy/parameter_setter.py	Wed May 13 09:27:36 2015 +0100
@@ -6,6 +6,9 @@
 # Set the parameters: time-signature, subdivision-sequence, strong-beat-level; Lmax; weight-sequence
 # Important condition: Lmax needs to be no less than the length of subdivision-sequence and the length of weight-sequence
 
+def getScriptPath():
+	import os
+	return os.path.dirname(os.path.realpath(__file__))
 
 # {'key': time-signature} :  
 # {'value': [subdivision-sequence, theoretical beat-level represented by index in the subdivision-sequence list]}
@@ -56,13 +59,13 @@
 
 def write_time_signature():
 	import cPickle as pickle
-	timeSigFile = open('TimeSignature.pkl', 'wb')
+	timeSigFile = open(getScriptPath()+'/TimeSignature.pkl', 'wb')
 	pickle.dump(timeSignatureBase, timeSigFile)
 	timeSigFile.close()
 
 def read_time_signature():
 	import cPickle as pickle
-	timeSigFile = open('TimeSignature.pkl','rb')
+	timeSigFile = open(getScriptPath()+'/TimeSignature.pkl','rb')
 	data = pickle.load(timeSigFile)
 	return data
 	timeSigFile.close()