How to use the fitter.Simulator function in fitter

To help you get started, we’ve selected a few fitter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openworm / ChannelWorm / channelworm / fitter / Evaluator.py View on Github external
# TODO: Include weights and minimization function (e.g. prAxis)
        # Based on Gurkiewicz & Korngreen approach (doi:10.1371/journal.pcbi.0030169.)

        fitness = 1e10
        total_fitness = []
        Vcost = 0
        Icost = 0
        IVcost = 0
        IVFlag = False
        samples = 0

        for candidate in candidates:
            cand_var = dict(zip(self.bio_params['channel_params'],candidate))
            cell_var = dict(zip(self.bio_params['cell_params'],self.bio_params['val_cell_params']))

            mySimulator = Simulator.Simulator(self.sim_params,cand_var,cell_var)

            if ('VClamp' in self.sampleData) or (('IV' in self.sampleData) and (('VClamp' and 'IClamp') not in self.sampleData)):

                VClampSim_t,VClampSim_I,VClampSim_Vmax,VClampSim_Imax = mySimulator.VClamp()
                tempCost = 0
                M = 0
                N = 0

                if 'VClamp' in self.sampleData:

                    for trace in self.sampleData['VClamp']['traces']:
                        index = int((trace['vol'] - self.sim_params['protocol_start']) / self.sim_params['protocol_steps'])
                        if VClampSim_I[index] :
                            tempCost , N = self.cost([VClampSim_t,VClampSim_I[index]],[trace['t'],trace['I']])
                            Vcost += tempCost
                            N += N