Exemplo n.º 1
0
    def __init__(self, match, groups):
        Token.__init__(self, match, groups)

        # extract reaction participants
        self._thirdBody = None
        self._falloff = 0

        products = groups["products"].strip()
        self._products, self._externalProduct = self._extractParticipants(products)

        reactants = groups["reactants"].strip()
        self._reactants, self._externalReactant = self._extractParticipants(reactants)

        # extract the reaction type
        arrow = groups["reaction_arrow"]
        if arrow == "=>":
            self._reversibleReaction = 0
        elif arrow == "=" or arrow == "<=>":
            self._reversibleReaction = 1
        else:
            import journal
            journal.firewall("fuego").log("Reaction: Unknown arrow '%s'" % arrow)

        paramList = map(groups.get, self._paramNames)
        try:
            self.arrhenius = map(float, paramList)
        except ValueError:
            # this can't happen because the regexp requires three floats here
            import journal
            str = "Could not convert '%s' into a list of numbers" % paramList
            journal.firewall("fuego").log(str)
            return

        return
Exemplo n.º 2
0
    def __init__(self, match, groups):
        Token.__init__(self, match, groups)
        self.text = groups["tran_line"]
        self.id = int(groups["tran_type"])
        self.text_2 = groups["tran_line_2"]

        return
Exemplo n.º 3
0
    def __init__(self, match, groups):
        Token.__init__(self, match, groups)

        self.text = groups["parameter_list"]
        self.parameters = self.whitespace.split(self.text)
        self.count = len(self.parameters)

        return
Exemplo n.º 4
0
    def __init__(self, match, groups):
        Token.__init__(self, match, groups)

        if groups["thermo_all"]:
            self._all = 1
        else:
            self._all = 0
        return
Exemplo n.º 5
0
	def __init__(self,token,lower,target_order,negation=False,notation='classic'):
		Token.__init__(self,notation)
		self.target_order=target_order
		self.lower=lower
		self.content=token
		self.negation=negation
		self.variables=[]
		self.process_lower()
Exemplo n.º 6
0
 def __init__(self):
     Token.__init__(self)
     
     params = urllib.urlencode({})
     headers = { "X-Auth-Token":self.apitoken, "Content-type":"application/json" }
     self.conn = httplib.HTTPConnection(self.apiurlt[1])
     self.conn.request("GET", "%s/images/detail?" % self.apiurlt[2], params, headers)
 
     self.response = self.conn.getresponse()
     self.image_metadata = self.response.read()
     self.image_metadata = json.loads(self.image_metadata)
     self.conn.close()
Exemplo n.º 7
0
    def __init__(self, match, groups):
        Token.__init__(self, match, groups)
        text = map(groups.get, self._patternNames)
        try:
            self.range = tuple(map(float, text))
        except ValueError:
            # this can't happen because the regexp requires a float here
            import journal
            msg = "Can't convert '%s' into a list of numbers" % text
            journal.firewall("fuego").log(msg)
            return

        return
Exemplo n.º 8
0
    def __init__(self, match, groups):
        Token.__init__(self, match, groups)

        import pyre
        pyre.debug.Firewall.hit("arrhenius coefficients token")

        numbers = map(groups.get, arrhenius)

        try:
            self.parameters = map(float, numbers)
        except ValueError:
            # this can't happen because the regexp requires three floats
            import pyre
            msg = "Could not convert /%s/ into a list of numbers" % text
            pyre.debug.Firewall.hit(msg)
            return

        return
Exemplo n.º 9
0
 def __init__(self, name='no name', logger=logging, show=True, fire=True):
     Token.__init__(self, name=name, logger=logger, show=show, fire=fire)
     self.placeClocks = {}
     """ We save inside a place as key and associated to this place the time that the token will live on this place.
         We can add a place's clock using the method addPlaceClock()
     """
     self.transitionClocks = {}
     """ We save inside a transition as key and associated to this transition the time that the token will live
         on this transition. We can add a transition's clock using the method addTransitionClock()
     """
     self.pclock = 0.0
     """ It represents the time that the tokens lived on the current place on the TimedPetriNet during a simulation.
         It is reinitialized to 0.0 when the token change its current place
     """
     self.tclock = {}
     """ It represents the time that the tokens lived on the current transitions on the TimedPetriNet
         during a simulation. Only the transition that can fire this token are save inside
     """
     self.currentClock = 0.0
     """It represents how much time lived the token in the TimedPetriNet during a simulation
     """
     self.minimumStartingTime = {}
     """The token can't be fired by the given transition before the associated time
    def __init__(self, match, groups):
        Token.__init__(self, match, groups)

        self.efficiencies = []
        text = self.lexeme

        i = 0
        split = text.split("/")
        while i < len(split) - 1:
            species = split[i].strip()
            try:
                efficiency = float(split[i + 1])
            except ValueError:
                # this can't happen because the regexp requires a float here
                import journal
                msg = "Could not convert '%s' into a number" % split[i + 1]
                journal.firewall("fuego").log(msg)
                return

            self.efficiencies.append((species, efficiency))
            i = i + 2

        return
Exemplo n.º 11
0
 def __init__(self):
     Token.__init__(self)
Exemplo n.º 12
0
 def __init__(self, match, groups):
     Token.__init__(self, match, groups)
     self.units_A = self.lexeme.lower()
     return
Exemplo n.º 13
0
 def __init__(self):
     Token.__init__(self)
Exemplo n.º 14
0
 def __init__(self, match, groups):
     Token.__init__(self, match, groups)
     self.name = self.lexeme
     return
Exemplo n.º 15
0
	def __init__ (self,token_a,token_b,target_order,negation=False,notation='classic'):
		Token.__init__(self,notation)
		self.target_order=target_order
		self.content_a=token_a
		self.content_b=token_b
		self.negation=negation
Exemplo n.º 16
0
 def __init__(self, match, groups):
     Token.__init__(self, match, groups)
     self.name = groups["element_name"]
     self.weight = groups["element_weight"]
     return
Exemplo n.º 17
0
    def __init__(self, match, groups):
        Token.__init__(self, match, groups)
        self.text = groups["thermo_line"]
        self.id = int(groups["thermo_type"])

        return