Skip to content

Added 1.0 release to docs and cleaned up "FIXME"s #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions doc/source/releases/1.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
=================
:mod:`nineml` 1.0
=================

|date|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will this include? The date when the documentation was built?


The first public release of the Python :mod:`nineml` package,
which corresponds to the release of version 1.0 of the
`NineML specification`_.

.. _`NineML specification`: http://nineml-spec.readthedocs.io/
.. |date| date:: %x
1 change: 1 addition & 0 deletions doc/source/releases/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ All released NineML Python versions:
:maxdepth: 1

1.0rc1
1.0
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def _flatten_dims(self, expr, element):
for arg in expr.args:
dims = self._flatten_dims(arg, element)
# boolean expression == 0
if dims != 0 and dims != 1: # FIXME: allow dimless until bool params @IgnorePep8
if dims != 0 and dims != 1:
raise NineMLDimensionError(self._construct_error_message(
"Logical expression provided non-boolean argument '{}'"
.format(arg), dims, expr))
Expand Down
4 changes: 0 additions & 4 deletions nineml/abstraction/dynamics/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ def __init__(self, name, parameters=(), ports=(), analog_ports=(),

# Set and check event send ports match inferred
if self.num_event_send_ports:
# FIXME: not all OutputEvents are necessarily exposed as Ports,
# so really we should just check that all declared output event
# ports are in the list of inferred ports, not that the declared
# list is identical to the inferred one.
check_inferred_against_declared(
self.event_send_port_names,
inferred_struct.event_out_port_names,
Expand Down
11 changes: 7 additions & 4 deletions nineml/abstraction/dynamics/visitors/validators/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
DimensionalityComponentValidator)
from ..base import BaseDynamicsVisitor
import nineml.units as un
import logging

logger = logging.getLogger('NineML')


class TimeDerivativesAreDeclaredDynamicsValidator(BaseDynamicsVisitor):
Expand Down Expand Up @@ -119,10 +122,10 @@ def __init__(self, component_class, **kwargs): # @UnusedVariable
# Recursively add all regimes connected to the first regime
self._add_connected_regimes_recursive(first_regime)
if len(self.connected) < len(self.regimes):
# FIXME: This should probably be a warning not an error
raise NineMLUsageError(
"Transition graph of {} contains islands: {} regimes "
"('{}') and {} connected ('{}'):\n\n{}".format(
logger.warning(
"Transition graph of {} contains islands: {} "
"regimes ('{}') and {} connected ('{}'):\n\n{}"
.format(
component_class,
len(self.regimes),
"', '".join(r.name for r in self.regimes),
Expand Down
2 changes: 1 addition & 1 deletion nineml/abstraction/expressions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

builtin_constants = set(['true', 'false', 'True', 'False'])
builtin_functions = set([
'exp', 'sin', 'cos', 'log', 'log10', 'pow', 'abs',
'exp', 'sin', 'cos', 'tan', 'log', 'log10', 'pow', 'abs',
'sinh', 'cosh', 'tanh', 'sqrt', 'mod', # 'sum',
'atan', 'asin', 'acos', 'asinh', 'acosh', 'atanh', 'atan2'])
reserved_symbols = set(['t'])
Expand Down
7 changes: 4 additions & 3 deletions nineml/abstraction/ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class DimensionedPort(

def __init__(self, name, dimension=None):
super(DimensionedPort, self).__init__(name)
self._dimension = dimension if dimension is not None else dimensionless # TODO: This needs checking @IgnorePep8
self._dimension = (dimension if dimension is not None
else dimensionless)

@property
def dimension(self):
Expand Down Expand Up @@ -115,7 +116,7 @@ class SendPort(SendPortBase):

Base class for sending ports
"""
mode = "send" # FIXME: This is here for legacy unittest I think (TGC 1/15)
mode = "send"

def is_incoming(self):
return False
Expand All @@ -129,7 +130,7 @@ class ReceivePort(object):

Base class for receiving ports
"""
mode = "recv" # FIXME: This is here for legacy unittest I think (TGC 1/15)
mode = "receive"

def is_incoming(self):
return True
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/abstraction_test/dynamics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_analog_ports(self):

c = Dynamics(name='C1', analog_ports=[AnalogReceivePort('B')])
self.assertEqual(len(list(c.analog_ports)), 1)
self.assertEqual(list(c.analog_ports)[0].mode, 'recv')
self.assertEqual(list(c.analog_ports)[0].mode, 'receive')
self.assertEqual(len(list(c.analog_send_ports)), 0)
self.assertEqual(len(list(c.analog_receive_ports)), 1)
self.assertEqual(len(list(c.analog_reduce_ports)), 0)
Expand Down
8 changes: 1 addition & 7 deletions test/unittests/units_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def test_accessors(self):
self.assertEqual(getattr(dim, abbrev), dim._dims[i])
self.assertEqual(getattr(dim, name), dim._dims[i])

# FIXME: Currently the 'scale' attribute isn't supported, need to work out
# whether we want to do this or not.

units_xml_str = """<?xml version="1.0" encoding="UTF-8"?>
<NineML xmlns="http://nineml.net/9ML/2.0">
<Annotations>
Expand Down Expand Up @@ -74,11 +73,6 @@ def test_accessors(self):
<Unit symbol="Hz" dimension="per_time" power="0"/>
<Unit symbol="ms" dimension="time" power="-3"/>
<Unit symbol="per_ms" dimension="per_time" power="3"/>
<!--<Unit symbol="min" dimension="time" power="0" scale="60"/>
<Unit symbol="per_min" dimension="per_time" power="0" scale="0.01666666667"/>
<Unit symbol="hour" dimension="time" power="0" scale="3600"/>
<Unit symbol="per_hour" dimension="per_time" power="0"
scale="0.00027777777778"/>-->
<Unit symbol="m" dimension="length" power="0"/>
<Unit symbol="cm" dimension="length" power="-2"/>
<Unit symbol="um" dimension="length" power="-6"/>
Expand Down