Esempio n. 1
0
    def seed_infect_by_idx(self, ID, strain_multiplier = 1, network_id = -1 ):
        
        n_total = self._params_obj.get_param("n_total")

        if ( ID < 0 ) | ( ID >= n_total ) :
            raise ModelParameterException( "ID out of range (0<=ID<n_total)")

        if strain_multiplier < 0 :
            raise ModelParameterException( "strain_multiplier must be positive")

        return covid19.seed_infect_by_idx( self.c_model, ID, strain_multiplier, network_id );
Esempio n. 2
0
    def seed_infect_by_idx(self, ID, strain_idx = 0, network_id = -1 ):
        
        n_total = self._params_obj.get_param("n_total")

        if ( ID < 0 ) | ( ID >= n_total ) :
            raise ModelParameterException( "ID out of range (0<=ID<n_total)" )

        n_strains = self.c_model.n_initialised_strains;
        if ( strain_idx < 0 ) | ( strain_idx >= n_strains ) :
            raise ModelParameterException( f"strain_idx out of range (0 <= strain_idx < self.c_model.n_initialized_strains)" )

        return covid19.seed_infect_by_idx( self.c_model, ID, strain_idx, network_id );
Esempio n. 3
0
    def seed_infect_by_idx(self, ID, strain_idx = 0, strain = None, network_id = -1 ):
        
        n_total = self._params_obj.get_param("n_total")

        if ( ID < 0 ) | ( ID >= n_total ) :
            raise ModelParameterException( "ID out of range (0<=ID<n_total)" )

        if strain != None :
            if isinstance( strain, Strain ) :
                strain_idx = strain.idx()
            else :
                ModelParameterException( "strain must be of class Strain")
            
        if not isinstance( strain_idx, int ) :
            ModelParameterException( "strain must either be a Strain class or the idx of the strain" )

        n_strains = self.c_model.n_initialised_strains;
        if ( strain_idx < 0 ) | ( strain_idx >= n_strains ) :
            raise ModelParameterException( f"strain_idx out of range (0 <= strain_idx < self.c_model.n_initialized_strains)" )
       
        return covid19.seed_infect_by_idx( self.c_model, ID, strain_idx, network_id );