Changeset 416
- Timestamp:
- 07/16/08 10:40:43 (1 month ago)
- Files:
-
- trunk/src/nest1/__init__.py (modified) (3 diffs)
- trunk/src/nest2/__init__.py (modified) (3 diffs)
- trunk/src/neuron/__init__.py (modified) (3 diffs)
- trunk/src/neuron2/__init__.py (modified) (1 diff)
- trunk/src/recording.py (modified) (2 diffs)
- trunk/src/utility.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/nest1/__init__.py
r414 r416 7 7 8 8 import pynest 9 from pyNN import common, recording 9 from pyNN import common, recording, utility 10 10 from pyNN.random import * 11 11 import numpy, types, sys, shutil, os, logging, copy, tempfile … … 88 88 global tempdir 89 89 90 # Initialisation of the log module. To write in the logfile, simply enter 91 # logging.critical(), logging.debug(), logging.info(), logging.warning() 92 log_file = "nest1.log" 93 if debug: 94 if isinstance(debug, basestring): 95 log_file = debug 96 utility.init_logging(log_file, debug, num_processes(), rank()) 97 logging.info("Initialization of Nest") 98 90 99 tempdir = tempfile.mkdtemp() 91 100 tempdirs.append(tempdir) # append tempdir to tempdirs list … … 111 120 'rng_seeds' : rng_seeds[0:num_threads], 112 121 'buffsize' : batchsize}) 113 114 # Initialisation of the log module. To write in the logfile, simply enter 115 # logging.critical(), logging.debug(), logging.info(), logging.warning() 116 if debug: 117 logging.basicConfig(level=logging.DEBUG, 118 format='%(asctime)s %(levelname)s %(message)s', 119 filename='nest.log', 120 filemode='w') 121 else: 122 logging.basicConfig(level=logging.INFO, 123 format='%(asctime)s %(levelname)s %(message)s', 124 filename='nest.log', 125 filemode='w') 126 127 logging.info("Initialization of Nest") 122 128 123 return 0 129 124 trunk/src/nest2/__init__.py
r414 r416 7 7 8 8 import nest 9 from pyNN import common 9 from pyNN import common, utility 10 10 from pyNN.random import * 11 11 from pyNN import recording … … 290 290 simulator but not by others. 291 291 """ 292 global tempdir 293 log_file = "nest2.log" 294 if debug: 295 if isinstance(debug, basestring): 296 log_file = debug 297 utility.init_logging(log_file, debug, num_processes(), rank()) 298 logging.info("Initialization of Nest") 292 299 common.setup(timestep, min_delay, max_delay, debug, **extra_params) 293 global tempdir294 300 assert min_delay >= timestep, "min_delay (%g) must be greater than timestep (%g)" % (min_delay, timestep) 295 301 … … 327 333 'max_delay': max_delay}) 328 334 329 # Initialisation of the log module. To write in the logfile, simply enter330 # logging.critical(), logging.debug(), logging.info(), logging.warning()331 if debug:332 if isinstance(debug, basestring):333 filename = debug334 else:335 filename = "nest.log"336 logging.basicConfig(level=logging.DEBUG,337 format='%(asctime)s %(levelname)s %(message)s',338 filename=filename,339 filemode='w')340 else:341 logging.basicConfig(level=logging.INFO,342 format='%(asctime)s %(levelname)s %(message)s',343 filename='nest.log',344 filemode='w')345 346 logging.info("Initialization of Nest")347 335 return nest.Rank() 348 336 trunk/src/neuron/__init__.py
r414 r416 13 13 from pyNN.random import * 14 14 from math import * 15 from pyNN import common 15 from pyNN import common, utility 16 16 from pyNN.neuron.cells import * 17 17 from pyNN.neuron.connectors import * … … 414 414 simulator but not by others. 415 415 """ 416 global nhost, myid, logger,initialised, quit_on_end, running416 global nhost, myid, initialised, quit_on_end, running 417 417 load_mechanisms() 418 418 if 'quit_on_end' in extra_params: 419 419 quit_on_end = extra_params['quit_on_end'] 420 # Initialisation of the log module. To write in the logfile, simply enter421 # logging.critical(), logging.debug(), logging.info(), logging.warning()422 if debug:423 logging.basicConfig(level=logging.DEBUG,424 format='%(asctime)s %(levelname)s %(message)s',425 filename='neuron.log',426 filemode='w')427 else:428 logging.basicConfig(level=logging.INFO,429 format='%(asctime)s %(levelname)s %(message)s',430 filename='neuron.log',431 filemode='w')432 433 logging.info("Initialization of NEURON (use setup(.., debug=True) to see a full logfile)")434 420 435 421 # All the objects that will be used frequently in the hoc code are declared in the setup … … 462 448 h('cvode = new CVode()') 463 449 h.cvode.active(1) 464 450 451 # Initialisation of the log module. To write in the logfile, simply enter 452 # logging.critical(), logging.debug(), logging.info(), logging.warning() 453 log_file = "neuron.log" 454 if debug: 455 if isinstance(debug, basestring): 456 log_file = debug 457 utility.init_logging(log_file, debug, num_processes(), rank()) 458 logging.info("Initialization of NEURON (use setup(.., debug=True) to see a full logfile)") 459 465 460 nhost = int(h.pc.nhost()) 466 461 if nhost < 2: trunk/src/neuron2/__init__.py
r414 r416 37 37 global quit_on_end 38 38 if not simulator.state.initialized: 39 utility.init_logging("neuron2.log .%d" % rank(), debug)39 utility.init_logging("neuron2.log", debug, num_processes(), rank()) 40 40 logging.info("Initialization of NEURON (use setup(.., debug=True) to see a full logfile)") 41 41 simulator.state.initialized = True trunk/src/recording.py
r405 r416 124 124 saved by the simulators). 125 125 """ 126 logging.debug(filename)127 126 myfile = open(filename, "r", DEFAULT_BUFFER_SIZE) 128 127 contents = myfile.readlines() 129 128 myfile.close() 130 logging.debug(contents)131 129 data = [] 132 130 for line in contents: … … 139 137 if a.size > 0: 140 138 (Nrow, Ncol) = a.shape 141 logging.debug(str(a.shape))139 #logging.debug(str(a.shape)) 142 140 #if ((Nrow == 1) or (Ncol == 1)): a = numpy.ravel(a) 143 141 return a trunk/src/utility.py
r366 r416 44 44 return args 45 45 46 def init_logging(logfile, debug=False): 46 def init_logging(logfile, debug=False, num_processes=1, rank=0): 47 if num_processes > 1: 48 logfile += '.%d' % rank 47 49 if debug: 48 50 logging.basicConfig(level=logging.DEBUG,
