Exemplo n.º 1
0
def uq_medaka():
    """
    Perform the uncertainty quantification and sensitivity analysis of the
    medaka model.

    Returns
    -------
    data : uncertainpy.Data
        A data object that contains the results from the uncertainty
        quantification of the rat model.
    """
    parameters = {
        "g_K": 4.18e-4,
        "g_Ca": 6.25e-5,
        "g_SK": 4e-4,
        "g_l": 2e-5,
        "g_BK": 3.13e-4,
        "g_Na": 2.19e-2,
    }
    parameters = un.Parameters(parameters)

    # Set all parameters to have a uniform distribution
    # within a +/- 50% interval around their original value
    parameters.set_all_distributions(un.uniform(1))

    # Set full g_BK distribution
    parameters["g_BK"].distribution = cp.Uniform(0, 3.13e-4)

    # Initialize the features
    features = un.SpikingFeatures(
        new_features=[is_bursting, is_regular, is_not_spiking],
        features_to_run=features_to_run,
        logger_level="error",
        strict=False,
        threshold=0.55,
        end_threshold=-0.1,
        normalize=True,
        trim=False,
        min_amplitude=min_spike_amplitude,
    )

    # Initialize the model and defining default options
    model = un.NeuronModel(file="medaka.py", name="medaka", ignore=True)

    # Perform the uncertainty quantification
    UQ = un.UncertaintyQuantification(model,
                                      parameters=parameters,
                                      features=features)

    # We set the seed to easier be able to reproduce the result
    data = UQ.quantify(
        seed=10,
        filename="medaka",
        polynomial_order=polynomial_order,
        save=True,
        plot=None,
    )

    return data
def perform_uncertainty_analysis():
    """
    Perform an uncertainty quantification and sensitivity analysis of the model.

    Returns
    -------
    data : uncertainpy.Data object
        The results from the uncertainty quantification.
    """
    parameters = {
        "g_K": scale_conductance(G_K),
        "g_Ca": scale_conductance(G_Ca),
        "g_SK": scale_conductance(G_SK),
        "g_l": scale_conductance(G_l),
        "g_BK": scale_conductance(0.67)
    }  # Temporary value

    parameters = un.Parameters(parameters)

    # Set all conductances to have a uniform distribution
    # within a +/- 50% interval around their original value
    parameters.set_all_distributions(un.uniform(1))

    parameters["g_BK"].distribution = cp.Uniform(scale_conductance(0),
                                                 scale_conductance(1))

    # Initialize features with the correct algorithm
    features = un.SpikingFeatures(new_features=burstiness_factor,
                                  strict=False,
                                  logger_level="error",
                                  features_to_run=features_to_run,
                                  threshold=0.55,
                                  end_threshold=-0.1,
                                  normalize=True,
                                  trim=False,
                                  min_amplitude=min_spike_amplitude)

    # Initialize the model and define default options
    model = un.NeuronModel(file="tabak.py",
                           name="tabak",
                           discard=discard,
                           noise_amplitude=noise_amplitude,
                           simulation_time=simulation_time,
                           ignore=True)

    # Perform the uncertainty quantification
    UQ = un.UncertaintyQuantification(model,
                                      parameters=parameters,
                                      features=features)

    # We set the seed to be able to reproduce the result
    data = UQ.quantify(seed=10,
                       plot=None,
                       data_folder=data_folder,
                       polynomial_order=polynomial_order)

    return data
Exemplo n.º 3
0
def go(parameter_list=[["a", 0.02, None], ["b", 0.2, None], ["c", -65, None],
                       ["d", 8, None]]):

    # Create the parameters
    parameters = un.Parameters(parameter_list)

    # Set all parameters to have a uniform distribution
    # within a 50% interval around their fixed value
    parameters.set_all_distributions(un.uniform(0.5))

    # Create a model from coffee_cup function and add labels
    model = un.Model(izhikevich, labels=["Time (ms)", "Voltage (mV)"])

    # Initialize features
    features = un.SpikingFeatures(features_to_run="all")

    # Perform the uncertainty quantification
    UQ = un.UncertaintyQuantification(model=model,
                                      parameters=parameters,
                                      features=features)
    data = UQ.quantify()
Exemplo n.º 4
0
        super(NeuronModelBahl, self).__init__(adaptive=True,
                                              path="bahl_neuron_model",
                                              stimulus_start=stimulus_start,
                                              stimulus_end=stimulus_end)

    # Reimplement the set_parameters method used by run
    def set_parameters(self, parameters):
        for parameter in parameters:
            self.h(parameter + " = " + str(parameters[parameter]))

        # These commands must be added for this specific
        # model to recalculate the parameters after they have been set
        self.h("recalculate_passive_properties()")
        self.h("recalculate_channel_densities()")


# Initialize the model with the start and end time of the stimulus
model = NeuronModelBahl(stimulus_start=100, stimulus_end=600)

# Define a parameter list and use it directly
parameters = {"e_pas": -80, cp.Uniform(-60, -85),
              "apical Ra": 261, cp.Uniform(150, 300)}

# Initialize the features
features = un.SpikingFeatures()

# Perform the uncertainty quantification
UQ = un.UncertaintyQuantification(model=model,
                                  parameters=parameters,
                                  features=features)
data = UQ.quantify()
Exemplo n.º 5
0
import uncertainpy as un
from izhikevich_class import Izhikevich

# Define a parameter list
parameter_list = [["a", 0.02, None], ["b", 0.2, None], ["c", -65, None],
                  ["d", 8, None]]

# Create the parameters
parameters = un.Parameters(parameter_list)

# Set all parameters to have a uniform distribution
# within a 50% interval around their fixed value
parameters.set_all_distributions(un.uniform(0.5))

# Initialize the model
model = Izhikevich()
features = un.SpikingFeatures(features_to_run="all")

# Perform the uncertainty quantification
UQ = un.UncertaintyQuantification(model=model,
                                  parameters=parameters,
                                  features=features)
data = UQ.quantify()