Esempio n. 1
0
    def clckGenerateTemplate(self, event):
        try:
            noi = int(self.txtNOI.GetValue())
        except:
            noi = 0

        area = self.txtDefArea.GetValue()
        stat_opts = self.chStatOpts.GetStringSelection()

        strByp = ''

        if self.cbByp1.GetValue():
            strByp += '1,'
        if self.cbByp2.GetValue():
            strByp += '2,'
        if self.cbByp3.GetValue():
            strByp += '3,'
        if self.cbByp4.GetValue():
            strByp += '4,'
        if self.cbByp5.GetValue():
            strByp += '5,'
        if self.cbByp6.GetValue():
            strByp += '6,'
        if self.cbByp7.GetValue():
            strByp += '7,'
        if self.cbByp8.GetValue():
            strByp += '8,'
        if self.cbByp9.GetValue():
            strByp += '9,'

        if len(strByp) > 0:
            strByp = strByp[0:len(strByp) - 1]

        if self.cbExtBypPerm.GetValue():
            ext_byp_perm = "Yes"
        else:
            ext_byp_perm = "No"

        dlg = wx.FileDialog(self,
                            message=text.MsgSaveXLSFile,
                            defaultDir=os.getcwd(),
                            defaultFile="",
                            wildcard=config.xlsWildcard,
                            style=wx.SAVE)

        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()

            template.create(path, noi, area, stat_opts, strByp, ext_byp_perm)
Esempio n. 2
0
def create(etype, runopt=False, altmorph=None):
    """Setup"""

    with open(
            os.path.join(os.path.dirname(__file__), '..',
                         'config/recipes.json')) as f:
        recipe = json.load(f)

    prot_path = recipe[etype]['protocol']

    cell = template.create(recipe, etype, altmorph)

    protocols_dict = define_protocols(prot_path, runopt)

    fitness_calculator, efeatures = define_fitness_calculator(
        protocols_dict, recipe[etype]['features'])

    fitness_protocols = protocols_dict

    param_names = [
        param.name for param in cell.params.values() if not param.frozen
    ]

    nrn_sim = ephys.simulators.NrnSimulator(cvode_active=True)

    cell_eval = ephys.evaluators.CellEvaluator(
        cell_model=cell,
        param_names=param_names,
        fitness_protocols=fitness_protocols,
        fitness_calculator=fitness_calculator,
        sim=nrn_sim,
        use_params_for_seed=True)

    return cell_eval
Esempio n. 3
0
 def test_create(self):
     name = "test_bla.py"
     res = template.create(name)
     self.assertIn("import unittest", res)
     self.assertIn("import bla", res)
     self.assertNotIn("import bla.py", res)
     self.assertIn("class TestBla", res)
     self.assertNotIn("class TestBla.py", res)
Esempio n. 4
0
 def test_create_long_file_name(self):
     name = "test_long_file_name.py"
     res = template.create(name)
     self.assertIn("import long_file_name", res)
     self.assertNotIn("import long_file_name.py", res)
     self.assertNotIn("import test_long_file_name", res)
Esempio n. 5
0
 def create(self):
     if self.source_file is not None:
         add_if_missing(self.source_file)
     if self.test_file is not None:
         add_if_missing(self.test_file,
                        template.create(self.test_file.basename))
Esempio n. 6
0
import template
import params
import network
import mapping
import instance
import output
import security

template = template.create()

keyname = params.keyname(template)
mapping.add(template)
vpc = network.vpc(template)
subnet = network.subnet(template, vpc)
gateway = network.attach_internet_gateway(template, vpc)
dhcp = network.attach_dhcp_options(template, vpc)
acl = network.attach_acl(template, vpc, subnet)
routetable = network.attach_route_table(template, vpc, subnet, gateway)
secgroup = network.attach_security_group(template, vpc)
role = security.role(template)

sg1 = instance.addSearchGuard(template, role, subnet, keyname, secgroup,
                              "node1")
sg2 = instance.addSearchGuard(template, role, subnet, keyname, secgroup,
                              "node2")
sg3 = instance.addSearchGuard(template, role, subnet, keyname, secgroup,
                              "node3")
output.add(template, [sg1, sg2, sg3])

print(template.to_json())