Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9675 closed enhancement (fixed)

New package: Brian, a simulator for spiking neural networks

Reported by: uri Owned by: tbd
Priority: minor Milestone: sage-4.6
Component: packages: experimental Keywords: brian brain simulator neuronal dynamics
Cc: mhansen, mvngu, schilly Merged in:
Authors: Oriol Castejon Reviewers: Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

I've created a Sage package from an already existing Python package called Brian (see http://www.briansimulator.org/ for more information). The description that is provided in this webpage is the following:

Brian is a simulator for spiking neural networks available on almost all platforms. The motivation for this project is that a simulator should not only save the time of processors, but also the time of scientists. It is easy to learn and use, highly flexible and easily extensible. The Brian package itself and simulations using it are all written in the Python programming language.

I'm not sure whether this package should be proposed as experimental or optional. For the moment I've put it as an experimental package. However, I think it could be optional, because as a Python package it has been widely tested and works perfectly, so I don't think there'll be a lot of problems as a Sage package. Please, let me know your opinion on that.

I must say I detected some problems with Brian units related to the Sage classes 'RealNumber?' and 'Integer', so I created a patch so that when Brian is imported these two classes are redefined as follows:

RealNumber=float
Integer=int

This solves the problems.

I attach the .spkg here (I know it's better just to provide a link, but I don't have anywhere else to upload it to).

Please, let me know what you think!

Attachments (1)

brian-1.2.1.p0.spkg (282.9 KB) - added by uri 9 years ago.
Brian package (.spkg file)

Download all attachments as: .zip

Change History (25)

comment:1 Changed 9 years ago by uri

  • Status changed from new to needs_review

comment:2 follow-ups: Changed 9 years ago by kcrisman

Cool! You may also want to see this thread on sage-devel about where to put spkgs.

As to the redefining, that seems... problematic. There are other Sage Python packages that must encounter the same problems - you may want to ask on the list about how they deal with this. (I suppose numpy and matplotlib would be likely candidates for this.)

What platforms does Brian work on out of the box?

comment:3 in reply to: ↑ 2 Changed 9 years ago by uri

Replying to kcrisman:

Cool! You may also want to see this thread on sage-devel about where to put spkgs.

Thanks, I didn't know about Google Code!

As to the redefining, that seems... problematic. There are other Sage Python packages that must encounter the same problems - you may want to ask on the list about how they deal with this. (I suppose numpy and matplotlib would be likely candidates for this.)

Yes, I'll give it a try, but I'm not sure if I'll be able to find another solution. I'll let you know.

What platforms does Brian work on out of the box?

Well, in the website they say: All platforms running Python, so at least Windows, Linux and Mac. I can't say more than that, as I've tried it just on Linux.

comment:4 in reply to: ↑ 2 ; follow-up: Changed 9 years ago by uri

Replying to kcrisman:

As to the redefining, that seems... problematic.

And turning of the preparser via:

preparser(false)

would also be problematic?

comment:5 in reply to: ↑ 4 ; follow-up: Changed 9 years ago by kcrisman

Replying to uri:

Replying to kcrisman:

As to the redefining, that seems... problematic.

And turning of the preparser via:

preparser(false)

would also be problematic?

Well, the issues is that a lot of Sage would no longer work as advertised. That is fine if one is only using Brian, but presumably the point of having Brian as an optional package is that one could go back and forth with other parts of Sage. I don't know exactly what other such packages do, though. I highly suggest just emailing sage-devel (perhaps in reply to your original message) and asking what ways around this there are; I assume they exist. Good luck!

comment:6 in reply to: ↑ 5 Changed 9 years ago by uri

Finally, Brian developers helped me to find a way to solve the problem without needing to redefine any Sage class nor to turn off the preparser. I've upload it on Google Code, you can download it here. However, I'll re-upload it here in Trac page to avoid confusions.

comment:7 follow-up: Changed 9 years ago by kcrisman

  • Milestone set to sage-4.6
  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to positive_review

This seems to build fine, the script is ok. In terms of experimental, positive review - it didn't crash anything, and commands actually do things and give output that is consistent with it.

To release manager - what happens now? It gets uploaded to the Sage mirrors as experimental package, maybe? Who does that?

But in the interests of improving it - I don't see why this couldn't be an optional package, if you can find another potential maintainer (different ticket). If so, you'd definitely want to have a SPKG-TEST file or whatever, since there are builtin tests. But...

When I do

sage: import brian
sage: brian.tests()

I get that I'm missing nose. I doubt that nose will be a Sage package anytime soon - or should it, if it makes tests that much easier? Perhaps upstream would consider having a non-nose option for testing.

When I try the brian website examples, it tells me that the Sage matplotlib backend doesn't support show(). That would be another thing to figure out.

comment:8 follow-up: Changed 9 years ago by mpatel

  • Status changed from positive_review to needs_work

The package has unchecked-in changes:

$ hg stat
? .hgignore
? SPKG.txt
? patches/units.py
? patches/units.py.patch
? spkg-install

Oriol, could you add these files to the repository and commit the changes with the ticket number in the commit string.

Also, could you please add yourself to the account name-real name map? Thanks!

comment:9 Changed 9 years ago by kcrisman

