Skip to content

worklog

dokato edited this page Aug 18, 2016 · 1 revision

Worklog

This is worklog of Google Summer of Code 2016 project I realized from April 22nd to August 23rd 2016.

Community Bonding

My community bonding period went very well and I've learned a lot of great stuff. First of all, at a beginning I had a Skype meeting with my tutor Marcel Stimberg. He explained me his view on the project and we decided what I was going to do in upcoming weeks. To list the most important things:

  1. I presented myself on Brian2 developers mailing list.

  2. I contributed to Brian2 main repo with the following pull-request https://github.com/brian-team/brian2/pull/693 (already merged).

  3. I set up all software needed to work on the project.

  4. I got familiar with last year's project related to my work.

  5. I studied Brian2 documentation and developers guide....

  6. … as well as some basic LEMS examples.

In the next week I plan to make some first attempts to use pylems module and possibly generate exporting of some simple examples.

Part 1 (Before Midterm Evaluation)

Week 1 (27.05.16)

This week was quite busy, but still with more reading than coding. Both with my mentor we wondered if there is any description of LEMS math syntax. We had to reach an external source to get an answer but now it seems clearer. Moreover, I went through Java implementation of jLEMS to get some valuable information about units parsing and equations rendering. That helped me to implement LEMSRenderer - the class which transforms Brian2 equations to LEMS format as well as unitsparser.from_string function which transforms values with units from string in LEMS format to Brian2 Quantity.

Week 2 (3.06.16)

For the last few days I worked on exporter from Brian2 models. After meeting with Marcel we decided to write some working skeleton of that and then take an advantage of code generation mechanism to make it easier to use. I implemented some helper functions and the very first version of the exporter. Currently it doesn't support refractoriness, but only the simplest examples. I validated it only on the last year's approach, so further tests are needed. Besides of that, next week I will try to improve my exporter and add write support for refractory neurons.

Week 3 (10.06.16)

This week I managed to finish LEMS exporter with refractoriness and tested it on simple example from Brian2 documentation. Resulting LEMS files were validated using jNeuroML parser. Outputs from refractory and not-refractory cases are shown on the picture below. Currently the solution is not very robust, e.g. only some units are supported (introduced as constants). Next week I would like to overcome this problem, add some automatic tests and validate my exporter on new examples.

Week 4 (17.06.16)

First part of the week I spent solving bugs in lemsexporter and testing more examples. I didn't add automatic test cases as I planned a week ago, because I realized that it is that straightforward. At least I have now some idea how to implement it now. Moreover, the LEMSUnitsConstants.xml LEMS file was added to support more units. In the near future I'm going to add not only NeuroML default units but all existing in Brian2. It's kind of tricky because for some of them we need to introduce new dimensions definitions. Recently I started working on code generation mechanism to provide better integration with Brian2 syntax.

Week 5 (24.06.16)

In the last days before midterm evaluation I started working on how to automatize testing and add code generation mechanism. I got some code snippet from my mentor, which allowed me to better understand how to implement my own Device. As I didn't have experience with that functionality of Brian it took me a while to get my mind around it. Second thing was restructuring lemsexporter to class. In the future it will allow to better combine LEMS and NeuroML part of the exporter. Moreover, I checked my function on more sophisticated examples like Hodgkin-Huxley model. I found some bugs and started working on improvement.

Part 2 (After Midterm Evaluation)

Week 6 (01.07.16)

After passing midterm evaluation I focused more on code generation mechanism. I made a first attempt to implement build method of my Device. I see now that some parts of previous functions will have to be restructured. Moreover, I tested exporter class on Hodgkin&Huxley example from Brian2 tutorial. Besides I added to my exporter functionality of including new Units which are not defined in NeuroMLCoreTypes. Finally, we clarified with my mentor some doubts about LEMS syntax. It will help to write automatic unit tests.

Week 7 (08.07.2016)

This week I restructured my project and improved examples to show two currently supported methods of exporting Brian2 code. We had some problems with supporting networks in LEMS and with initialization of each neuron separately inside the network, so currently we use MultiInstantiate. It wasn't that easy, because some pylems methods were unable to create XML structure serving our purposes. In order to fix that I contributed to pylems repository. Next week I am going to take a look at synapses creation and how to connect neuron in LEMS. Besides I will dedicate some time to create StateMonitor and SpikeMonitor validator.

Week 8 (15.07.2016)

Recently I extended exporter to support StateMonitors and SpikeMonitors. In order to achieve this I had to restructure my code a bit again. On the way I stumbled across some problems with pylems module, which at the very beginning I tried to solve just by naive monkey patching, but eventually I decided to contribute to pylems repository which is a way better solution. Furthermore, as neither pylems nor neuroml support Simulation tag I had to write my own class extending their functionalities. I decided to use DOM XML structure which is quite flexible solution. Another thing is that currently I have some minor problems with spikes recordings, because LEMS saving to file is somehow counter-intuitive for me. Fortunately I guess that I am on the right track.

Week 9 (22.07.2016)

This week I focused on updating functionalities of my exporter to extend it in a way that it could generate a ready to go LEMS file . Currently it was tested on the same example with two approaches of generating output: using exporter object or code generation mechanism. In order to do that I had to change the way pylems is exporting model. Before it allowed only saving to XML file, now it is possible to export DOM structure as well to python. Then I added classes which create a Silumation XML code. It had to be done from scratch as it hadn't existed in pylems or neuroml. I didn't manage to write Synapses support this week, so I shift that plan for the next one.

Week 10

break

Week 11 (05.08.2016)

After the break I came back to the issues reported in the repository. I started from adding recording of voltage to XML simulation when user calls StateMonitor. The bug in CGM example as fixed as well. After that I moved towards working on testing example. In order to make it easier I introduced setup.py file and treated brian2lems as a separate module. Now automatic tests validated simulation used all the time for visual testing. Next week I am going to finally take a closer look at Synapses export and think of wrapping up what I did so far.

Week 12 (12.08.2016)

This week I was wrapping up the project, polishing docstrings and started working on final description of my attempt, which is needed to pass the Final Evaluation of GSOC. There are some things which I failed to do. For instance: implementing synapses appeared to be more complex part than I assumed, but this is something I would like to finish even after the period of the project. Moreover, I think that I was getting close to implement network input, but to make it properly I need to have Synapses part defined well. All in all, plan for next few days is to complete description of the project, fix some bugs and if time allows move forward with synapses and network inputs.

Week 13 (19.08.2016)

Last week of GSOC I spent polishing my code plus writing down the user and developer-oriented documentation. I added also some improvement (like build_on_run) to make usage of my exporter easier. Some final fixes were introduced to code generation device as well. I introduced some PoissonInput tag to the model, but due to limited time I didn't manage to implement synaptic connections in LEMS, so currently it's not possible to integrate it with a final neuronal network. One of the final tasks was to summarize my work and send an email to community mailing list.