Exemplo n.º 1
0
    def write(self, file, flatten=True):  # @ReservedAssignment
        """Export this model to an XML file.

        :params file: A filename or fileobject
        :params flatten: Boolean specifying whether the component should be
            flattened before saving

        """
        from nineml.abstraction_layer.dynamics.writers import XMLWriter
        return XMLWriter.write(component=self, file=file, flatten=flatten)
Exemplo n.º 2
0
model = al.DynamicsClass(
    name="AlphaPSR",
    aliases=["Isyn := A"],
    regimes=[
        al.Regime(
            name="default",
            time_derivatives=[
                "dA/dt = B - A/tau_syn",
                "dB/dt = (-B)/tau_syn"],
            transitions=al.On('spike',
                              do=["B = B + q"]),  # would be nice to allow constant quantities, so we could make q dimensionless
        )
    ],
    state_variables=[
        al.StateVariable('A', dimension=current),
        al.StateVariable('B', dimension=current),
    ],
    analog_ports=[al.AnalogSendPort("Isyn", dimension=current),
                  al.AnalogSendPort("A", dimension=current),
                  al.AnalogSendPort("B", dimension=current),
                  al.AnalogReceivePort("q", dimension=current)],
    parameters=[al.Parameter('tau_syn', dimension=time)]
)


if __name__ == "__main__":
    from nineml.abstraction_layer.dynamics.writers import XMLWriter
    filename = __file__[0].upper() + __file__[1:].replace(".py", ".xml")
    XMLWriter.write(model, filename)
Exemplo n.º 3
0
                    "t > t_rpend",
                    #do=[al.OutputEvent('refractoryEnd')],
                    to="subthresholdRegime")
            ],
        )
    ],
    state_variables=[
        al.StateVariable('V', dimension=voltage),
        al.StateVariable('t_rpend', dimension=time)
    ],
    analog_ports=[
        al.AnalogSendPort("V", dimension=voltage),
        al.AnalogSendPort("t_rpend", dimension=time),
        al.AnalogReducePort("Isyn", reduce_op="+", dimension=current)
    ],
    event_ports=[
        al.EventSendPort('spikeOutput'),
    ],
    parameters=[
        al.Parameter('tau', time),
        al.Parameter('theta', voltage),
        al.Parameter('tau_rp', time),
        al.Parameter('Vreset', voltage),
        al.Parameter('R', resistance)
    ])

if __name__ == "__main__":
    from nineml.abstraction_layer.dynamics.writers import XMLWriter
    filename = __file__[0].upper() + __file__[1:].replace(".py", ".xml")
    XMLWriter.write(model, filename)