def setInfected(self, vertexInd, time): Parameter.checkIndex(vertexInd, 0, self.getNumVertices()) Parameter.checkFloat(time, 0.0, float('inf')) if self.V[vertexInd, HIVVertices.stateIndex] == HIVVertices.infected: raise ValueError("Person is already infected") self.V[vertexInd, HIVVertices.stateIndex] = HIVVertices.infected self.V[vertexInd, HIVVertices.infectionTimeIndex] = time
def setDetected(self, vertexInd, time, detectionType): Parameter.checkIndex(vertexInd, 0, self.getNumVertices()) Parameter.checkFloat(time, 0.0, float('inf')) if detectionType not in [HIVVertices.randomDetect, HIVVertices.contactTrace]: raise ValueError("Invalid detection type : " + str(detectionType)) if self.V[vertexInd, HIVVertices.stateIndex] != HIVVertices.infected: raise ValueError("Person must be infected to be detected") self.V[vertexInd, HIVVertices.stateIndex] = HIVVertices.removed self.V[vertexInd, HIVVertices.detectionTimeIndex] = time self.V[vertexInd, HIVVertices.detectionTypeIndex] = detectionType