コード例 #1
0
ファイル: Merc.py プロジェクト: RJWorth/AlphaCen
	def e(self):
		'''Calculate eccentricity of an object's orbit'''
		
		val = 1.+2.*self.eps()*Merc.mag(self.h())**2./self.gm()**2.
		if ((val < 0) & (-val < tol)):
			val = 0
		
		e = sqrt(val)
		return(np.array(e))
コード例 #2
0
ファイル: Merc.py プロジェクト: RJWorth/AlphaCen
	def i(self):
		'''Calculate inclination of an object's orbit. Takes mks, 
		returns degrees'''
		i = arccos(self.h()[2]/Merc.mag(self.h()))*180./pi
		return(np.array(i))
コード例 #3
0
ファイル: Merc.py プロジェクト: RJWorth/AlphaCen
	def v(self):
		return(Merc.mag(self.vel))
コード例 #4
0
ファイル: Merc.py プロジェクト: RJWorth/AlphaCen
	def dr(self,other):
		'''Distance between two objects.'''
		x1 = self.pos
		x2 = other.pos
		dr = Merc.mag(x1-x2)
		return(dr)
コード例 #5
0
ファイル: Merc.py プロジェクト: RJWorth/AlphaCen
	def r(self):
		return(Merc.mag( self.pos))
コード例 #6
0
 # calculate minimum pericenter, last time it happens, and final i
 for ind, l in enumerate([0, 1, 2]):
     # get basic stats of this sim
     dr = d
     vrs = vers[l]
     tf = t[l][-1]
     aBf = aB[l][-1]
     eBf = eB[l][-1]
     pBf = aBf * (1 - eBf)
     apBf = aBf * (1 + eBf)
     aCf = aC[l][-1]
     eCf = eC[l][-1]
     pCf = aCf * (1 - eCf)
     apCf = aCf * (1 + eCf)
     minpB = min(pB[l])
     mintB = t[l][Merc.which(pB[l], minpB)]
     if not all(np.isnan(pC[l])):
         minpC = min(pC[l])
         mintC = t[l][Merc.which(pC[l], minpC)]
     elif l == 1:
         minpC, mintC = np.nan, np.array([np.nan])
     else:
         print('Warning: pC = nan, but vers not B-2!')
     iMf = iM[l][-1]
     rtrf = rtr[l][-1]
     rpf = rtrf / pBf
     rpm = rtrf / minpB
     # add to summary
     #		line = np.array([[dr,vrs,tf, aBf,eBf,pBf,apBf,
     #									 aCf,eCf,pCf,apCf,
     #						minpB,max(mintB),minpC,max(mintC),iMf,rtrf]])
コード例 #7
0
ファイル: ReadAllTimeDatas.py プロジェクト: RJWorth/AlphaCen
            thisdir = pd.read_csv('TimeData/TimeData-' + simID + '.txt',
                                  delim_whitespace=True)
            # Calculate non-time-dependent stats for this sim, and add to summary
            dr = d
            vrs = s
            tf = thisdir.t.iloc[-1]
            aBf = thisdir.aB.iloc[-1]
            eBf = thisdir.eB.iloc[-1]
            pBf = aBf * (1 - eBf)
            apBf = aBf * (1 + eBf)
            aCf = thisdir.aC.iloc[-1]
            eCf = thisdir.eC.iloc[-1]
            pCf = aCf * (1 - eCf)
            apCf = aCf * (1 + eCf)
            minpB = min(thisdir.pB)
            mintB = max(thisdir.t.iloc[Merc.which(thisdir.pB, minpB)])
            if not all(np.isnan(thisdir.pC)):
                minpC = min(thisdir.pC)
                mintC = max(thisdir.t.iloc[Merc.which(thisdir.pC, minpC)])
            elif '2' in s:
                minpC, mintC = np.nan, np.nan
            else:
                print(
                    'Warning: pC = nan, but subdir is {}, not a disk binary!'.
                    format(s))
            iMf = thisdir.iC.iloc[-1] - thisdir.iB.iloc[-1]
            rtrf = thisdir.rtr.iloc[-1]
            rpf = rtrf / pBf
            rpm = rtrf / minpB

            # make a dictionary of these stats, to enter as one line in the dataframe
コード例 #8
0
ファイル: PlotTimeData.py プロジェクト: RJWorth/AlphaCen
	# calculate minimum pericenter, last time it happens, and final i
	for ind,l in enumerate([0,1,2]):
		# get basic stats of this sim
		dr    = d
		vrs   = vers[l]
		tf    = t[l][-1]
		aBf   = aB[l][-1]
		eBf   = eB[l][-1]
		pBf   = aBf*(1-eBf)
		apBf  = aBf*(1+eBf)
		aCf   = aC[l][-1]
		eCf   = eC[l][-1]
		pCf   = aCf*(1-eCf)
		apCf  = aCf*(1+eCf)
		minpB = min(pB[l])
		mintB = t[l][Merc.which(pB[l],minpB)]
		if not all(np.isnan(pC[l])):
			minpC = min(pC[l])
			mintC = t[l][Merc.which(pC[l],minpC)]
		elif l==1:
			minpC, mintC = np.nan, np.array([np.nan])
		else:
			print('Warning: pC = nan, but vers not B-2!')
		iMf   = iM[l][-1]
		rtrf  = rtr[l][-1]
		rpf   = rtrf/pBf
		rpm   = rtrf/minpB
		# add to summary
#		line = np.array([[dr,vrs,tf, aBf,eBf,pBf,apBf,
#									 aCf,eCf,pCf,apCf,
#						minpB,max(mintB),minpC,max(mintC),iMf,rtrf]])
コード例 #9
0
ファイル: ReadAllTimeDatas.py プロジェクト: RJWorth/AlphaCen
			simID = d+'-'+s
			thisdir = pd.read_csv('TimeData/TimeData-'+simID+'.txt',delim_whitespace=True)
			# Calculate non-time-dependent stats for this sim, and add to summary
			dr    = d
			vrs   = s
			tf    = thisdir.t.iloc[-1]
			aBf   = thisdir.aB.iloc[-1]
			eBf   = thisdir.eB.iloc[-1]
			pBf   = aBf*(1-eBf)
			apBf  = aBf*(1+eBf)
			aCf   = thisdir.aC.iloc[-1]
			eCf   = thisdir.eC.iloc[-1]
			pCf   = aCf*(1-eCf)
			apCf  = aCf*(1+eCf)
			minpB = min(thisdir.pB)
			mintB = max(thisdir.t.iloc[Merc.which(thisdir.pB,minpB)])
			if not all(np.isnan(thisdir.pC)):
				minpC = min(thisdir.pC)
				mintC = max(thisdir.t.iloc[Merc.which(thisdir.pC,minpC)])
			elif '2' in s:
				minpC, mintC = np.nan, np.nan
			else:
				print('Warning: pC = nan, but subdir is {}, not a disk binary!'.format(s))
			iMf   = thisdir.iC.iloc[-1]-thisdir.iB.iloc[-1]
			rtrf  = thisdir.rtr.iloc[-1]
			rpf   = rtrf/pBf
			rpm   = rtrf/minpB

			# make a dictionary of these stats, to enter as one line in the dataframe
			line = {}
			for c in cols: