Beispiel #1
0
    def __init__(self):

        self.age = 0
        self.T = 300
        self.Args = Args()
        self.graph_snode = collections.OrderedDict()
        self.graph_node = collections.OrderedDict()
        self.graph_edge = collections.OrderedDict()
        self.material = collections.OrderedDict()

        self.n = None  # node num
        self.e = None  # edge num
        self.s = None  # space num
        self.v = None  # voltage num
        self.m = None  # material num

        self.s_matrix = None  # space-node matrix
        self.m_matrix = None  # material-node matrix

        self.x = None  # density of node
        self.x_s = None  # space size of node
        self.e_x = None  # e^x
        self.k1 = None  # k1
        self.k2 = None  # k2
        self.k3 = None  # k3
        self.k4 = None  # k4
        self.k5 = None  # k5

        self.init_materials = None
Beispiel #2
0
	def __init__(self, graph):

		self.Utill = Utill()
		self.Args = Args()
		self.Calculater = Calculater(self.Utill)
		self.graph = graph
		self.socketIO = SocketIO('localhost',3030)
Beispiel #3
0
 def testInvalidDouble(self):
     try:
         Args("x##", ["-x", "Forty two"])
         self.fail("Args constructor should have thrown exception")
     except ArgsException as e:
         self.assertEqual(ArgsException.ErrorCode.INVALID_DOUBLE,
                          e.getErrorCode())
Beispiel #4
0
    def __init__(self, vector=None, time=0):

        self.Args = Args()
        self.dim = self.Args.dim
        if vector is not None: self.psi = vector
        else: vector = np.zeros(self.dim)
        self.time = 0
        self.history = list()
Beispiel #5
0
    def __init__(self):

        self.Args = Args()
        self.cash_regist_list = self.Args.cash_regist_list
        self.cash = self.cash_regist()
        self.db_root_path = self.db_root_path_load()
        self.db_name_filter_key = self.Args.db_name_filter_key
        self.RDF_function = dict()
Beispiel #6
0
 def testNonLetterSchema(self):
     try:
         Args("*", [])
         self.fail("Args constructor should have thrown exception")
     except ArgsException as e:
         self.assertEqual(ArgsException.ErrorCode.INVALID_ARGUMENT_NAME,
                          e.getErrorCode())
         self.assertEqual("*", e.getErrorArgumentId())
Beispiel #7
0
 def testInvalidArgumentFormat(self):
     try:
         Args("f~", [])
         self.fail("Args constructor should have thrown exception")
     except ArgsException as e:
         self.assertEqual(ArgsException.ErrorCode.INVALID_FORMAT,
                          e.getErrorCode())
         self.assertEqual("f", e.getErrorArgumentId())
Beispiel #8
0
 def testMissingDouble(self):
     try:
         Args("x##", ["-x"])
         self.fail("Args constructor should have thrown exception")
     except ArgsException as e:
         self.assertEqual(ArgsException.ErrorCode.MISSING_DOUBLE,
                          e.getErrorCode())
         self.assertEqual("x", e.getErrorArgumentId())
Beispiel #9
0
 def testMissingStringArgument(self):
     try:
         args = Args("x*", ["-x"])
         self.fail("Args constructor should have thrown exception")
     except ArgsException as e:
         self.assertEqual(ArgsException.ErrorCode.MISSING_STRING,
                          e.getErrorCode())
         self.assertEqual("x", e.getErrorArgumentId())
Beispiel #10
0
 def testWithNoSchemaButWithOneArgument(self):
     try:
         Args("", ["-x"])
         self.fail(
             "Expect ArgsException in testWithNoSchemaButWithOneArgument")
     except ArgsException as e:
         self.assertEqual(ArgsException.ErrorCode.UNEXPECTED_ARGUMENT,
                          e.getErrorCode())
         self.assertEqual("x", e.getErrorArgumentId())
Beispiel #11
0
 def testInvalidInteger(self):
     try:
         Args("x#", ["-x", "Forty two"])
         self.fail("Args constructor should have thrown exception")
     except ArgsException as e:
         self.assertEqual(ArgsException.ErrorCode.INVALID_INTEGER,
                          e.getErrorCode())
         self.assertEqual("x", e.getErrorArgumentId())
         self.assertEqual("Forty two", e.getErrorParameter())
Beispiel #12
0
	def __init__(
		self, 
		T_op=None,
		time=0) :

		self.Args = Args()
		self.dim = self.Args.dim 
		if T_op is not None : self.T_op = T_op
		else : self.T_op = numpy.zeros((self.dim, self,dim))
Beispiel #13
0
    def __init__(self, neuron_network_filename):

        self.Utill = Utill()
        self.Args = Args()

        self.graph = HierarchicalGraph()  # make hierarchy graph

        self.neuron_network = NeuronNetwork(self.graph)
        self.neuron_group = NeuronGroup(self.graph)
        self.neuron_model = NeuronModel(self.graph)
        self.neuron_element = NeuronElement(self.graph)

        self.build(neuron_network_filename)  #build hierarchial neuron layer
