Exemple #1
0
    def Evap3(self, p0, p1, t1, tau, beta, offset, t2, tau2, duration):
        """Evaporation ramp v2"""
        if duration <= 0:
            return
        else:
            N = int(round(duration / self.ss))
            print '...Evap nsteps = ' + str(N)
            ramp = []
            hashbase = '%.8f,%.8f,%.8f,%.8f,%s,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f ' \
                       % ( b,m1,m2,kink, self.name, self.ss, duration, p0, p1, t1, tau, beta, offset, t2, tau2)

            ramphash = seqconf.ramps_dir() +'Evap3_' \
               + hashlib.md5( hashbase).hexdigest()
            if not os.path.exists(ramphash):
                print '...Making new Evap3 ramp'
                for xi in range(N):
                    t = (xi + 1) * self.ss
                    phys = evap.v2(t, p0, p1, t1, tau, beta, offset, t2, tau2)
                    volt = OdtpowConvert(phys)
                    ramp = numpy.append(ramp, [volt])
                ramp.tofile(ramphash, sep=',', format="%.4f")
            else:
                print '...Recycling previously calculated Evap3 ramp'
                ramp = numpy.fromfile(ramphash, sep=',')

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

        #This returns the last value of the ramp
        return evap.v2(N * self.ss, p0, p1, t1, tau, beta, offset, t2, tau2)
Exemple #2
0
	def Evap3(self, p0, p1, t1, tau, beta, offset, t2, tau2, duration):
		"""Evaporation ramp v2"""
		if duration <=0:
			return
		else:
			N=int(round(duration/self.ss))
			print '...Evap nsteps = ' + str(N)
			ramp=[]
			hashbase = '%.8f,%.8f,%.8f,%.8f,%s,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f ' \
			           % ( b,m1,m2,kink, self.name, self.ss, duration, p0, p1, t1, tau, beta, offset, t2, tau2)
			
			ramphash = seqconf.ramps_dir() +'Evap3_' \
						+ hashlib.md5( hashbase).hexdigest()
			if not os.path.exists(ramphash):
				print '...Making new Evap3 ramp'
				for xi in range(N):
					t = (xi+1)*self.ss
					phys = evap.v2(t,p0,p1,t1,tau,beta, offset,t2,tau2)                    
					volt = OdtpowConvert(phys)
					ramp = numpy.append( ramp, [ volt])
				ramp.tofile(ramphash,sep=',',format="%.4f")
			else:
				print '...Recycling previously calculated Evap3 ramp'
				ramp = numpy.fromfile(ramphash,sep=',')

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

		#This returns the last value of the ramp
		return evap.v2(N*self.ss,p0,p1,t1,tau,beta,offset,t2,tau2)
Exemple #3
0
    def Evap5(self, p0, p1, t1, tau, beta, offset, t2, tau2, duration):
        """Evaporation ramp v5"""
        if True:
            print ""
            print "----- EVAPORATION RAMP Version 5-----"
            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 ' \
                       % ( b,m1,m2,m3,kink1,kink2, self.name, self.ss, duration, p0, p1, t1, tau, beta, offset, t2, tau2)

            ramphash = seqconf.ramps_dir() +'Evap5__' \
               + 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 Evap5 ramp'
                for xi in range(N):
                    t = (xi + 1) * self.ss
                    phys = evap.v2(t, p0, p1, t1, tau, beta, offset, t2,
                                   tau2) if (t < t2) else evap.v2(
                                       t2, p0, p1, t1, tau, beta, offset, t2,
                                       tau2)
                    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 Evap4 ramp'
                ramp = numpy.fromfile(ramphash, sep=',')

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

        #This returns the last value of the ramp
        print ""
        return evap.v2(N * self.ss, p0, p1, t1, tau, beta, offset, t2, tau2)
Exemple #4
0
	def Evap5(self, p0, p1, t1, tau, beta, offset, t2, tau2, duration):
		"""Evaporation ramp v5"""
		if True:
			print ""
			print "----- EVAPORATION RAMP Version 5-----"
			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 ' \
			           % ( b,m1,m2,m3,kink1,kink2, self.name, self.ss, duration, p0, p1, t1, tau, beta, offset, t2, tau2)

			ramphash = seqconf.ramps_dir() +'Evap5__' \
						+ 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 Evap5 ramp'
				for xi in range(N):
					t = (xi+1)*self.ss
					phys = evap.v2(t,p0,p1,t1,tau,beta, offset,t2,tau2) if (t<t2) else  evap.v2(t2,p0,p1,t1,tau,beta, offset,t2,tau2)                  
					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 Evap4 ramp'
				ramp = numpy.fromfile(ramphash,sep=',')

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

		#This returns the last value of the ramp
		print ""
		return evap.v2(N*self.ss,p0,p1,t1,tau,beta,offset,t2,tau2)
