示例#1
0
文件: hydropy1.py 项目: temik42/QSim
    def run(self):     
        self.status = 'in progress'
        if (self.each != 0):
            import matplotlib
            matplotlib.use('Agg')
            import matplotlib.pyplot as plt
            fig = plt.figure()
        
        for i in range(0,self.maxiter):
            self.hydrostep()
            self.time += self.dt
            if (self.each != 0):
                if (i % self.each == 0):
                    I1 = (self.rho/self.m)**2*AIA.t171(self.T)*1e8
                    I2 = (self.rho/self.m)**2*AIA.t193(self.T)*1e8
                    I3 = (self.rho/self.m)**2*AIA.t211(self.T)*1e8
                    self.I171 += [np.sum((I1*self.dx)[np.where(np.abs(self.s-self.L*0.5) < self.L*0.5-self.L*0.15)])/self.L]
                    self.I193 += [np.sum((I2*self.dx)[np.where(np.abs(self.s-self.L*0.5) < self.L*0.5-self.L*0.15)])/self.L]
                    self.I211 += [np.sum((I3*self.dx)[np.where(np.abs(self.s-self.L*0.5) < self.L*0.5-self.L*0.15)])/self.L]
                    
                    plt.subplot(211)
                    plt.title('Density 10^4 / Temperature', size = 18)
                    plt.plot(self.s, np.log10(self.rho/self.m)-4)
                    plt.plot(self.s, np.log10(self.T))
                    plt.axis([0,np.max(self.s),4,7])
                    #plt.axis([0,1e9,4,7])
                    plt.subplot(212)
                    #plt.plot(self.s, self.rhou)
                    #plt.axis([0,1e9,-1e-8,1e-8])
                    plt.title('AIA 171/193/211 intensity', size = 18)
                    plt.plot(self.s,np.log10(I1))
                    plt.plot(self.s,np.log10(I2))
                    plt.plot(self.s,np.log10(I3))
                    plt.axis([0,np.max(self.s),-2,4])
                    
                    fname = (img_dir + str(np.int(i/self.each)).zfill(np.ceil(np.log10(self.maxiter/self.each)).astype(np.int)) + '.png')
                    fig.savefig(fname)
                    fig.clf()

        self.status = 'done'