Esempio n. 1
0
 def saveUsers(self, users, filename, force=False):
     fileOverWriteWarning(filename, force)
     with open(filename, 'w') as f:
         for i in range(len(users)):
             #print users[i].theta
             f.write(
                 json.dumps((users[i].id, users[i].theta.tolist())) + '\n')
Esempio n. 2
0
 def saveUsers(self, users, filename, force=False):
     '''
     Save all users and their respective parameter values 
     in a json format in file.
     '''
     # Output warning message if going to overwrite
     # Otherwise, output warning if not supposed to overwrite and an existing file exist
     fileOverWriteWarning(filename, force)
     with open(filename, 'w') as f:
         # Loop through all users
         for i in range(len(users)):
             # print users[i].theta
             # Write a user and it's parameter values in a json list
             f.write(
                 json.dumps((users[i].id, users[i].theta.tolist())) + '\n')
Esempio n. 3
0
	def saveUsers(self, users, filename, force = False):
		fileOverWriteWarning(filename, force)
		with open(filename, 'w') as f:
			for i in range(len(users)):
				print users[i].theta
				f.write(json.dumps((users[i].id, users[i].theta.tolist())) + '\n')