def __init__(self):
        """Constructor"""

        super(GraupnerBrunelEvaluator, self).__init__()
        # Graupner-Brunel model parameters and boundaries,
        # from (Graupner and Brunel, 2012)
        self.graup_params = [('tau_ca', 1e-3, 100e-3), ('C_pre', 0.1, 20.0),
                             ('C_post', 0.1, 50.0), ('gamma_d', 5.0, 5000.0),
                             ('gamma_p', 5.0, 2500.0), ('sigma', 0.35, 70.7),
                             ('tau', 2.5, 2500.0), ('D', 0.0, 50e-3),
                             ('b', 1.0, 100.0)]

        self.params = [
            bpop.parameters.Parameter(param_name,
                                      bounds=(min_bound, max_bound))
            for param_name, min_bound, max_bound in self.graup_params
        ]

        self.param_names = [param.name for param in self.params]

        self.protocols, self.sg, self.stdev, self.stderr = \
            stdputil.load_neviansakmann()

        self.objectives = [
            bpop.objectives.Objective(protocol.prot_id)
            for protocol in self.protocols
        ]
Example #2
0
def analyse():
    """Generate plot"""

    cp = pickle.load(open(cp_filename, "r"))
    results = (cp["population"], cp["halloffame"], cp["history"], cp["logbook"])

    _, hof, hst, log = results

    best_ind = hof[0]
    best_ind_dict = evaluator.get_param_dict(best_ind)

    print("Best Individual")
    for attribute, value in best_ind_dict.items():
        print("\t{} : {}".format(attribute, value))

    good_solutions = [
        evaluator.get_param_dict(ind)
        for ind in hst.genealogy_history.itervalues()
        if np.all(np.array(ind.fitness.values) < 1)
    ]

    # model_sg = evaluator.compute_synaptic_gain_with_lists(best_ind)

    # Load data
    protocols, sg, _, stderr = stdputil.load_neviansakmann()
    dt = np.array([float(p.prot_id[:3]) for p in protocols])

    plt.rcParams["lines.linewidth"] = 2
    # plot_epspamp_discrete(dt, model_sg, sg, stderr)
    plot_dt_scan(best_ind_dict, good_solutions, dt, sg, stderr)
    plot_calcium_transients(protocols, best_ind_dict)

    plot_log(log)

    plt.show()
Example #3
0
    def __init__(self):
        """Constructor"""

        super(GraupnerBrunelEvaluator, self).__init__()
        # Graupner-Brunel model parameters and boundaries,
        # from (Graupner and Brunel, 2012)
        self.graup_params = [('tau_ca', 1e-3, 100e-3),
                             ('C_pre', 0.1, 20.0),
                             ('C_post', 0.1, 50.0),
                             ('gamma_d', 5.0, 5000.0),
                             ('gamma_p', 5.0, 2500.0),
                             ('sigma', 0.35, 70.7),
                             ('tau', 2.5, 2500.0),
                             ('D', 0.0, 50e-3),
                             ('b', 1.0, 100.0)]

        self.params = [bpop.parameters.Parameter
                       (param_name, bounds=(min_bound, max_bound))
                       for param_name, min_bound, max_bound in self.
                       graup_params]

        self.param_names = [param.name for param in self.params]

        self.protocols, self.sg, self.stdev, self.stderr = \
            stdputil.load_neviansakmann()

        self.objectives = [bpop.objectives.Objective(protocol.prot_id)
                           for protocol in self.protocols]
Example #4
0
def analyse():
    """Generate plot"""

    cp = pickle.load(open(cp_filename, "r"))
    results = (cp["population"], cp["halloffame"], cp["history"], cp["logbook"])

    _, hof, hst, log = results

    best_ind = hof[0]
    best_ind_dict = evaluator.get_param_dict(best_ind)

    print("Best Individual")
    for attribute, value in best_ind_dict.iteritems():
        print("\t{} : {}".format(attribute, value))

    good_solutions = [
        evaluator.get_param_dict(ind)
        for ind in hst.genealogy_history.itervalues()
        if np.all(np.array(ind.fitness.values) < 1)
    ]

    # model_sg = evaluator.compute_synaptic_gain_with_lists(best_ind)

    # Load data
    protocols, sg, _, stderr = stdputil.load_neviansakmann()
    dt = np.array([float(p.prot_id[:3]) for p in protocols])

    plt.rcParams["lines.linewidth"] = 2
    # plot_epspamp_discrete(dt, model_sg, sg, stderr)
    plot_dt_scan(best_ind_dict, good_solutions, dt, sg, stderr)
    plot_calcium_transients(protocols, best_ind_dict)

    plot_log(log)

    plt.show()