Changeset 139
- Timestamp:
- 03/11/08 14:56:59 (10 months ago)
- Files:
-
- trunk/examples/retina/retina.py (modified) (1 diff)
- trunk/src/analysis.py (modified) (1 diff)
- trunk/src/benchmark.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/retina/retina.py
r101 r139 26 26 in peripheral retina. 27 27 28 The data times outputted by the model are the input to the LGN ( 29 http://en.wikipedia.org/wiki/Lateral_geniculate_nucleus ). Time for travelling 30 through the retina being compensated : 31 32 33 @article{Stanford87, 34 Author = {Stanford, L R}, 35 Journal = {Science}, 36 Month = {Oct}, 37 Number = {4825}, 38 Pages = {358-360}, 39 Title = {Conduction velocity variations minimize conduction time differences among retinal ganglion cell axons}, 40 Volume = {238}, 41 Year = {1987}} 42 43 To remember (in the cat) 5° of visual angle ~ 1 mm of retina 44 28 45 See : 29 46 Data for parameters http://webvision.med.utah.edu/GCPHYS1.HTM (TODO LUP: define 30 47 different sets for different animals (cat, monkey, human)) 31 48 Morphology : http://webvision.med.utah.edu/GC1.html 32 Topics on http://homepages.inf.ed.ac.uk/cgi/rbf/CVONLINE/phase3entries.pl?TAG5949 Topics on CVonline http://homepages.inf.ed.ac.uk/cgi/rbf/CVONLINE/phase3entries.pl?TAG59 33 50 34 51 TODO (LuP) : use Ringach 07 for setting the neurons centers trunk/src/analysis.py
r106 r139 76 76 stream.close() 77 77 p.terminate() 78 except: 79 print "Error playing the SpikeTrain " 78 80 81 79 82 finally: 80 83 os.remove(cfilename) trunk/src/benchmark.py
r106 r139 68 68 class Benchmark(object): 69 69 70 def __init__(self, filename, model, experiments):70 def __init__(self, directory, model, experiments): 71 71 """ Generates the benchmark files at the specified name 72 72 73 73 A benchmark is a list of experiments to test the effect of 74 74 parameter changes on a model. It is defined by: 75 - filename is the folder where the benchmark is run75 - directory is the folder where the benchmark files are stored 76 76 - model is the Model object 77 77 - params is its operating point (a dict) … … 80 80 81 81 """ 82 self.filename = filename 83 self.model = model 82 self.directory = directory 84 83 85 84 # first create directory 86 if not(os.path.isdir(self.filename)): 87 os.mkdir(self.filename) 88 89 if os.path.isfile(self.experiment_filename()): 90 print " * Directory exists at " , filename 91 92 # removing experiments not in the list 93 #if self.get('experiments')~= experiments: 94 85 if not(os.path.isdir(self.directory)): 86 os.mkdir(self.directory) 95 87 else: 96 print " * Creating benchmark file at " , filename 97 # TODO duck typing on file type 98 data_root = shelve.open(self.experiment_filename()) 99 # operational parameters 100 data_root['params'] = model.params 101 # Different experiments 102 data_root['experiments'] = experiments 103 data_root.close() 88 print " * Directory exists at " , directory 89 90 try: 91 print " * Benchmark file exists at " , self.experiment_filename() 92 print self.get('params').pretty() 93 94 except: 95 print " * Creating benchmark file at " , directory 96 self.put('params', self.model.params) 97 self.put('experiments', experiments) 104 98 105 99 … … 119 113 experiment = 'default' 120 114 121 return self. filename+ '/' + experiment122 123 def put(self,key,data,experiment ):115 return self.directory + '/' + experiment 116 117 def put(self,key,data,experiment = ''): 124 118 """ Puts dict at key in experiment file. 125 119 … … 136 130 """ 137 131 dict = {} 138 if os.path.isfile(self.experiment_filename(experiment)):132 try : #if os.path.isfile(self.experiment_filename(experiment)): 139 133 exp_root = shelve.open(self.experiment_filename(experiment)) 140 134 if key=='': … … 142 136 else: 143 137 dict = exp_root[key] 144 145 138 exp_root.close() 146 # else raise an error 139 140 except : 141 print 'could not get item', key, 'in experiment ', experiment 147 142 return dict 148 143 … … 219 214 #os.remove(self.filename) 220 215 216 #TODO: def reset(self,list_experi# if os.path.isfile(self.experiment_filename()): 217 # removing experiments not in the list 218 #if self.get('experiments')~= experiments: 221 219 222 220

