TwoDimensionalSpectrum.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:spectroscopy 作者: jgoodknight 项目源码 文件源码
def animateFrequency(self, filename):
        "Animate a 2D nuclear wavefunction as it evolves in time"
        plottingAmplitude = np.abs(self.filteredNonresphasingFrequencySignals + self.filteredResphasingFrequencySignals)
        zMin = np.min(plottingAmplitude)
        zMax = np.max(plottingAmplitude)

        contourLevels = 100

        contourSpacings = np.linspace(zMin, zMax, contourLevels)

        yVals = self.probeFrequencies
        xVals = self.pumpFrequencies

        fig = plt.figure()
        im = plt.contourf(xVals, yVals, plottingAmplitude[0], contourSpacings)
        ax = fig.gca()

        def animate(i, data,  ax, fig):
            ax.cla()
            im = ax.contourf(xVals, yVals, data[i], contourSpacings)
            plt.title(str(i))
            return im,

        anim = animation.FuncAnimation(fig, animate, frames = self.rawNonresphasingFrequencySignals.shape[0], interval=20, blit=True, fargs=(plottingAmplitude, ax, fig) )
        anim.save(filename, fps=20)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号