BioSIMI-Python/modules/SimpleModel.py
def createNewParameter(self, ListOfParameters, ListOfValues, pConstant, pUnit):
        ''' 
        Creates new Parameter object inside the 
        Model with the given attributes and returns pointer to the list of Parameter object created
        '''
        model = self.getModel()
        allIds = self.getAllIds()
        trans = SetIdFromNames(allIds)
        check(model,'retreived model object')
        values = []
        parametersList = []
        if (type(ListOfParameters) is str) or  (len(ListOfParameters) == 1):
            if (type(ListOfValues) is list) and (len(ListOfValues) > 1):
                raise SyntaxError('The values cannot be a list of multiple items when only one parameter is being created')
            elif (type(ListOfValues) is list) and (len(ListOfValues) == 1):
                values.append(ListOfValues[0])
            elif type(ListOfValues) is not list:
                if not isinstance(ListOfValues, (int, float)):
                    raise SyntaxError('The values should be a real number corresponding to the parameters given')
                values.append(ListOfValues)
            if type(ListOfParameters) is str:
                parametersList.append(ListOfParameters)
                
        # Multiple parameters 
        elif (type(ListOfParameters) is list) and (len(ListOfParameters) > 1):
            if type(ListOfValues) is not list:
                raise SyntaxError('For multiple parameters, the values should be a list of real numbers')
            elif len(ListOfParameters) != len(ListOfValues):
                raise SyntaxError('The length of ListOfParameters and ListOfValues should be the same.')
            else:
                values = ListOfValues[:]
            for p_name, p_val in zip(ListOfParameters, values):
                if not isinstance(p_val, (int, float)):
                    raise SyntaxError('The values should be a real number corresponding to the parameter given')
                if not isinstance(p_name, str):
                    raise SyntaxError('The parameter name should be a string.')
            parametersList = ListOfParameters[:]
        else:
            raise SyntaxError('ListOfParameters should be a list type with string items and ListOfValues should be list type with real numbers')


        list_p_obj = []
        for pName, pValue in zip(parametersList, values):
            p_obj = model.createParameter()
            check(p_obj, 'created p_obj parameter')
            pId = trans.getValidIdForName(pName)
            check(p_obj.setId(pId), 'set p_obj ID')
            check(p_obj.setName(pName), 'set p_obj name')
            check(p_obj.setValue(pValue), 'set p_obj value')
            check(p_obj.setConstant(pConstant), 'set p_obj constant')
            check(p_obj.setUnits(pUnit), 'set p_obj units')
            list_p_obj.append(p_obj)
        return list_p_obj
 
        Creates new Parameter object inside the 
        Model with the given attributes and returns pointer to the list of Parameter object created
        
Creates new Parameter object inside the
Model with the given attributes and returns pointer to the list of Parameter object created
Creates new Parameter object inside the Model with the given attributes and returns pointer to the list of Parameter object created
def createNewParameter(self, ListOfParameters, ListOfValues, pConstant, pUnit):
        model = self.getModel()
        allIds = self.getAllIds()
        trans = SetIdFromNames(allIds)
        check(model,'retreived model object')
        values = []
        parametersList = []
        if (type(ListOfParameters) is str) or  (len(ListOfParameters) == 1):
            if (type(ListOfValues) is list) and (len(ListOfValues) > 1):
                raise SyntaxError('The values cannot be a list of multiple items when only one parameter is being created')
            elif (type(ListOfValues) is list) and (len(ListOfValues) == 1):
                values.append(ListOfValues[0])
            elif type(ListOfValues) is not list:
                if not isinstance(ListOfValues, (int, float)):
                    raise SyntaxError('The values should be a real number corresponding to the parameters given')
                values.append(ListOfValues)
            if type(ListOfParameters) is str:
                parametersList.append(ListOfParameters)
        elif (type(ListOfParameters) is list) and (len(ListOfParameters) > 1):
            if type(ListOfValues) is not list:
                raise SyntaxError('For multiple parameters, the values should be a list of real numbers')
            elif len(ListOfParameters) != len(ListOfValues):
                raise SyntaxError('The length of ListOfParameters and ListOfValues should be the same.')
            else:
                values = ListOfValues[:]
            for p_name, p_val in zip(ListOfParameters, values):
                if not isinstance(p_val, (int, float)):
                    raise SyntaxError('The values should be a real number corresponding to the parameter given')
                if not isinstance(p_name, str):
                    raise SyntaxError('The parameter name should be a string.')
            parametersList = ListOfParameters[:]
        else:
            raise SyntaxError('ListOfParameters should be a list type with string items and ListOfValues should be list type with real numbers')
        list_p_obj = []
        for pName, pValue in zip(parametersList, values):
            p_obj = model.createParameter()
            check(p_obj, 'created p_obj parameter')
            pId = trans.getValidIdForName(pName)
            check(p_obj.setId(pId), 'set p_obj ID')
            check(p_obj.setName(pName), 'set p_obj name')
            check(p_obj.setValue(pValue), 'set p_obj value')
            check(p_obj.setConstant(pConstant), 'set p_obj constant')
            check(p_obj.setUnits(pUnit), 'set p_obj units')
            list_p_obj.append(p_obj)
        return list_p_obj
