Changeset 456
- Timestamp:
- 09/01/08 23:37:58 (3 months ago)
- Files:
-
- doc/poster/trunk/VAbenchmarks_forposter.py (added)
- doc/poster/trunk/incf2008.py (modified) (2 diffs)
- doc/poster/trunk/poster.py (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/poster/trunk/incf2008.py
r455 r456 12 12 "INCM, CNRS, Marseille, France", 13 13 "Neurobiology and Biophysics, Albert-Ludwigs-University Freiburg, Germany", 14 " Ecole Polytechnique Fédérale de Lausanne (EPFL), Switzerland",14 "LCN, Ecole Polytechnique Fédérale de Lausanne (EPFL), Switzerland", 15 15 "Technische UniversitÀt Graz, Austria" 16 16 ] … … 41 41 """ 42 42 43 QA = [("What is PyNN?", "A Python package that defines and implements a uniform 'application programming interface' (API) across neural simulators. In other words, you can <b>write your simulation script <i>once</i>, then run it <i>without modification</i> on any supported simulator</b> (currently NEURON, NEST and PCSIM)."),43 QA = [("What is PyNN?", "A Python package that defines and implements a uniform 'application programming interface' (API) across neural simulators. In other words, you can <b>write your simulation script <i>once</i>, then run it <i>without modification</i> on any supported simulator</b> (currently NEURON, NEST, PCSIM, Brian, and the FACETS neuromorphic hardware). Support for MOOSE is under development."), 44 44 ("I use simulator <i>X</i>. Why should I switch to PyNN?", "Increased productivity. The main aim of PyNN is to increase the productivity of neuronal network modeling, by making it <b>faster to develop models</b> <i>de novo</i>, by <b>promoting code sharing and reuse</b> across simulator communities, and by making it much <b>easier to debug, test and validate simulations by running them on more than one simulator</b>. Even if you're not interested in using multiple simulators, if you don't already use Python or another dynamic, object-oriented language, and if your simulator doesn't already support programming using abstractions above the level of individual neurons and synaptic connections, you should see major gains from using a more powerful language and from more readable, shorter, more easily-maintainable code."), 45 45 ("Why Python?", 'Most simulators use configuration files or have their own specific scripting language. These are inevitably less powerful and flexible than a general-purpose programming language such as Python. Furthermore, Python has a huge standard library ("batteries included"), excellent numerical and graphical packages (making it an excellent Matlab replacement), a large developer-base outside the neuroscience community, and is free software.'), 46 46 ("I have a model written for simulator <i>X</i>. How do I convert it to PyNN?", "If <i>X</i> already has a Python interface (NEURON, NEST, PCSIM), first convert the code to Python (e.g. in NEURON, replace your hoc code with Python code) then gradually replace simulator-specific code with PyNN code, all the time checking that the model still runs and gives the same results. If <i>X</i> does not have a Python interface, contact us! We would be happy to work with you on adding support for <i>X</i> to PyNN, whether this is through a direct Python interface or a code-generation tool."), 47 ("Where can I download PyNN?", " http://neuralensemble.org/PyNN"),48 ("What other solutions are there for developing simulator-independent models?", "<b>NeuroML</b> (http://neuroml.org) is a standard for model specification in XML. <b>NeuroConstruct</b> (http://neuroconstruct.org) is a tool for developing network models, using a graphical interface, that can then be exported as either NEURON or GENESIS code. There is also some overlap with <b>Neurospaces</b> (http://www.neurospaces.org/), a framework for modular construction of computational neuroscience simulators."),49 (" What are your future plans for PyNN?", "We are currently working on: (i) support for NEST version 2, which adds support for distributed (parallel) simulations (distributed simulations in NEURON and PCSIM are already supported); (ii) support for the VLSI analog spiking network hardware being developed within the FACETS project (iii) support for import/export of network models specified in NeuroML; (iv) various improvements/extensions to the API, (v) general performance improvements."),47 ("Where can I download PyNN?", "<b>http://neuralensemble.org/PyNN</b>"), 48 ("What other solutions are there for developing simulator-independent models?", "<b>NeuroML</b> (http://neuroml.org) is a standard for model specification in XML. <b>NeuroConstruct</b> (http://neuroconstruct.org) is a tool for developing network models, using a graphical interface, that can then be exported as either NEURON or GENESIS code."), 49 ("How do I run distributed (parallel) simulations?", "If the underlying simulator supports parallelization (true for NEURON, NEST, PCSIM), just launch your simulation with mpirun. Parallelization is transparent to the user, no code changes are necessary."), 50 50 ("Why shouldn't I use PyNN?", "(i) If your work does not involve network modelling; (ii) if you prefer to use a graphical interface to develop your simulations."), 51 ("Who is using PyNN now?", "PyNN was first developed within the FACETS project, an EC-funded consortium of fifteen or so European research groups including seven groups doing computational neuroscience, using six simulators between them. In the absence of agreement that everyone should use the same simulator, a tool to make it easier to share models between groups was needed, and PyNN was born. Within FACETS, PyNN is being used for simulations of large-scale models of primary visual cortex and of generic cortical circuits with synaptic plasticity. We would like to encourage wider use, and anyone interested in using or developing PyNN should check out http://neuralensemble.org.")51 ("Who is using PyNN?", "PyNN was first developed within the FACETS project, an EC-funded consortium of fifteen or so European research groups including seven groups doing computational neuroscience, using six simulators between them. In the absence of agreement that everyone should use the same simulator, a tool to make it easier to share models between groups was needed, and PyNN was born. Within FACETS, PyNN is being used for simulations of large-scale models of primary visual cortex and of generic cortical circuits with synaptic plasticity. A number of people outside FACETS are now using PyNN as well. Anyone interested in using or developing PyNN should check out http://neuralensemble.org.") 52 52 ] 53 53 doc/poster/trunk/poster.py
r455 r456 19 19 import StringIO 20 20 21 FILL_TO_BOTTOM = -1 22 21 23 class Author(object): 22 24 … … 64 66 65 67 return styles 66 67 68 69 70 68 71 69 def make_text_frame(styles, text, x, y, width, height, _debug): … … 206 204 return output 207 205 208 def make_example_figure_caption(caption,x,y,width,height,_debug=False): 209 global poster 210 styles = getStyleSheet(20, 72) 211 212 pad = 0.5*cm 213 def calc_height(): 214 caption_paras = [Paragraph(p.strip(), styles['BodyText']) for p in caption.split("\n") if p.strip()] 215 f_height = 2*pad 216 for p in caption_paras: 217 f_height += p.wrap(width-2*pad,pageheight)[1] + p.getSpaceAfter() + p.getSpaceBefore() 218 return f_height 219 i = 0 220 while calc_height() > height: 221 if i > 100: 222 print "Warning: height failed to converge after 100 iterations (final value %s)" % calc_height() 223 break 224 #print styles['BodyText'].fontSize 225 scale_style(styles['BodyText'], 0.99) 226 i += 1 227 scale_style(styles['BodyText'], 1/0.99) 228 styles['BodyText'].alignment = TA_JUSTIFY # otherwise we get a 'bad align' error 229 caption_paras = [Paragraph(p.strip(), styles['BodyText']) for p in caption.split("\n") if p.strip()] 230 caption_frame = Frame(x, y-height, 231 width, height, 232 showBoundary=_debug, 233 leftPadding=pad, rightPadding=pad, 234 bottomPadding=pad, topPadding=pad) 235 caption_frame.addFromList(caption_paras, poster) 206 236 207 237 208 def make_fancy_box(x,y,w1,w2,h1,h2): … … 374 345 poster.drawInlineImage(logo, x, y, height=logo_height, width=logo_width) 375 346 347 def scale_font_to_height(self, paragraph_list, styles, height, width, pad=0.5*cm): 348 def calc_height(): 349 p_list = [Paragraph(p, styles['BodyText']) for p in paragraph_list] 350 f_height = 2*pad 351 for p in p_list: 352 f_height += p.wrap(width-2*pad, self.pageheight)[1] + p.getSpaceAfter() + p.getSpaceBefore() 353 return f_height 354 i = 0 355 max_iter = 500 356 while calc_height() > height: 357 if i > max_iter: 358 print "Warning: height failed to converge after %s iterations (final value %s)" % (max_iter, calc_height()) 359 break 360 scale_style(styles['BodyText'], 0.99) 361 i += 1 362 #scale_style(styles['BodyText'], 1/0.99) 363 styles['BodyText'].alignment = TA_JUSTIFY # otherwise we get a 'bad align' error 364 365 return [Paragraph(p, styles['BodyText']) for p in paragraph_list] 366 376 367 def add_frame(self, column_number, styles, content, height, _debug=False): 377 368 pad = 0.5*cm … … 380 371 y = column.bottom 381 372 width = column.width 373 if height == FILL_TO_BOTTOM: 374 height = self.colheight - (self.title_bottom - column.bottom) 375 382 376 frame = Frame(x, y - height, width, height, 383 377 leftPadding=pad, rightPadding=pad, bottomPadding=pad, 384 378 topPadding=pad, showBoundary=_debug) 385 379 386 definition_list = content 387 def calc_height(): 388 paragraph_list = [Paragraph('<font color="darkgreen"><b>%s</b></font> %s' % item, styles['BodyText']) for item in definition_list] 389 f_height = 2*pad 390 for p in paragraph_list: 391 f_height += p.wrap(width-2*pad, self.pageheight)[1] + p.getSpaceAfter() + p.getSpaceBefore() 392 return f_height 393 394 while calc_height() > height: 395 scale_style(styles['BodyText'], 0.99) 396 styles['BodyText'].alignment = TA_JUSTIFY # otherwise we get a 'bad align' error 397 398 paragraph_list = [Paragraph('<font color="darkgreen"><b>%s</b></font> %s' % item, styles['BodyText']) for item in definition_list] 399 400 self.roundRect(x,y-height,width,height,1*cm,fill=1) 380 if isinstance(content, list): 381 paragraph_list = ['<font color="darkgreen"><b>%s</b></font> %s' % item for item in content] 382 elif isinstance(content, basestring): 383 paragraph_list = [p.strip() for p in content.split("\n") if p.strip()] 384 paragraph_list = self.scale_font_to_height(paragraph_list, styles, height, width, pad) 385 386 self.roundRect(x, y-height, width, height, 1*cm, fill=1) 401 387 frame.addFromList(paragraph_list, self) 402 388 column.bottom -= height 403 389 404 390 def make_footer(self, text, fontsize=24, color=colors.white): 405 391 self.setFillColor(color) # white works better with a background image … … 408 394 0.2*self.margins['bottom'], text) 409 395 410 def make_example(self, column_number, styles, height, _debug=False): #,x_r,y,width,height,_debug=False):396 def make_example(self, column_number, styles, height, _debug=False): 411 397 """ Make a frame showing the VAbenchmarks.py script, together with figure.""" 412 398 pad = 0.5*cm … … 419 405 styles['Code'].leftIndent = 0 420 406 checkout_pyNN() 421 f = open(os.path.join('pyNN_%s' % VERSION,'test','VAbenchmarks.py'),'r') 407 #f = open(os.path.join('pyNN_%s' % VERSION,'test','VAbenchmarks.py'),'r') 408 f = open('VAbenchmarks_forposter.py', 'r') 422 409 example_script = f.read() 423 410 f.close() … … 453 440 maxlength = len(line) 454 441 f_width2 = stringWidth("m"*maxlength, styles['Code'].fontName, styles['Code'].fontSize, 'UTF-8') + pad 442 f_width2 = max(f_width2, self.colwidth - f_width1) 455 443 f_height += 2*pad 456 444 … … 469 457 topPadding=pad) 470 458 frame2.addFromList(flowables, self) 471 #frame3 = Frame(x + 2*f_width, y-f_height, f_width, f_height, showBoundary=_debug, 472 # leftPadding=0, rightPadding=pad, bottomPadding=pad, 473 # topPadding=pad) 474 #frame3.addFromList(flowables, self) 475 column.bottom -= f_height 459 column.bottom -= (f_height + self.colsep) 476 460 return x, y-f_height, f_width1+f_width2,f_height 477 461 478 def add_figure_frame(self, column_number, filename, caption='', _debug=False):462 def add_figure_frame(self, start_column, filename, height, ncol=1, caption='', caption_styles=None, _debug=False): 479 463 pad = 0.5*cm 480 column = self.columns[ column_number]464 column = self.columns[start_column] 481 465 x = column.left 482 466 y = column.bottom 483 467 width = self.colwidth 468 if ncol > 1: 469 width = ncol*self.colwidth + (ncol-1)*self.colsep 470 if height == FILL_TO_BOTTOM: 471 height = self.colheight - (self.title_bottom - column.bottom) 472 484 473 img = PIL.Image.open(filename) 485 height = img.size[1]*width/img.size[0] 486 img = Image(filename, width=width-2*pad, height=height-2*pad, kind='proportional', lazy=0) 487 f_height = img.drawHeight + 2*pad 488 figure_frame = Frame(x, y-f_height, 489 width, f_height, 474 img_height = img.size[1]*width/img.size[0] 475 img = Image(filename, width=width-2*pad, height=img_height-2*pad, kind='proportional', lazy=0) 476 figure_frame = Frame(x, y-img_height, 477 width, img_height, 490 478 showBoundary=_debug, 491 479 leftPadding=pad, rightPadding=pad, 492 480 bottomPadding=pad, topPadding=pad) 481 482 if caption: 483 caption_height = height - (img.drawHeight + 2*pad) 484 paragraph_list = [p.strip() for p in caption.split("\n") if p.strip()] 485 paragraph_list = self.scale_font_to_height(paragraph_list, caption_styles, caption_height, width, pad) 486 caption_frame = Frame(x, y-img_height-caption_height, width, caption_height, 487 leftPadding=pad, rightPadding=pad, bottomPadding=pad, 488 topPadding=pad, showBoundary=_debug) 489 else: 490 caption_height = 0 491 492 f_height = img_height + caption_height 493 493 poster.roundRect(x, y-f_height, width, f_height, 1*cm, fill=1) 494 column.bottom -= height495 494 figure_frame.add(img, self) 495 if caption: 496 caption_frame.addFromList(paragraph_list, self) 497 498 for col_num in range(start_column, start_column+ncol): 499 self.columns[col_num].bottom -= (f_height + self.colsep) 500 501 496 502 497 503 # ============================================================================== … … 512 518 #huge_url(poster._pagesize[0]/2.0, title_bottom/2.0, pagewidth) 513 519 514 # print "--- Making API docs ---"515 520 # apiwidth = 0.25*poster.pagewidth 516 521 # x_api,y_api,w_api,h_api = make_apidocs(getStyleSheet(9,36),poster.margins['left']+poster.pagewidth-apiwidth, poster.title_bottom, apiwidth, … … 518 523 519 524 #make_users_guide(getStyleSheet(15),margins['left']+colwidth+colsep, title_bottom, colwidth, colheight, DEBUG) 520 x_api = poster.columns[2].left 521 522 poster.add_figure_frame(1, "architecture_of_PyNN_v0.5.png", DEBUG) 523 524 print "--- Making example figure ---" 525 x_ex,y_ex,w_ex,h_ex = poster.make_example(1, getStyleSheet(10.5,36), poster.colheight, DEBUG) 525 526 poster.add_figure_frame(1, "architecture_of_PyNN_v0.5.png", height=None, ncol=2, _debug=DEBUG) 527 print [col.bottom for col in poster.columns] 528 529 poster.make_example(1, getStyleSheet(10.5,36), poster.colheight, DEBUG) 526 530 527 531 # make_fancy_box(x_ex, margins['bottom'],w_ex+colsep+w_api,w_ex,y_ex-colsep-margins['bottom'],y_api-colsep-margins['bottom']) 528 poster.add_figure_frame(1, "VAbenchmark_CUBA_exc.png", DEBUG) 529 # print "--- Making caption ---" 530 # make_example_figure_caption(CAPTIONS["VAbenchmark_CUBA_exc.png"], x_api-colsep, y_api-colsep, w_api+colsep, y_api-colsep-margins['bottom'], DEBUG) 531 532 print "--- Adding QA ---" 533 poster.add_frame(0, styles=getStyleSheet(36, 72), content=QA, height=poster.colheight) 534 #make_deflist_frame(getStyleSheet(36, 72),QA, margins['left'], title_bottom, x_ex-margins['left']-colsep, colheight, DEBUG) 532 poster.add_figure_frame(2, "VAbenchmark_CUBA_exc.png", height=FILL_TO_BOTTOM, 533 caption=CAPTIONS["VAbenchmark_CUBA_exc.png"], 534 caption_styles=getStyleSheet(20, 72), _debug=DEBUG) 535 536 poster.add_frame(0, styles=getStyleSheet(36, 72), height=FILL_TO_BOTTOM, content=QA) 535 537 536 538 poster.make_footer(ACKNOWLEDGEMENTS)

