Changeset 424
- Timestamp:
- 07/18/08 14:28:56 (3 months ago)
- Files:
-
- trunk/src/nest2/__init__.py (modified) (2 diffs)
- trunk/src/neuron2/simulator.py (modified) (1 diff)
- trunk/src/recording.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/nest2/__init__.py
r423 r424 160 160 def write(self, file=None, gather=False, compatible_output=True): 161 161 user_file = file or self.file 162 if isinstance(user_file, basestring) and num_processes() > 1: 163 user_file += '.%d' % rank() 162 if isinstance(user_file, basestring): 163 if num_processes() > 1: 164 user_file += '.%d' % rank() 165 recording.rename_existing(user_file) 164 166 nest_filename = _merge_files(self._device, gather) 165 167 if compatible_output: … … 181 183 else: 182 184 raise Exception('Must provide a filename or an open file') 183 if gather == True and num_processes() > 1:185 if gather == True and rank() == 0 and num_processes() > 1: 184 186 root_file = file or self.filename 187 recording.rename_existing(root_file) 185 188 for node in xrange(num_processes()): 186 if rank()==0: 187 node_file = root_file + '.%d' % node 188 if os.path.exists(node_file): 189 system_line = 'cat %s >> %s' % (node_file, root_file) 190 os.system(system_line) 191 system_line = 'rm %s' % node_file 192 os.system(system_line) 189 node_file = root_file + '.%d' % node 190 if os.path.exists(node_file): 191 os.system('cat %s >> %s' % (node_file, root_file)) 192 os.system('rm %s' % node_file) 193 193 # don't want to remove nest_filename at this point in case the user wants to access the data 194 194 # a second time (e.g. with both getSpikes() and printSpikes()), but we should trunk/src/neuron2/simulator.py
r403 r424 91 91 data = self.get(gather) 92 92 filename = file or self.filename 93 recording.rename_existing(filename) 93 94 numpy.savetxt(filename, data, Recorder.numpy1_0_formats[self.variable], delimiter='\t') 94 95 if compatible_output: 95 recording.write_compatible_output(filename, filename, Recorder.formats[self.variable],96 recording.write_compatible_output(filename, filename, self.variable, Recorder.formats[self.variable], 96 97 self.population, state.dt) 97 98 trunk/src/recording.py
r423 r424 42 42 # pass 43 43 44 def rename_existing(filename): 45 if os.path.exists(filename): 46 os.system('mv %s %s_old' % (filename, filename)) 47 logging.warning("File %s already exists. Renaming the original file to %s_old" % (filename, filename)) 48 44 49 def convert_compatible_output(data, population, variable): 45 50 """
