Exemplo n.º 1
0
	def Evap8(self, p0, p1, t1, tau, beta, offset, t2, tau2, smoothdt, duration,scale = 1.0):
		"""Evaporation ramp v8 same as v7 with scale"""
		if True:
			print ""
			print "----- EVAPORATION RAMP Version 8-----"
			
		if duration <=0:
			return
		else:
			N=int(round(duration*scale/self.ss))
			print '\t...Evap nsteps = ' + str(N)
			ramp_phys=numpy.array([])
			ramp=numpy.array([])
			
			hashbase = ''
			hashbase = hashbase + '%.s' % self.name
			hashbase = hashbase + '%.8f' % self.ss
			hashbase = hashbase + '%.8f' % duration
			hashbase = hashbase + '%.8f' % p0
			hashbase = hashbase + '%.8f' % p1
			hashbase = hashbase + '%.8f' % t1
			hashbase = hashbase + '%.8f' % tau
			hashbase = hashbase + '%.8f' % beta
			hashbase = hashbase + '%.8f' % offset
			hashbase = hashbase + '%.8f' % t2
			hashbase = hashbase + '%.8f' % tau2
			hashbase = hashbase + '%.8f' % smoothdt
			hashbase = hashbase + '%.8f' % scale

			ramphash = seqconf.ramps_dir() +'Evap8_' \
						+ hashlib.md5( hashbase).hexdigest()
						
			#Here, go ahead and save the trajectory path to the report
			gen.save_to_report('EVAP','ramp', ramphash+'_phys')
			
			if not os.path.exists(ramphash) or True:
				print '\t...Making new Evap8 ramp'
				for xi in range(N):
					t = (xi+1)*self.ss/scale
					phys = evap.v6(t,p0,p1,t1,tau,beta, offset,t2,tau2,smoothdt)                    
					volt = physics.cnv( 'odtpow', phys)
					
					ramp_phys = numpy.append( ramp_phys, [ phys])
					ramp = numpy.append( ramp, numpy.around([ volt],decimals=4))
				ramp_phys.tofile(ramphash+'_phys',sep='\n',format="%.4f")
				#ramp.tofile(ramphash,sep=',',format="%.4f")
			
			else:
				print '\t...Recycling previously calculated Evap8 ramp'
				ramp = numpy.fromfile(ramphash,sep=',')

			self.y=numpy.append(self.y,ramp)

		#This returns the last value of the ramp
		print ""
		return evap.v6(N*self.ss/scale,p0,p1,t1,tau,beta,offset,t2,tau2,smoothdt)
Exemplo n.º 2
0
    def Evap7(self, p0, p1, t1, tau, beta, offset, t2, tau2, smoothdt,
              duration):
        """Evaporation ramp v7 same as v4 except with smooth kink"""
        if True:
            print ""
            print "----- EVAPORATION RAMP Version 7-----"
            print "\tp0       = %.4f" % p0
            print "\tp1       = %.4f" % p1
            print "\tt1       = %.4f" % t1
            print "\ttau      = %.4f" % tau
            print "\tbeta     = %.4f" % beta
            print "\toffset   = %.4f" % offset
            print "\tt2       = %.4f" % t2
            print "\ttau2     = %.4f" % tau2
            print "\tduration = %.4f" % duration

        if duration <= 0:
            return
        else:
            N = int(round(duration / self.ss))
            print '\t...Evap nsteps = ' + str(N)
            ramp_phys = []
            ramp = []
            hashbase = '%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%s,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f ' \
                       % ( b,m1,m2,m3,kink1,kink2, self.name, self.ss, duration, p0, p1, t1, tau, beta, offset, t2, tau2,smoothdt)

            ramphash = seqconf.ramps_dir() +'Evap7_' \
               + hashlib.md5( hashbase).hexdigest()
            #Here, go ahead and save the trajectory path to the report
            gen.save_to_report('EVAP', 'ramp', ramphash + '_phys')
            if not os.path.exists(ramphash):
                print '\t...Making new Evap7 ramp'
                for xi in range(N):
                    t = (xi + 1) * self.ss
                    phys = evap.v6(t, p0, p1, t1, tau, beta, offset, t2, tau2,
                                   smoothdt)
                    volt = OdtpowConvert(phys)
                    ramp_phys = numpy.append(ramp_phys, [phys])
                    ramp = numpy.append(ramp, [volt])
                ramp_phys.tofile(ramphash + '_phys', sep='\n', format="%.4f")
                ramp.tofile(ramphash, sep=',', format="%.4f")
            else:
                print '\t...Recycling previously calculated Evap7 ramp'
                ramp = numpy.fromfile(ramphash, sep=',')

            self.y = numpy.append(self.y, ramp)

        #This returns the last value of the ramp
        print ""
        return evap.v6(N * self.ss, p0, p1, t1, tau, beta, offset, t2, tau2,
                       smoothdt)
