def submitNoiseSweep(p,
                     gEp,
                     gIp,
                     noisep,
                     ENV,
                     simRootDir,
                     simLabel,
                     appName,
                     rtLimit,
                     numCPU,
                     blocking,
                     timePrefix,
                     numRepeat,
                     dry_run,
                     extraIterparams=None):
    '''
    Submit a parameter sweep with an extra dimension: noise_sigma.
    '''
    if extraIterparams is None:
        extraIterparams = {}
    noise_sigma_arr = []
    g_AMPA_total_arr = []
    g_GABA_total_arr = []
    for n in noisep.values():
        for E_coupling in gEp.values():
            for I_coupling in gIp.values():
                noise_sigma_arr.append(n)
                g_AMPA_total_arr.append(E_coupling)
                g_GABA_total_arr.append(I_coupling)

    iterparams = {
        'noise_sigma': np.array(noise_sigma_arr),
        'g_AMPA_total': np.array(g_AMPA_total_arr),
        'g_GABA_total': np.array(g_GABA_total_arr),
        #'noise_sigma'  : [150],
        #'g_AMPA_total' : [1020],
        #'g_GABA_total' : [3060]
    }
    iterparams.update(extraIterparams)
    ac = ArgumentCreator(p, printout=True)
    ac.insertDict(iterparams, mult=False)

    ###############################################################################
    submitter = SubmitterFactory.getSubmitter(ac,
                                              appName,
                                              envType=ENV,
                                              rtLimit=rtLimit,
                                              output_dir=simRootDir,
                                              label=simLabel,
                                              blocking=blocking,
                                              timePrefix=timePrefix,
                                              numCPU=numCPU)
    ac.setOption('output_dir', submitter.outputDir())
    startJobNum = 0
    submitter.submitAll(startJobNum, numRepeat, dry_run=dry_run)
    submitter.saveIterParams(iterparams, None, None, dry_run=dry_run)
示例#2
0
    def run(self):
        '''Run the parameter sweep.'''
        if self.parser.options is None:
            self.parser.parse_args()
        o = self.parser.options

        for noise_sigma in self.parser.noise_sigmas:
            p = self._dp.copy()
            p['noise_sigma'] = noise_sigma  # pA
            p['time'] = 10e3 if o.time is None else o.time  # ms

            p['nthreads'] = 1
            p['ntrials'] = o.ntrials
            p['verbosity'] = o.verbosity

            p.update(self._up)

            # Submitting
            iterparams = self.parser.iter_params
            if self._slope_selector is not None:
                iterparams.update({
                    'bumpCurrentSlope':
                    self._slope_selector.get_slopes(noise_sigma)
                })
            ac = ArgumentCreator(p, printout=True)
            ac.insertDict(iterparams, mult=False)

            ###################################################################
            simLabel = '{0}pA'.format(int(p['noise_sigma']))
            numRepeat = 1
            submitter = SubmitterFactory.getSubmitter(ac,
                                                      self._app_name,
                                                      envType=o.env,
                                                      rtLimit=o.rtLimit,
                                                      output_dir=o.where,
                                                      label=simLabel,
                                                      blocking=True,
                                                      timePrefix=False,
                                                      numCPU=o.nCPU)
            ac.setOption('output_dir', submitter.outputDir())
            startJobNum = 0
            submitter.submitAll(startJobNum,
                                numRepeat,
                                dry_run=o.dry_run,
                                filter=self.parser.flat_filter)
            submitter.saveIterParams(iterparams,
                                     self.parser.options.param_list,
                                     self.parser.dimensions,
                                     dry_run=o.dry_run)
示例#3
0
    def run(self):
        """Run the parameter sweep."""
        if self.parser.options is None:
            self.parser.parse_args()
        o = self.parser.options

        for noise_sigma in self.parser.noise_sigmas:
            p = self._dp.copy()
            p["noise_sigma"] = noise_sigma  # pA
            p["time"] = 10e3 if o.time is None else o.time  # ms

            p["nthreads"] = 1
            p["ntrials"] = o.ntrials
            p["verbosity"] = o.verbosity

            p.update(self._up)

            # Submitting
            iterparams = self.parser.iter_params
            if self._slope_selector is not None:
                iterparams.update({"bumpCurrentSlope": self._slope_selector.get_slopes(noise_sigma)})
            ac = ArgumentCreator(p, printout=True)
            ac.insertDict(iterparams, mult=False)

            ###################################################################
            simLabel = "{0}pA".format(int(p["noise_sigma"]))
            numRepeat = 1
            submitter = SubmitterFactory.getSubmitter(
                ac,
                self._app_name,
                envType=o.env,
                rtLimit=o.rtLimit,
                output_dir=o.where,
                label=simLabel,
                blocking=True,
                timePrefix=False,
                numCPU=o.nCPU,
            )
            ac.setOption("output_dir", submitter.outputDir())
            startJobNum = 0
            submitter.submitAll(startJobNum, numRepeat, dry_run=o.dry_run, filter=self.parser.flat_filter)
            submitter.saveIterParams(
                iterparams, self.parser.options.param_list, self.parser.dimensions, dry_run=o.dry_run
            )