Oh, I'm so sorry, Mitesh - here I was checking whether the spkg worked but forgot to actually rebuild the spkg from its constituents. If I ran sage-pkg on it would it have shown this?

comment:10 in reply to: ↑ 8 ; follow-up: Changed 9 years ago by uri

Replying to mpatel:

The package has unchecked-in changes:

$ hg stat
? .hgignore
? SPKG.txt
? patches/units.py
? patches/units.py.patch
? spkg-install

Oriol, could you add these files to the repository and commit the changes with the ticket number in the commit string.

Ok, done. Please, let me know if it's allright, it's the first time I added files to the repository and I want to be sure I did everything correctly.

Also, could you please add yourself to the account name-real name map?

Done!

Thanks!

Thanks to you for your commments!!

comment:11 in reply to: ↑ 7 Changed 9 years ago by uri

Replying to kcrisman:

But in the interests of improving it - I don't see why this couldn't be an optional package, if you can find another potential maintainer (different ticket). If so, you'd definitely want to have a SPKG-TEST file or whatever, since there are builtin tests. But...

When I do

sage: import brian
sage: brian.tests()

I get that I'm missing nose. I doubt that nose will be a Sage package anytime soon - or should it, if it makes tests that much easier? Perhaps upstream would consider having a non-nose option for testing.

I don't really know what to say about that... I don't know nose and haven't looked at these tests much. I'll think about it, though. However, is it really necessary to include tests on the packages, in order to be set as optional instead of experimental?

When I try the brian website examples, it tells me that the Sage matplotlib backend doesn't support show(). That would be another thing to figure out.

Yes, I had already seen that. The problem is not in Brian but in the matplotlib package itself... there're other ways to see the images, for example replacing the show() command for:

sage: savefig('figure.png')

which creates the file figure.png in the working directory. Maybe that should be specified in the documentation. What do you think?

comment:12 in reply to: ↑ 10 ; follow-up: Changed 9 years ago by mpatel

Replying to uri:

Replying to mpatel:

Oriol, could you add these files to the repository and commit the changes with the ticket number in the commit string.

Ok, done. Please, let me know if it's allright, it's the first time I added files to the repository and I want to be sure I did everything correctly.

I apologize if I've missed it, but is there a link to the updated package?

comment:13 in reply to: ↑ 12 ; follow-up: Changed 9 years ago by uri

Replying to mpatel:

I apologize if I've missed it, but is there a link to the updated package?

You can download it clicking here, but it's the same link I provided before (there's been no update, I just added the files to the repository).

comment:14 in reply to: ↑ 13 Changed 9 years ago by uri

Replying to uri:

..but it's the same link I provided before (there's been no update, I just added the files to the repository).

ok, just to avoid confusions, what I mean by that is that the link is the same because I didn't change the name of the package (from brian-1.2.1.p0 to brian-1.2.1.p1) because there's been no update. So you'll download the right file with the old link.

Changed 9 years ago by uri

Brian package (.spkg file)

comment:15 Changed 9 years ago by mpatel

  • Status changed from needs_work to needs_review

comment:16 follow-up: Changed 9 years ago by kcrisman

# 9221 is related (making nose an optional/standard package).

comment:17 Changed 9 years ago by kcrisman

  • Status changed from needs_review to positive_review

Okay, I checked this all out again, and now the HG is fine, and I can't find any garbage files, and it still applies fine to Sage 4.5.3, and I think this is more than ready to be an experimental package.

If you want, you can find people to test it on a couple other platforms to make sure it's ready for optional package status - I'm not sure exactly what the protocol for that is, though it seems to me that it's more than ready compared to other denizens of http://www.sagemath.org/packages/optional/. But that could also be another ticket. At the very least it should get loaded up to the mirrors. Make it so!

comment:18 follow-up: Changed 9 years ago by mpatel

  • Cc mhansen mvngu schilly added

Harald, Mike, or Minh, could one of you add brian-1.2.1.p0.spkg to the experimental / contributed package repository?

comment:19 in reply to: ↑ 16 ; follow-up: Changed 9 years ago by mpatel

Replying to kcrisman:

# 9221 is related (making nose an optional/standard package).

Small correction: #9921 is about this, though there is a discussion about nose at #9221.

comment:20 in reply to: ↑ 19 Changed 9 years ago by kcrisman

Replying to mpatel:

Replying to kcrisman:

# 9221 is related (making nose an optional/standard package).

Small correction: #9921 is about this, though there is a discussion about nose at #9221.

Aagh! That's the same mistake Jason made on #9221 in referring (or not) to #9921... sorry.

comment:21 in reply to: ↑ 18 Changed 9 years ago by mvngu

  • Resolution set to fixed
  • Status changed from positive_review to closed

Replying to mpatel:

Harald, Mike, or Minh, could one of you add brian-1.2.1.p0.spkg to the experimental / contributed package repository?

Done. See

http://www.sagemath.org/packages/experimental/

comment:22 Changed 9 years ago by mpatel

Thanks, Minh!

comment:23 Changed 9 years ago by uri

Great, thank you all! I'll open a new ticket to see if it can be accepted as an optional package.

comment:24 Changed 9 years ago by mhampton

There's been some discussion on other tickets about the virtues of nose, so it might not be that unlikely to make it standard in Sage.

Note: See TracTickets for help on using tickets.