Beispiel #14
0
    def __init__(self):

        self.Args = Args()
        self.Utill = Utill()
        self.depth = 0
        self.hierarchy = dict(
        )  # {Neural Network:0, Neuron Group:1, Neuron:2, ,...}
        self.hierarchical_graph = dict(
        )  # {Neural Network:Graph(), Neuron Group:Graph(), Neuron:Graph(), ,...}

        self.hierarchical_group_dict = dict()  # {{label: "~", "from":, "to"}}
        self.hierarchical_up_group_dict = dict()  # {"neuronA":neoronGroupB..}
        self.hierarchical_down_group_dict = dict(
        )  # {"neuronA":{proteinA, proteinB,...}}
        self.hierarchical_down_group_input_dict = dict(
        )  # {"neuronA":{proteinA, proteinB,...}}
        self.hierarchical_down_group_output_dict = dict(
        )  # {"neuronA":{proteinA, proteinB,...}}
        self.node_label_dict = dict(
        )  # {"neuronA":{'label':"neuronA", ...}...}

        #index for synaps add
        self.neuron_model_local_from_dict = dict(
        )  # index for select candidate in neuron
        self.neuron_model_synaps_dict = dict(
        )  # index for add synaps in neuron - local element
        self.neuron_model_local_input_dict = dict(
        )  # index for add synaps in neuron - local input element
        self.neuron_element_local_input_dict = dict(
        )  # index for add synaps - add output_pointer

        self.hierarchical_down_group_indexer = dict()  #indexer

        #job list
        self.job_list = list()  # job list

        self.local_input_job_list = list()  # input neuron element node
        self.global_input_job_list = list()  # input neuron element node

        self.age = 0
        self.pointer = 0

        self.debug = True
        self.debug_dict = dict()
        self.debug_show = dict()
        self.debug_show_time = 30
Beispiel #15
0
import sys
import os

cur_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(cur_dir, "ImageEditor"))
sys.path.append(os.path.join(cur_dir, "Input"))

from BatchImageEditor import BatchImageEditor
from Args import Args
from BatchJob import BatchJob
from Help import Help

if len(sys.argv) < 2:
    Help.print_help()

args = Args(sys.argv[1:])

options = args.get_options()

job = BatchJob(options)
editor = BatchImageEditor()

editor.process_images(job)
Beispiel #16
0
 def testSimpeIntPresent(self):
     args = Args("x#", ["-x", 42])
     self.assertEqual(1, args.cardinality())
     self.assertTrue(args.has('x'))
     self.assertEqual(42, args.getInt('x'))
Beispiel #17
0
 def testSpacesInFormat(self):
     args = Args("x, y", ["-xy"])
     self.assertEqual(2, args.cardinality())
     self.assertTrue(args.has("x"))
     self.assertTrue(args.has("y"))
Beispiel #18
0
 def testSimpleStringPresent(self):
     args = Args("x*", ["-x", "param"])
     self.assertEqual(1, args.cardinality())
     self.assertTrue(args.has('x'))
     self.assertEqual("param", args.getString("x"))
Beispiel #19
0
 def testSimpleBooleanPresent(self):
     args = Args("x", ["-x"])
     self.assertEqual(1, args.cardinality())
     self.assertEqual(True, args.getBoolean("x"))
Beispiel #20
0
 def testCreateWithNoSchemaOrArguments(self):
     args = Args("", "")
     self.assertEqual(args.cardinality(), 0)
Beispiel #21
0
    def __init__(self, graph):

        self.Utill = Utill()
        self.Args = Args()
        self.graph = graph
Beispiel #22
0
 def __init__(self):
     self.opt = Args().options
Beispiel #23
0
	def __init__(self, graph, neuron_network_node):
		self.Utill = Utill()
		self.Args = Args()
Beispiel #24
0
            for key, values in dict.items():
                if not values:
                    err_msg(key)
                    i = 1
            return i

        tplhst_msg = 'Error , the template host name should not be None ! '
        hst_msg = 'Error , the host name should not be None ! '
        adr_msg = 'Error , the address should not be None ! '
        inc_msg = 'Error , the inc or exc groups should noe be None ! '
        tplsrc_msg = 'Error , the template service name should not be None !  '
        src_msg = 'Error , the service name should noe be None ! '

        msg_list = [tplhst_msg, hst_msg, adr_msg, inc_msg, tplsrc_msg, src_msg]

        opt = Args().options

        i = 0

        if opt.createhost:
            msg("Template Host : %s" % (opt.tplhostname))
            msg("     New Host : %s" % (opt.hostname))
            msg(" Host Address : %s" % (opt.address))
            dict = {
                msg_list[0]: opt.tplhostname,
                msg_list[1]: opt.hostname,
                msg_list[2]: opt.address
            }
            i = check_args(dict, i)
            if i == 1:
                sys.exit()
Beispiel #25
0
 def __init__(self):
     Args.__init__(self)
     self.repo_path = "/home/xiey/Git/faurecia-nagios-configuration"
Beispiel #26
0
 def __init__(self):
   self.args = Args()
   self.exception = NewException(self.args)
   self.fileNames = FileNames(self.args)
   self.names = Names()
Beispiel #27
0
import sys
from Args import Args

elementId = sys.argv[1]
arguments = sys.argv[2:]

args = Args(elementId, arguments)
Beispiel #28
0
    def __init__(self):

        self.Generation = np.array([])
        self.Generation_cnt = 1
        self.Args = Args()
Beispiel #29
0
 def testSimpleDoublePresent(self):
     args = Args("x##", ["-x", "42.3"])
     self.assertEqual(1, args.cardinality())
     self.assertTrue(args.has('x'))
     self.assertEqual(42.3, args.getDouble("x"))
Beispiel #30
0
    def __init__(self, Utill):

        self.Args = Args()
        self.Utill = Utill
Beispiel #31
0
 def test_normal(self):
     a = Args("l:bool,p:int,d:str", "-l true -d usr/log -p 8080")
     self.assertEqual(a.get_value("l"), True)
     self.assertEqual(a.get_value("d"), "usr/log")
     self.assertEqual(a.get_value("p"), 8080)