def createNewParameter ( self , ListOfParameters , ListOfValues , pConstant , pUnit ) : model = self . getModel ( ) allIds = self . getAllIds ( ) trans = SetIdFromNames ( allIds ) check ( model , 'retreived model object' ) values = [ ] parametersList = [ ] if ( type ( ListOfParameters ) is str ) or ( len ( ListOfParameters ) == 1 ) : if ( type ( ListOfValues ) is list ) and ( len ( ListOfValues ) > 1 ) : raise SyntaxError ( 'The values cannot be a list of multiple items when only one parameter is being created' ) elif ( type ( ListOfValues ) is list ) and ( len ( ListOfValues ) == 1 ) : values . append ( ListOfValues [ 0 ] ) elif type ( ListOfValues ) is not list : if not isinstance ( ListOfValues , ( int , float ) ) : raise SyntaxError ( 'The values should be a real number corresponding to the parameters given' ) values . append ( ListOfValues ) if type ( ListOfParameters ) is str : parametersList . append ( ListOfParameters ) elif ( type ( ListOfParameters ) is list ) and ( len ( ListOfParameters ) > 1 ) : if type ( ListOfValues ) is not list : raise SyntaxError ( 'For multiple parameters, the values should be a list of real numbers' ) elif len ( ListOfParameters ) != len ( ListOfValues ) : raise SyntaxError ( 'The length of ListOfParameters and ListOfValues should be the same.' ) else : values = ListOfValues [ : ] for p_name , p_val in zip ( ListOfParameters , values ) : if not isinstance ( p_val , ( int , float ) ) : raise SyntaxError ( 'The values should be a real number corresponding to the parameter given' ) if not isinstance ( p_name , str ) : raise SyntaxError ( 'The parameter name should be a string.' ) parametersList = ListOfParameters [ : ] else : raise SyntaxError ( 'ListOfParameters should be a list type with string items and ListOfValues should be list type with real numbers' ) list_p_obj = [ ] for pName , pValue in zip ( parametersList , values ) : p_obj = model . createParameter ( ) check ( p_obj , 'created p_obj parameter' ) pId = trans . getValidIdForName ( pName ) check ( p_obj . setId ( pId ) , 'set p_obj ID' ) check ( p_obj . setName ( pName ) , 'set p_obj name' ) check ( p_obj . setValue ( pValue ) , 'set p_obj value' ) check ( p_obj . setConstant ( pConstant ) , 'set p_obj constant' ) check ( p_obj . setUnits ( pUnit ) , 'set p_obj units' ) list_p_obj . append ( p_obj ) return list_p_obj
Creates new Parameter object inside the
Model with the given attributes and returns pointer to the list of Parameter object created
Creates new Parameter object inside the Model with the given attributes and returns pointer to the list of Parameter object created
''' 
        Creates new Parameter object inside the 
        Model with the given attributes and returns pointer to the list of Parameter object created
        ''' # Multiple parameters 
self
ListOfParameters
ListOfValues
pConstant
pUnit