def returnFunction(self): # get boundaries for frequency: minFreq = w2f(self.centerwl+self.width) maxFreq = w2f(self.centerwl-self.width) height = self.height # create a function to make a spike of width width def spike(f): if f < minFreq: return self.offset elif f > maxFreq: return self.offset else : return self.offset+height return spike
def returnFunction(self): # get boundaries for frequency: minFreq = w2f(self.centerwl + self.width) maxFreq = w2f(self.centerwl - self.width) height = self.height # create a function to make a spike of width width def spike(f): if f < minFreq: return self.offset elif f > maxFreq: return self.offset else: return self.offset + height return spike
def returnFunction(self): t = self.t offset = self.offset f0 = w2f(self.w0) print "f0 : ", f0 return lambda f: abs(f - f0) * t + offset
def returnFunction(self): offset = self.offset amp = self.amp f0 = w2f(self.w0) phi = self.phi t = self.t return lambda f: offset + amp * cos((f - f0) * t + phi)
def returnFunction(self): t = self.t offset = self.offset f0 = w2f(self.w0) print "f0 : " , f0 return lambda f: abs(f - f0)*t+offset
def returnFunction(self): offset = self.offset amp = self.amp f0 = w2f(self.w0) phi = self.phi t = self.t return lambda f: offset + amp*cos((f-f0)*t+phi)
def plotPhaseFunction(self, phasefunction): " Plot the phase function, requires a pure function " # create x-axis wavelength = np.linspace(600, 900, 1000) #phasefunction is dependent on frequency, not wavelength, so convert vFun = np.vectorize(phasefunction) phases = vFun(w2f(wavelength)) #print np.array([wavelength,phases]).transpose() self.axPhase.plot(wavelength, phases) self.axPhase.set_xlabel("Wavelength [nm]") self.axPhase.set_ylabel("Phase [rad]") self.canvas.draw()
def plotPhaseFunction(self,phasefunction): " Plot the phase function, requires a pure function " # create x-axis wavelength = np.linspace(600,900,1000) #phasefunction is dependent on frequency, not wavelength, so convert vFun = np.vectorize(phasefunction) phases = vFun(w2f(wavelength)) #print np.array([wavelength,phases]).transpose() self.axPhase.plot(wavelength,phases) self.axPhase.set_xlabel("Wavelength [nm]") self.axPhase.set_ylabel("Phase [rad]") self.canvas.draw()