Commit 98be41b9 authored by Zoheyr Doctor's avatar Zoheyr Doctor 🔭
Browse files

added some beginning code to

parent 0e92b11d
import numpy as np
class Binary:
def __init__(self,
frame_rate = 30.
omega = 2.
A class for representing binaries.
m1,m2: floats
masses of 1st and 2nd star, repsectively
c1,c2: matplotlib color
colors of 1st and 2nd star, respectively
inclination: float
inclination angle of binary wrt viewer
in degrees, between [0,90] deg.
azimuth: float
azimuthal angle of viewer in coordinates
of the binary, between [0,360] deg.
phase: float
phase of the binary, between [0,360] deg.
frame_rate: float
frames per second
omega: float
rotations per second
self.m1 = m1
self.m2 = m2
self.c1 = c1
self.c2 = c2
self.alpha = alpha
self.beta = beta
self.gamma = gamma
self._D = np.identity(3)
self._C = np.identity(3)
self._B = np.identity(3)
def alpha_rad(self):
return self.alpha*np.pi/180.
def beta_rad(self):
return self.beta*np.pi/180.
def gamma_rad(self):
return self.gamma*np.pi/180.
def phase1(self):
return self._phase1
def phase1(self,gamma_rad):
self._phase1 = gamma_rad % 2*np.pi
def phase2(self):
return self.phase1+np.pi
def orbit(self):
self.phase1 = self.phase1 +
def Dmatrix(self):
self._D[0,0] = self._D[1,1] = np.cos(self.alpha*np.pi/180..)
self._D[1,0] = -np.sin(self.alpha*np.pi/180.)
self._D[0,1] = np.sin(self.alpha*np.pi/180.)
return self._D
def Cmatrix(self):
self._C[1,1] = self._C[2,2] = np.cos(self.beta*np.pi/180.)
self._C[2,1] = -np.sin(self.beta*np.pi/180.)
self._C[1,2] = np.sin(self.beta*np.pi/180.)
return self._C
def Bmatrix(self):
self._B[0,0] = self._B[1,1] = np.cos(self.gamma*np.pi/180..)
self._B[1,0] = -np.sin(self.gamma*np.pi/180.)
self._B[0,1] = np.sin(self.gamma*np.pi/180.)
return self._B
def Amatrix(self):
return np.matmul(np.matmul(self.Bmatrix,self.Cmatrix),self.Dmatrix)
def pos1(self):
position of primary in XYZ coordinates of binary plane
def project(self):
class Single:
A class to define single stars.
def __init__(self,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment