Inconsistent Units Error
Hi, I am a new user of brian so maybe its an amateur question but i was hoping if someone could help me figure out where I am going wrong in writing the following equations. I keep getting inconsistent unit error and my hunch is it is coming from the expression ‘’’ ((2.0mV)exp((-53.5mV-Vd)/(27.0mV)) ‘’’ in betacd however I’m not sure what I have written incorrectly.
Here are the equations:
If anyone can help me spot it, it would be a great help!
Minimal code to reproduce problem
# KC potassium current
alphacd = (((1.0*mV-Vd-10.0*mV)/mV)*exp((Vd+50.0*mV)/(11*mV)-(Vd+53.5*mV)/(27*mV))/18.975)/ms+(Vd+10.0*mV)*(2.0/mV)*exp((-53.5*mV-Vd)/(27.0*mV))/ms: Hz
betacd= int(Vd <= -10*mV)*((2.0*mV)*exp((-53.5*mV-Vd)/(27.0*mV))-alphacd): Hz
What you have already tried
Expected output (if relevant)
Actual output (if relevant)
Full traceback of error (if relevant)
Here is the traceback,
---------------------------------------------------------------------------
DimensionMismatchError Traceback (most recent call last)
File c:\Users\parih\anaconda3\lib\site-packages\brian2\equations\equations.py:1189, in Equations.check_units(self, group, run_namespace)
1188 try:
-> 1189 check_dimensions(str(eq.expr), self.dimensions[var], all_variables)
1190 except DimensionMismatchError as ex:
File c:\Users\parih\anaconda3\lib\site-packages\brian2\equations\unitcheck.py:41, in check_dimensions(expression, dimensions, variables)
20 """
21 Compares the physical dimensions of an expression to expected dimensions in
22 a given namespace.
(...)
39 If an unit mismatch occurs during the evaluation.
40 """
---> 41 expr_dims = parse_expression_dimensions(expression, variables)
42 expected = repr(get_unit(dimensions))
File c:\Users\parih\anaconda3\lib\site-packages\brian2\parsing\expressions.py:382, in parse_expression_dimensions(expr, variables, orig_expr)
379 left_dim = parse_expression_dimensions(
380 expr.left, variables, orig_expr=orig_expr
381 )
--> 382 right_dim = parse_expression_dimensions(
383 expr.right, variables, orig_expr=orig_expr
384 )
385 if op in ["Add", "Sub", "Mod"]:
386 # dimensions should be the same
File c:\Users\parih\anaconda3\lib\site-packages\brian2\parsing\expressions.py:399, in parse_expression_dimensions(expr, variables, orig_expr)
393 error_msg = (
394 f"Expression '{left_str} {op_symbol} {right_str}' uses "
395 f"inconsistent units ('{left_str}' has unit "
396 f"{left_unit}; '{right_str}' "
397 f"has unit {right_unit})."
398 )
--> 399 raise DimensionMismatchError(error_msg)
400 u = left_dim
DimensionMismatchError: Expression '(2.0 * mV) * exp((((- 53.5) * mV) - Vd) / (27.0 * mV)) - alphacd' uses inconsistent units ('(2.0 * mV) * exp((((- 53.5) * mV) - Vd) / (27.0 * mV))' has unit V; 'alphacd' has unit Hz).