INCF/nineml-spec

Reintroducing the 'Quantity' element

tclose opened this issue · 1 comments

In editing earlier versions of the spec I removed the Quantity element as it seemed superfluous i.e. I changed

<Component name="Foo">
  <Definition>Bar</Definition>
  <Property name="param1">
    <Quantity units="mV">
      <SingleValue>-60.0</SingleValue>
    </Quantity>
  </Property>
  <Property name="param2">
    <Quantity units="pA">
      <SingleValue>10.0</SingleValue>
    </Quantity>
  </Property>
</Component>

to

<Component name="Foo">
  <Definition>Bar</Definition>
  <Property name="param1" units="mV">
      <SingleValue>-60.0</SingleValue>
  </Property>
  <Property name="param2" units="uF_per_mm2">
      <SingleValue>1.0</SingleValue>
  </Property>
</Component>

However, I am starting to think Andrew's suggestion in the recent meeting of reintroducing the Quantity tag in order to handle the introduction of "Generators" and PropertySendPorts, which will already provide the dimension of the value passed to the component, was a very good one, e.g.

<Component name="Foo">
  <Definition>Bar</Definition>
  <Property name="param1">
    <Quantity units="mV">
      <SingleValue>-60.0</SingleValue>
    </Quantity>
  </Property>
  <Property name="param2">
    <FromGenerator port="membraneCapacitance">
      <Reference url="http://nineml.net/catalog/1.0/NormallyDistributedCapacitance.xml">NormallyDistributedCapacitance</Reference>
      <Property name="mean">
        <Quantity units="none">
          <SingleValue>20.0</SingleValue>
        </Quantity>
      </Property>
      <Property name="variance">
        <Quantity units="none">
          <SingleValue>2.0</SingleValue>
        </Quantity>
      </Property>
    </FromGenerator>
  </Property>
</Component>

This example also raises another possible use for using Quantity elements, which could be to wrap dimensionless PropertySendPorts to avoid having to recreate new generators for combination of type of random distribution and unit dimension e.g.

<Component name="Foo">
  <Definition>Bar</Definition>
  <Property name="param1">
    <Quantity units="mV">
      <SingleValue>-60.0</SingleValue>
    </Quantity>
  </Property>
  <Property name="param2">
    <Quantity units="uF_per_mm2">
      <FromGenerator port="membraneCapacitance">
        <Reference url="http://nineml.net/catalog/1.0/NormalDistribution.xml">NormalDistribution</Reference>
        <Property name="mean">
          <Quantity units="none">
            <SingleValue>20.0</SingleValue>
          </Quantity>
        </Property>
        <Property name="variance">
          <Quantity units="none">
            <SingleValue>2.0</SingleValue>
          </Quantity>
        </Property>
      </FromGenerator>
    </Quantity>
  </Property>
</Component>

Another solution would be to make PropertySendPorts dimensionless, however I think in more complex examples you may want to generate related values of different dimensions, (weight and delays for example), although perhaps there would be other ways around this.

For dimensionless quantities the Quantity tag could potentially be dropped (especially for integer values) although this could make the parsing a little more complex.

Quantity elements would also be used in the State Layer, e.g.

<DynamicsState name="initialState">
  <Reference>Foo</Reference>
  <InRegime name="subthreshold"/>
  <StateValue name="V">
    <Quantity units="mV">
      <SingleValue>-65.0</SingleValue>
    </Quantity>
  </StateValue>
</DynamisState>