Exemplo n.º 3
0
	def Evap7(self, p0, p1, t1, tau, beta, offset, t2, tau2, smoothdt, duration):
		"""Evaporation ramp v7 same as v4 except with smooth kink"""
		if True:
			print ""
			print "----- EVAPORATION RAMP Version 7-----"
			print "\tp0       = %.4f" % p0
			print "\tp1       = %.4f" % p1
			print "\tt1       = %.4f" % t1
			print "\ttau      = %.4f" % tau
			print "\tbeta     = %.4f" % beta
			print "\toffset   = %.4f" % offset
			print "\tt2       = %.4f" % t2
			print "\ttau2     = %.4f" % tau2
			print "\tduration = %.4f" % duration
			
		if duration <=0:
			return
		else:
			N=int(round(duration/self.ss))
			print '\t...Evap nsteps = ' + str(N)
			ramp_phys=[]
			ramp=[]
			hashbase = '%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%s,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f ' \
			           % ( b,m1,m2,m3,kink1,kink2, self.name, self.ss, duration, p0, p1, t1, tau, beta, offset, t2, tau2,smoothdt)

			ramphash = seqconf.ramps_dir() +'Evap7_' \
						+ hashlib.md5( hashbase).hexdigest()
			#Here, go ahead and save the trajectory path to the report
			gen.save_to_report('EVAP','ramp', ramphash+'_phys')
			if not os.path.exists(ramphash):
				print '\t...Making new Evap7 ramp'
				for xi in range(N):
					t = (xi+1)*self.ss
					phys = evap.v6(t,p0,p1,t1,tau,beta, offset,t2,tau2,smoothdt)                    
					volt = OdtpowConvert(phys)
					ramp_phys = numpy.append( ramp_phys, [ phys])
					ramp = numpy.append( ramp, [ volt])
				ramp_phys.tofile(ramphash+'_phys',sep='\n',format="%.4f")
				ramp.tofile(ramphash,sep=',',format="%.4f")
			else:
				print '\t...Recycling previously calculated Evap7 ramp'
				ramp = numpy.fromfile(ramphash,sep=',')

			self.y=numpy.append(self.y,ramp)

		#This returns the last value of the ramp
		print ""
		return evap.v6(N*self.ss,p0,p1,t1,tau,beta,offset,t2,tau2,smoothdt)
Exemplo n.º 4
0
    def Evap8(self,
              p0,
              p1,
              t1,
              tau,
              beta,
              offset,
              t2,
              tau2,
              smoothdt,
              duration,
              scale=1.0):
        """Evaporation ramp v8 same as v7 with scale"""
        if True:
            print ""
            print "----- EVAPORATION RAMP Version 7-----"
            print "\tp0       = %.4f" % p0
            print "\tp1       = %.4f" % p1
            print "\tt1       = %.4f" % t1
            print "\ttau      = %.4f" % tau
            print "\tbeta     = %.4f" % beta
            print "\toffset   = %.4f" % offset
            print "\tt2       = %.4f" % t2
            print "\ttau2     = %.4f" % tau2
            print "\tduration = %.4f" % duration

        if duration <= 0:
            return
        else:
            N = int(round(duration * scale / self.ss))
            print '\t...Evap nsteps = ' + str(N)
            ramp_phys = numpy.array([])
            ramp = numpy.array([])

            hashbase = ''
            hashbase = hashbase + '%.8f' % b
            hashbase = hashbase + '%.8f' % m1
            hashbase = hashbase + '%.8f' % m2
            hashbase = hashbase + '%.8f' % m3
            hashbase = hashbase + '%.8f' % kink1
            hashbase = hashbase + '%.8f' % kink2
            hashbase = hashbase + '%.s' % self.name
            hashbase = hashbase + '%.8f' % self.ss
            hashbase = hashbase + '%.8f' % duration
            hashbase = hashbase + '%.8f' % p0
            hashbase = hashbase + '%.8f' % p1
            hashbase = hashbase + '%.8f' % t1
            hashbase = hashbase + '%.8f' % tau
            hashbase = hashbase + '%.8f' % beta
            hashbase = hashbase + '%.8f' % offset
            hashbase = hashbase + '%.8f' % t2
            hashbase = hashbase + '%.8f' % tau2
            hashbase = hashbase + '%.8f' % smoothdt
            hashbase = hashbase + '%.8f' % scale

            ramphash = seqconf.ramps_dir() +'Evap8_' \
               + hashlib.md5( hashbase).hexdigest()

            #Here, go ahead and save the trajectory path to the report
            gen.save_to_report('EVAP', 'ramp', ramphash + '_phys')

            if not os.path.exists(ramphash) or True:
                print '\t...Making new Evap7 ramp'
                for xi in range(N):
                    t = (xi + 1) * self.ss / scale
                    phys = evap.v6(t, p0, p1, t1, tau, beta, offset, t2, tau2,
                                   smoothdt)
                    volt = OdtpowConvert(phys)

                    ramp_phys = numpy.append(ramp_phys, [phys])
                    ramp = numpy.append(ramp, numpy.around([volt], decimals=4))
                ramp_phys.tofile(ramphash + '_phys', sep='\n', format="%.4f")
                ramp.tofile(ramphash, sep=',', format="%.4f")

            else:
                print '\t...Recycling previously calculated Evap7 ramp'
                ramp = numpy.fromfile(ramphash, sep=',')

            self.y = numpy.append(self.y, ramp)

        #This returns the last value of the ramp
        print ""
        return evap.v6(N * self.ss / scale, p0, p1, t1, tau, beta, offset, t2,
                       tau2, smoothdt)