Exemple #5
0
	def Evap2(self, p0, p1, t1, tau, beta, offset, t2, tau2, duration):
		"""Evaporation ramp v2"""
		if duration <=0:
			return
		else:
			N=int(round(duration/self.ss))
			print '...Evap nsteps = ' + str(N)
			ramp=[]
			ramphash = seqconf.ramps_dir() + 'Evap2_' \
					   + hashlib.md5(str(self.name)+str(self.ss)+str(duration)+str(p0)+str(p1)+str(t1)+str(tau)+str(beta)\
					                  + str(offset)+str(t2)+str(tau2)).hexdigest()
			if not os.path.exists(ramphash):
				print '...Making new Evap2 ramp'
				for xi in range(N):
					t = (xi+1)*self.ss
					phys = evap.v2(t,p0,p1,t1,tau,beta, offset,t2,tau2)
					volt = cnv(self.name,phys)
					ramp = numpy.append( ramp, [ volt])
				ramp.tofile(ramphash,sep=',',format="%.4f")
			else:
				print '...Recycling previously calculated Evap2 ramp'
				ramp = numpy.fromfile(ramphash,sep=',')

			self.y=numpy.append(self.y,ramp)
		return
Exemple #6
0
    def Evap2(self, p0, p1, t1, tau, beta, offset, t2, tau2, duration):
        """Evaporation ramp v2"""
        if duration <= 0:
            return
        else:
            N = int(round(duration / self.ss))
            print '...Evap nsteps = ' + str(N)
            ramp = []
            ramphash = seqconf.ramps_dir() + 'Evap2_' \
                 + hashlib.md5(str(self.name)+str(self.ss)+str(duration)+str(p0)+str(p1)+str(t1)+str(tau)+str(beta)\
                                + str(offset)+str(t2)+str(tau2)).hexdigest()
            if not os.path.exists(ramphash):
                print '...Making new Evap2 ramp'
                for xi in range(N):
                    t = (xi + 1) * self.ss
                    phys = evap.v2(t, p0, p1, t1, tau, beta, offset, t2, tau2)
                    volt = cnv(self.name, phys)
                    ramp = numpy.append(ramp, [volt])
                ramp.tofile(ramphash, sep=',', format="%.4f")
            else:
                print '...Recycling previously calculated Evap2 ramp'
                ramp = numpy.fromfile(ramphash, sep=',')

            self.y = numpy.append(self.y, ramp)
        return
t1 = [500.,780.,1000.,3000.]
tau = 1400.
tau2=1000.
offset = -0.157
beta = 1.55
p1 = 6.5 
t2 = 3000.
p0=10.
image=9000.
steps =500
time = [ t*1.0/steps*image for t in range(steps)]
leg = []

for i in t1:
	datax=[]
	datay=[]
	for j in time:
		datax.append(j)
		datay.append(evap.v2(j,p0,p1,i,tau,beta,offset,t2,tau))
	ax.plot(datax,datay)
	leg.append("t1 = %.1f" %i )

ax.legend(leg)
ax.grid(True)
ax.set_xlabel('Image(ms)')
ax.set_ylabel('ODTpow')
plt.show()



Exemple #8
0
fig = plt.figure()

ax = fig.add_subplot(111)
t1 = [500., 780., 1000., 3000.]
tau = 1400.
tau2 = 1000.
offset = -0.157
beta = 1.55
p1 = 6.5
t2 = 3000.
p0 = 10.
image = 9000.
steps = 500
time = [t * 1.0 / steps * image for t in range(steps)]
leg = []

for i in t1:
    datax = []
    datay = []
    for j in time:
        datax.append(j)
        datay.append(evap.v2(j, p0, p1, i, tau, beta, offset, t2, tau))
    ax.plot(datax, datay)
    leg.append("t1 = %.1f" % i)

ax.legend(leg)
ax.grid(True)
ax.set_xlabel('Image(ms)')
ax.set_ylabel('ODTpow')
plt.show()