def submitNoiseSweep(p, gEp, gIp, noisep,
                     ENV, simRootDir, simLabel, appName, rtLimit, numCPU,
                     blocking, timePrefix, numRepeat, dry_run,
                     extraIterparams=None):
    '''
    Submit a parameter sweep with an extra dimension: noise_sigma.
    '''
    if extraIterparams is None:
        extraIterparams = {}
    noise_sigma_arr  = []
    g_AMPA_total_arr = []
    g_GABA_total_arr = []
    for n in noisep.values():
        for E_coupling in gEp.values():
            for I_coupling in gIp.values():
                noise_sigma_arr.append(n)
                g_AMPA_total_arr.append(E_coupling)
                g_GABA_total_arr.append(I_coupling)


    iterparams = {
        'noise_sigma'  : np.array(noise_sigma_arr),
        'g_AMPA_total' : np.array(g_AMPA_total_arr),
        'g_GABA_total' : np.array(g_GABA_total_arr),
        #'noise_sigma'  : [150],
        #'g_AMPA_total' : [1020],
        #'g_GABA_total' : [3060]
    }
    iterparams.update(extraIterparams)
    ac = ArgumentCreator(p, printout=True)
    ac.insertDict(iterparams, mult=False)

    ###############################################################################
    submitter = SubmitterFactory.getSubmitter(ac, appName, envType=ENV,
                                              rtLimit=rtLimit,
                                              output_dir=simRootDir,
                                              label=simLabel,
                                              blocking=blocking,
                                              timePrefix=timePrefix,
                                              numCPU=numCPU)
    ac.setOption('output_dir', submitter.outputDir())
    startJobNum = 0
    submitter.submitAll(startJobNum, numRepeat, dry_run=dry_run)
    submitter.saveIterParams(iterparams, None, None, dry_run=dry_run)
    p["verbosity"] = o.verbosity
    p["forceUpdate"] = int(o.forceUpdate)

    if p["type"] == common.velocityType:
        percentile = 99.0
        p["bumpSpeedMax"] = getSpeedPercentile(percentile, dp["ratVelFName"], dp["gridSep"], dp["Ne"])

    ###############################################################################

    ac = ArgumentCreator(p, printout=True)

    iterparams = {
        "row": np.arange(rowN) if o.row is None else [o.row],
        "col": np.arange(colN) if o.col is None else [o.col],
    }
    ac.insertDict(iterparams, mult=True)

    ###############################################################################
    submitter = SubmitterFactory.getSubmitter(
        ac,
        appName,
        envType=ENV,
        rtLimit=rtLimit,
        output_dir=simRootDir,
        label=simLabel,
        blocking=blocking,
        timePrefix=timePrefix,
        numCPU=numCPU,
        ignoreSubmitErrors=o.ignoreErrors,
    )
    ac.setOption("output_dir", submitter.outputDir())
    p['Iext_e_theta'] = 0       # pA
    p['Iext_i_theta'] = 0       # pA

    # Here, no PC inputs
    p['pc_start_max_rate'] = .0  # Hz

    p['prefDirC_e'] = 0.

    explored_param = np.arange(o.param_start, o.param_stop + o.param_step,
                               o.param_step)
    dummy = explored_param * 0. + p['prefDirC_e']
    iterparams = {
        'prefDirC_e': dummy,
        o.explored_param: explored_param
    }
    dimension_labels = ['prefDirC_e', o.explored_param]
    dimensions = [1, len(explored_param)]
    ac = ArgumentCreator(p, printout=True)
    ac.insertDict(iterparams, mult=False)

    ###########################################################################
    submitter = SubmitterFactory.getSubmitter(
        ac, appName, envType=ENV, rtLimit=rtLimit, output_dir=simRootDir,
        label=simLabel, blocking=blocking, timePrefix=timePrefix,
        numCPU=numCPU)
    ac.setOption('output_dir', submitter.outputDir())
    startJobNum = 0
    submitter.submitAll(startJobNum, numRepeat, dry_run=dry_run)
    submitter.saveIterParams(iterparams, dimension_labels, dimensions,
                             dry_run=dry_run)
