| 119 | | def make_abstract(styles,text,x,y,width,height,_debug): |
|---|
| 120 | | abstract_frame = Frame(x, y - height, width, height, |
|---|
| 121 | | showBoundary=_debug) |
|---|
| 122 | | |
|---|
| 123 | | abstract = [Paragraph(p, styles['BodyText']) for p in ABSTRACT.split("\n\n")] |
|---|
| 124 | | #print abstract |
|---|
| 125 | | abstract_frame.addFromList(abstract, poster) |
|---|
| 126 | | #while not abstract_frame.addFromList(abstract, poster): |
|---|
| 127 | | # abstract_frame._height += 1*cm |
|---|
| 128 | | # abstract_frame._geom() |
|---|
| 129 | | # abstract_frame._reset() |
|---|
| 130 | | # print abstract_frame._height |
|---|
| | 119 | def make_text_frame(styles,text,x,y,width,height,_debug): |
|---|
| | 120 | pad = 0.5*cm |
|---|
| | 121 | frame = Frame(x, y - height, width, height, |
|---|
| | 122 | leftPadding=pad, rightPadding=pad, bottomPadding=pad, |
|---|
| | 123 | topPadding=pad, showBoundary=_debug) |
|---|
| | 124 | |
|---|
| | 125 | paragraph_list = [Paragraph(p, styles['BodyText']) for p in text.split("\n\n")] |
|---|
| | 126 | frame.addFromList(paragraph_list, poster) |
|---|
| | 127 | poster.roundRect(x,y-height,width,height,1*cm) |
|---|
| | 128 | |
|---|
| | 129 | def make_deflist_frame(styles,definition_list,x,y,width,height,_debug): |
|---|
| | 130 | pad = 0.5*cm |
|---|
| | 131 | frame = Frame(x, y - height, width, height, |
|---|
| | 132 | leftPadding=pad, rightPadding=pad, bottomPadding=pad, |
|---|
| | 133 | topPadding=pad, showBoundary=_debug) |
|---|
| | 134 | |
|---|
| | 135 | def calc_height(): |
|---|
| | 136 | paragraph_list = [Paragraph('<font color="darkgreen"><b>%s</b></font> %s' % item, styles['BodyText']) for item in definition_list] |
|---|
| | 137 | f_height = 2*pad |
|---|
| | 138 | for p in paragraph_list: |
|---|
| | 139 | f_height += p.wrap(width-2*pad,pageheight)[1] + p.getSpaceAfter() + p.getSpaceBefore() |
|---|
| | 140 | return f_height |
|---|
| | 141 | |
|---|
| | 142 | while calc_height() > height: |
|---|
| | 143 | scale_style(styles['BodyText'], 0.99) |
|---|
| | 144 | styles['BodyText'].alignment = TA_JUSTIFY # otherwise we get a 'bad align' error |
|---|
| | 145 | |
|---|
| | 146 | paragraph_list = [Paragraph('<font color="darkgreen"><b>%s</b></font> %s' % item, styles['BodyText']) for item in definition_list] |
|---|
| | 147 | frame.addFromList(paragraph_list, poster) |
|---|
| | 148 | poster.roundRect(x,y-height,width,height,1*cm) |
|---|
| 277 | | # Scale the font size to fill the space |
|---|
| 278 | | def calc_height(): |
|---|
| 279 | | f_height = 0 |
|---|
| 280 | | for p in paragraph_list: |
|---|
| 281 | | f_height += p.wrap(f_width, pageheight)[1] + p.getSpaceAfter() + p.getSpaceBefore() |
|---|
| 282 | | ##f_height = nlines*(styles['Code'].leading+styles['Code'].spaceAfter+styles['Code'].spaceBefore) |
|---|
| 283 | | ##f_height += styles['Title'].leading + styles['Title'].spaceBefore + styles['Title'].spaceAfter |
|---|
| 284 | | f_height += 2*pad |
|---|
| 285 | | return f_height |
|---|
| 286 | | scale_style(styles['Code'],5.0) |
|---|
| 287 | | while calc_height() > height: |
|---|
| 288 | | #print styles['Code'].fontSize |
|---|
| 289 | | scale_style(styles['Code'], 0.99) |
|---|
| 290 | | print styles['Code'].fontSize |
|---|
| 291 | | example_frame = Frame(x, y-height, f_width, height, showBoundary=_debug, |
|---|
| | 293 | |
|---|
| | 294 | code_height = styles['Code'].leading+styles['Code'].spaceAfter+styles['Code'].spaceBefore |
|---|
| | 295 | f_height = nlines * code_height |
|---|
| | 296 | f_height += styles['Title'].leading + styles['Title'].spaceBefore + styles['Title'].spaceAfter |
|---|
| | 297 | f_height /= 2.0 |
|---|
| | 298 | |
|---|
| | 299 | lines_in_first_frame = int(nlines - f_height/code_height) |
|---|
| | 300 | maxlength = 0 |
|---|
| | 301 | for line in lines[:lines_in_first_frame]: |
|---|
| | 302 | if len(line) > maxlength: |
|---|
| | 303 | maxlength = len(line) |
|---|
| | 304 | f_width1 = stringWidth("m"*maxlength, styles['Code'].fontName, styles['Code'].fontSize, 'UTF-8') + pad |
|---|
| | 305 | maxlength = 0 |
|---|
| | 306 | for line in lines[lines_in_first_frame:]: |
|---|
| | 307 | if len(line) > maxlength: |
|---|
| | 308 | maxlength = len(line) |
|---|
| | 309 | f_width2 = stringWidth("m"*maxlength, styles['Code'].fontName, styles['Code'].fontSize, 'UTF-8') + pad |
|---|
| | 310 | f_height += 2*pad |
|---|
| | 311 | |
|---|
| | 312 | x = x_r - f_width1 - f_width2 |
|---|
| | 313 | |
|---|
| | 314 | frame1 = Frame(x, y-f_height, f_width1, f_height, showBoundary=_debug, |
|---|
| | 315 | leftPadding=pad, rightPadding=0, bottomPadding=pad, |
|---|
| | 316 | topPadding=pad) |
|---|
| | 317 | frame1.add(Paragraph("Example", styles['Title']), poster) |
|---|
| | 318 | flowables = frame1.split(code_flowable, poster) |
|---|
| | 319 | |
|---|
| | 320 | frame1.addFromList(flowables, poster) |
|---|
| | 321 | frame2 = Frame(x + f_width1, y-f_height, f_width2, f_height, showBoundary=_debug, |
|---|
| 294 | | example_frame.addFromList(paragraph_list, poster) |
|---|
| 295 | | poster.roundRect(x,y-height,f_width,height,1*cm) |
|---|
| 296 | | |
|---|
| 297 | | def make_example_figure(styles,filename,caption,x,y,width,_debug=False): |
|---|
| 298 | | global poster |
|---|
| 299 | | img = Image(filename, width=width, height=1e12, kind='proportional', lazy=0) |
|---|
| 300 | | caption_paras = [Paragraph(p.strip(), styles['BodyText']) for p in caption.split("\n") if p.strip()] |
|---|
| 301 | | print len(caption_paras) |
|---|
| | 324 | frame2.addFromList(flowables, poster) |
|---|
| | 325 | #frame3 = Frame(x + 2*f_width, y-f_height, f_width, f_height, showBoundary=_debug, |
|---|
| | 326 | # leftPadding=0, rightPadding=pad, bottomPadding=pad, |
|---|
| | 327 | # topPadding=pad) |
|---|
| | 328 | #frame3.addFromList(flowables, poster) |
|---|
| | 329 | |
|---|
| | 330 | poster.roundRect(x,y-f_height,f_width1+f_width2,f_height,1*cm) |
|---|
| | 331 | return x, y-f_height, f_width1+f_width2,f_height |
|---|
| | 332 | |
|---|
| | 333 | def make_example_figure(filename,x,y,width,height,_debug=False): |
|---|
| | 334 | global poster |
|---|
| 311 | | figure_frame.addFromList([img] + caption_paras, poster) |
|---|
| 312 | | |
|---|
| | 343 | #poster.roundRect(x,y-f_height,width,f_height,1*cm) |
|---|
| | 344 | figure_frame.add(img, poster) |
|---|
| | 345 | |
|---|
| | 346 | def make_example_figure_caption(caption,x,y,width,height,_debug=False): |
|---|
| | 347 | global poster |
|---|
| | 348 | styles = getStyleSheet(20, 72) |
|---|
| | 349 | |
|---|
| | 350 | pad = 0.5*cm |
|---|
| | 351 | def calc_height(): |
|---|
| | 352 | caption_paras = [Paragraph(p.strip(), styles['BodyText']) for p in caption.split("\n") if p.strip()] |
|---|
| | 353 | f_height = 2*pad |
|---|
| | 354 | for p in caption_paras: |
|---|
| | 355 | f_height += p.wrap(width-2*pad,pageheight)[1] + p.getSpaceAfter() + p.getSpaceBefore() |
|---|
| | 356 | return f_height |
|---|
| | 357 | while calc_height() > height: |
|---|
| | 358 | #print styles['BodyText'].fontSize |
|---|
| | 359 | scale_style(styles['BodyText'], 0.99) |
|---|
| | 360 | scale_style(styles['BodyText'], 1/0.99) |
|---|
| | 361 | styles['BodyText'].alignment = TA_JUSTIFY # otherwise we get a 'bad align' error |
|---|
| | 362 | caption_paras = [Paragraph(p.strip(), styles['BodyText']) for p in caption.split("\n") if p.strip()] |
|---|
| | 363 | caption_frame = Frame(x, y-height, |
|---|
| | 364 | width, height, |
|---|
| | 365 | showBoundary=_debug, |
|---|
| | 366 | leftPadding=pad, rightPadding=pad, |
|---|
| | 367 | bottomPadding=pad, topPadding=pad) |
|---|
| | 368 | caption_frame.addFromList(caption_paras, poster) |
|---|
| | 369 | |
|---|
| | 370 | def make_fancy_box(x,y,w1,w2,h1,h2): |
|---|
| | 371 | global poster |
|---|
| | 372 | r = 1*cm |
|---|
| | 373 | path = poster.beginPath() |
|---|
| | 374 | path.arc(x,y,x+2*r,y+2*r,startAng=180,extent=90) |
|---|
| | 375 | path.lineTo(x+w1-r,y) |
|---|
| | 376 | path.arc(x+w1-2*r,y+2*r,x+w1,y,startAng=270,extent=90) |
|---|
| | 377 | path.lineTo(x+w1,y+h2-r) |
|---|
| | 378 | path.arc(x+w1-2*r,y+h2-2*r,x+w1,y+h2,startAng=0,extent=90) |
|---|
| | 379 | path.lineTo(x+w2+r,y+h2) |
|---|
| | 380 | path.arc(x+w2,y+h2,x+w2+2*r,y+h2+2*r,startAng=180,extent=90) |
|---|
| | 381 | path.moveTo(x+w2,y+h2+r) |
|---|
| | 382 | path.lineTo(x+w2, y+h1-r) |
|---|
| | 383 | path.arc(x+w2-2*r,y+h1-2*r,x+w2,y+h1,startAng=0,extent=90) |
|---|
| | 384 | path.lineTo(x+r, y+h1) |
|---|
| | 385 | path.arc(x,y+h1-2*r,x+2*r,y+h1,startAng=90,extent=90) |
|---|
| | 386 | path.lineTo(x, y+r) |
|---|
| | 387 | poster.drawPath(path) |
|---|
| | 388 | |
|---|
| 370 | | |
|---|
| 371 | | This work is supported by the European Union through the FACETS project (contract number FP6- |
|---|
| 372 | | 2004-IST-FETPI-15879).""" |
|---|
| | 446 | """ |
|---|
| | 447 | |
|---|
| | 448 | 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)."), |
|---|
| | 449 | ("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."), |
|---|
| | 450 | ("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.'), |
|---|
| | 451 | ("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."), |
|---|
| | 452 | ("Where can I download PyNN?", "http://neuralensemble.org/PyNN"), |
|---|
| | 453 | ("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."), |
|---|
| | 454 | ("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 import/export of network models specified in NeuroML; (iii) various improvements/extensions to the API, (iv) general performance improvements."), |
|---|
| | 455 | ("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."), |
|---|
| | 456 | ("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.") |
|---|
| | 457 | ] |
|---|
| | 458 | |
|---|
| | 459 | ACKNOWLEDGEMENTS = "This work is supported by the European Commission through the FACETS project (contract number FP6-2004-IST-FETPI-15879) and by the CNRS. PY is supported by a MENRT bursary." |
|---|
| 419 | | huge_url(poster._pagesize[0]/2.0, title_bottom/2.0, pagewidth) |
|---|
| 420 | | make_abstract(getStyleSheet(36, 72),ABSTRACT, margins['left'], title_bottom, colwidth, colheight, DEBUG) |
|---|
| | 504 | #huge_url(poster._pagesize[0]/2.0, title_bottom/2.0, pagewidth) |
|---|
| | 505 | |
|---|
| | 506 | apiwidth = 0.25*pagewidth |
|---|
| | 507 | x_api,y_api,w_api,h_api = make_apidocs(getStyleSheet(9,36),margins['left']+pagewidth-apiwidth, title_bottom, apiwidth, |
|---|
| | 508 | colheight, DEBUG) |
|---|
| | 509 | |
|---|
| | 510 | |
|---|
| 422 | | make_example(getStyleSheet(10.5,36),margins['left']+colwidth+colsep, title_bottom, colwidth, colheight, DEBUG) |
|---|
| 423 | | make_example_figure(getStyleSheet(20, 72), "VAbenchmark_CUBA_exc.png", |
|---|
| 424 | | CAPTIONS["VAbenchmark_CUBA_exc.png"], |
|---|
| 425 | | margins['left']+colwidth+colsep, title_bottom, colwidth, DEBUG) |
|---|
| 426 | | apiwidth = 0.25*pagewidth |
|---|
| 427 | | make_apidocs(getStyleSheet(9,36),margins['left']+pagewidth-apiwidth, title_bottom, apiwidth, |
|---|
| 428 | | colheight, DEBUG) |
|---|
| | 512 | x_ex,y_ex,w_ex,h_ex = make_example(getStyleSheet(10.5,36), x_api-colsep, title_bottom, colwidth, colheight, DEBUG) |
|---|
| | 513 | make_example_figure("VAbenchmark_CUBA_exc.png", x_ex, y_ex-colsep, w_ex, y_ex-colsep-margins['bottom'], DEBUG) |
|---|
| | 514 | make_example_figure_caption(CAPTIONS["VAbenchmark_CUBA_exc.png"], x_api-colsep, y_api-colsep, w_api+colsep, y_api-colsep-margins['bottom'], DEBUG) |
|---|
| | 515 | make_fancy_box(x_ex, margins['bottom'],w_ex+colsep+w_api,w_ex,y_ex-colsep-margins['bottom'],y_api-colsep-margins['bottom']) |
|---|
| | 516 | |
|---|
| | 517 | make_deflist_frame(getStyleSheet(36, 72),QA, margins['left'], title_bottom, x_ex-margins['left']-colsep, colheight, DEBUG) |
|---|
| | 518 | |
|---|
| | 519 | poster.setFont("Helvetica", 20) |
|---|
| | 520 | poster.drawCentredString(margins['left']+pagewidth/2.0, 0.4*margins['bottom'], ACKNOWLEDGEMENTS) |
|---|