(self,times, returnUO = 0)
set returnUO to 1 to return the underlying UO path as well as the integrated UO path.
set returnUO to 1 to return the underlying UO path as well as the integrated UO path.
set returnUO to 1 to return the underlying UO path as well as the integrated UO path .
def generate_sample_path(self,times, returnUO = 0):
        "set returnUO to 1 to return the underlying UO path as well as the integrated UO path."
        if not self.conditional: 
            xPath, listOfNormals = self.OU.generate_sample_path(times, 1)
            path = []
            t = self.startTime
            y = self.startPosition
            for i, position in enumerate(xPath):
                delta = position[0]-t
                x = position[1]
                if delta != 0:
                    #there is an error here, I can smell it.
                    sigmaX = self.sigma**2*(1-np.exp(-2*self.theta*delta))/(2*self.theta)
                    sigmaY = self.sigma**2*(2*self.theta*delta-3+4*np.exp(-self.theta*delta)
                                      -np.exp(-2*self.theta*delta))/(2*self.sigma**3)
                    muY = y + (x-self.mu)/self.theta + self.mu*delta-(x-self.mu)*np.exp(-self.theta*delta)/self.theta
                    covXY = self.sigma**2*(1+np.exp(-2*self.theta*delta)-2*np.exp(-self.theta*delta))/(2*self.theta**2)
                    y = muY + np.sqrt(sigmaY - covXY**2/sigmaX)*self.Normal.rvs()+ covXY/np.sqrt(sigmaX)*listOfNormals[i]
                t = position[0]
                path.append((t,y))
            if returnUO==0:
                return path
            else:
                return path, xPath
        else:
           path = bridge_creation(self,times)
           if returnUO==0:
               return path
           else:
               return path, xPath
def generate_sample_path ( self , times , returnUO = 0 ) : if not self . conditional : xPath , listOfNormals = self . OU . generate_sample_path ( times , 1 ) path = [ ] t = self . startTime y = self . startPosition for i , position in enumerate ( xPath ) : delta = position [ 0 ] - t x = position [ 1 ] if delta != 0 : #there is an error here, I can smell it. sigmaX = self . sigma ** 2 * ( 1 - np . exp ( - 2 * self . theta * delta ) ) / ( 2 * self . theta ) sigmaY = self . sigma ** 2 * ( 2 * self . theta * delta - 3 + 4 * np . exp ( - self . theta * delta ) - np . exp ( - 2 * self . theta * delta ) ) / ( 2 * self . sigma ** 3 ) muY = y + ( x - self . mu ) / self . theta + self . mu * delta - ( x - self . mu ) * np . exp ( - self . theta * delta ) / self . theta covXY = self . sigma ** 2 * ( 1 + np . exp ( - 2 * self . theta * delta ) - 2 * np . exp ( - self . theta * delta ) ) / ( 2 * self . theta ** 2 ) y = muY + np . sqrt ( sigmaY - covXY ** 2 / sigmaX ) * self . Normal . rvs ( ) + covXY / np . sqrt ( sigmaX ) * listOfNormals [ i ] t = position [ 0 ] path . append ( ( t , y ) ) if returnUO == 0 : return path else : return path , xPath else : path = bridge_creation ( self , times ) if returnUO == 0 : return path else : return path , xPath