###############################################################################
ac = ArgumentCreator(p, printout=True)

GArr = np.linspace(startG, endG, Nvals)
g_AMPA_total_arr = []
g_GABA_total_arr = []
for coupling in GArr:
    g_AMPA_total_arr.append(coupling)
    g_GABA_total_arr.append(coupling)

iterparams = {
    'g_AMPA_total': np.array(g_AMPA_total_arr),
    'g_GABA_total': np.array(g_GABA_total_arr),
}
ac.insertDict(iterparams, mult=False)

###############################################################################
submitter = SubmitterFactory.getSubmitter(ac,
                                          appName,
                                          envType=ENV,
                                          rtLimit=rtLimit,
                                          output_dir=simRootDir,
                                          label=simLabel,
                                          blocking=blocking,
                                          timePrefix=timePrefix,
                                          numCPU=numCPU)
ac.setOption('output_dir', submitter.outputDir())
startJobNum = 0
submitter.submitAll(startJobNum, numRepeat, dry_run=dry_run)
submitter.saveIterParams(iterparams, ['g_total'], [1], dry_run=dry_run)
示例#8
0
def submitParamSweep(p,
                     startG,
                     endG,
                     Nvals,
                     ENV,
                     simRootDir,
                     simLabel,
                     appName,
                     rtLimit,
                     numCPU,
                     blocking,
                     timePrefix,
                     numRepeat,
                     dry_run,
                     extraIterparams=None,
                     rc=None,
                     **kwargs):
    '''Submit and save metadata for the gE vs gI parameter sweep.'''
    printout = kwargs.pop('printout', True)
    if extraIterparams is None:
        extraIterparams = {}
    ac = ArgumentCreator(p, printout=printout)

    GArr = np.linspace(startG, endG, Nvals)
    print(GArr)

    g_AMPA_total_arr = []
    g_GABA_total_arr = []
    for E_coupling in GArr:
        for I_coupling in GArr:
            g_AMPA_total_arr.append(E_coupling)
            g_GABA_total_arr.append(I_coupling)

    iterparams = {
        'g_AMPA_total': np.array(g_AMPA_total_arr),
        'g_GABA_total': np.array(g_GABA_total_arr),
    }
    dimension_labels = ['g_AMPA_total', 'g_GABA_total']
    dimensions = [Nvals, Nvals]
    iterparams.update(extraIterparams)
    ac.insertDict(iterparams, mult=False)

    ###############################################################################
    submitter = SubmitterFactory.getSubmitter(ac,
                                              appName,
                                              envType=ENV,
                                              rtLimit=rtLimit,
                                              output_dir=simRootDir,
                                              label=simLabel,
                                              blocking=blocking,
                                              timePrefix=timePrefix,
                                              numCPU=numCPU,
                                              **kwargs)
    ac.setOption('output_dir', submitter.outputDir())
    startJobNum = 0
    filter = rc[0] * len(GArr) + rc[1] if rc is not None else None
    submitter.submitAll(startJobNum, numRepeat, dry_run=dry_run, filter=filter)
    submitter.saveIterParams(iterparams,
                             dimension_labels,
                             dimensions,
                             dry_run=dry_run)
示例#9
0
    colN = shape[1]

    p['type'] = o.type
    p['shapeRows'] = rowN
    p['shapeCols'] = colN
    p['verbosity'] = o.verbosity
    p['figure_dir'] = o.figure_dir

    ##########################################################################
    ac = ArgumentCreator(p, printout=True)

    iterparams = {
        'row': np.arange(rowN) if o.row is None else [o.row],
        'col': np.arange(colN) if o.col is None else [o.col]
    }
    ac.insertDict(iterparams, mult=True)

    ##########################################################################
    submitter = SubmitterFactory.getSubmitter(
        ac,
        appName,
        envType=ENV,
        rtLimit=rtLimit,
        output_dir=simRootDir,
        label=simLabel,
        blocking=blocking,
        timePrefix=timePrefix,
        numCPU=numCPU,
        ignoreSubmitErrors=o.ignoreErrors)
    ac.setOption('output_dir', submitter.outputDir())
    startJobNum = 0