Ejemplo n.º 1
0
    def find_zero(self,x,arr):
        """Given an input 1d array, extrapolate a zero crossing
"""
        y = sinterp1d(x,arr)
        try:
            zero = sbrentq(y,-0.5,0.5)
        except:
            zero = np.nan
        return zero
Ejemplo n.º 2
0
    def make_interpolant(self, *, kind='cubic', left_fill=0):
        """Interpolates density matrix and pads using 0 to the left
            and psi[-1] to the right
"""
        left_fill = np.ones(self.n, dtype='complex') * left_fill
        right_fill = self.psi[:, -1]
        return sinterp1d(self.t,
                         self.psi,
                         fill_value=(left_fill, right_fill),
                         assume_sorted=True,
                         bounds_error=False,
                         kind=kind)
Ejemplo n.º 3
0
    def make_interpolant(self,*, kind='cubic'):
        """Interpolates density matrix
"""
        return sinterp1d(self.t,self.rho,fill_value = (0,np.nan),bounds_error = False,
                         assume_sorted=True,kind=kind)