On Apr 7, 2010, at 2:10 AM, Uri wrote:
I'm having some problems trying to use a program called Brian
Simulator (www.briansimulator.org) through Sage. This program is
written in Python an can be used as a python package (I've tried it
and I had no problem). However, when I try to use it in Sage I get
some problems involving units, which are defined inside Brian. For
example, if I write:
sage: from brian import *
sage: 1*mV
I get the following error:
AttributeError Traceback (most recent call
last)
/home/uri/<ipython console> in <module>()
/home/uri/sage-4.3.1/local/lib/python2.6/site-packages/sage/structure/
element.so in sage.structure.element.RingElement.__mul__ (sage/
structure/element.c:10382)()
/home/uri/sage-4.3.1/local/lib/python2.6/site-packages/sage/structure/
coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op
(sage/structure/coerce.c:6145)()
/home/uri/sage-4.3.1/local/lib/python2.6/site-packages/brian/units.pyc
in __mul__(self, other)
1063 if isinstance(other,Unit):
1064 u = Unit(float(self)*float(other))
-> 1065 u.name = self.name + other.name
1066 u.dispname = self.dispname + ' ' + other.dispname
1067 u.dim = self.dim * other.dim
AttributeError: name
Does somebody know why it happens and how to avoid this error? What I
don't understand is that if I just write:
sage: mV
there's no problem at all. Thank you in advance!!
It appears that brian.units doesn't behave well with Sage integers
(perhaps assuming anything that's not a float or int is a
briansimulator unit). Try
sage: from brian import *
sage: int(1)*mV
or
sage: 1r*mV
- Robert
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
To unsubscribe, reply using "remove me" as the subject.