import numpy as np import numpy.linalg as LA from .scenes import StaticDoubleStarScene from rotation import normalize from rotation import deg2rad, rad2deg # these settings should go into a config file # replace by rotaton.Rotator(rotation.e2w)(...) def euler(w, e): """ allows some initial inclination to be given to the spin vector of star 1 or 2 ## deg2rad, rad2deg: Allows for easy conversion from degrees -> radians and radians -> degrees Omega_ = e[0] : Longitude of ascending node Angle (radians) I_ = e[1] : Inclination Angle (radians) w_ = e[2] : Arguement of periastron Angle (radians) Aw, AI, AOmega : Rotation matrices A_tot : Combined rotation matrix #Output# w_rot : Spin vector after rotation matrix has been applied *** adopted from Ben Shaw *** intrinisic active transformation about e[0], e[1], e[2], in that order """ e = np.asarray(e) * deg2rad sW, sI, sw = np.sin(e) cW, cI, cw = np.cos(e) Aw = np.array([[cw, -sw, 0], [ sw, cw, 0], [0, 0, 1]]) AI = np.array([[ 1, 0, 0], [ 0, cI, -sI], [0, sI, cI]]) AW = np.array([[cW, -sW, 0], [ sW, cW, 0], [0, 0, 1]]) A = np.matmul(AW, np.matmul(AI, Aw)) return np.dot(A, w) class DIHerculisStatic(StaticDoubleStarScene): _name = "DI Herculis" XMSUN = 1.9891e33 GRAV = 6.67259e-8 RSUN = 6.98e10 AU = 1.4959787e13 _s1 = 2.68 * RSUN _s2 = 2.48 * RSUN _m1 = 5.15 * XMSUN _m2 = 4.52 * XMSUN _an = 0.201 * AU _en = 0.489 _e = np.array([1., 0., 0.]) _ee = normalize(_e) _e = _ee * _en _hn = np.sqrt(GRAV * (_m1 + _m2) * _an * (1 - _en**2)) _h = np.asarray([0., 0., 1.]) * _hn _h = np.cross(np.cross(_h, _ee), _ee) _he = _h / LA.norm(_h) _v1 = 1.08e7 _v2 = 1.16e7 _e1 = np.asarray([0, 72, 0]) _e2 = np.asarray([0, -84, 0]) _w1 = np.asarray([0., 0., 1.]) * _v1 / _s1 _w2 = np.asarray([0., 0., 1.]) * _v2 / _s2 _w1 = euler(_w1, _e1) _w2 = euler(_w2, _e2) _spinscale = 0.2 _campos = np.asarray([-46.3, 69.3, -60.7]) _camup = np.asarray([0.37, -0.46, -0.8]) _cycle = True def setup_parameters(self, *args, **kwargs): self.resolve_defaults(kwargs) super().setup_parameters(*args, **kwargs) class CVVelorumStatic(StaticDoubleStarScene): _name = "CV Velorum" XMSUN = 1.9891e33 GRAV = 6.67259e-8 RSUN = 6.98e10 AU = 1.4959787e13 _s1 = 4.09 * RSUN _s2 = 3.95 * RSUN _m1 = 6.09 * XMSUN _m2 = 5.98 * XMSUN _an = 0.162 * AU _en = 0. _e = np.array([1., 0., 0.]) _ee = normalize(_e) _e = _ee * _en _hn = np.sqrt(GRAV * (_m1 + _m2) * _an * (1 - _en**2)) _h = np.asarray([0., 0., 1.]) * _hn _h = np.cross(np.cross(_h, _ee), _ee) _hn = LA.norm(_h) _he = normalize(_h) _v1 = 2.15e6 _v2 = 2.06e6 _e1 = np.asarray([0, -52, 0]) _e2 = np.asarray([0, 3, 0]) _w1 = np.asarray([0., 0., 1.]) * _v1 / _s1 _w2 = np.asarray([0., 0., 1.]) * _v2 / _s2 _w1 = euler(_w1, _e1) _w2 = euler(_w2, _e2) _spinscale = 2. _campos = np.asarray([-57, 42, 14]) _camup = np.asarray([0.066, -0.204, 0.977]) _camfocus = np.asarray([-1.1344, -1.7467, 1.0317]) _lightpos = np.asarray([0., 10., 15.]) _cycle = True def setup_parameters(self, *args, **kwargs): self.resolve_defaults(kwargs) super().setup_parameters(*args, **kwargs) class NYCepheiStatic(StaticDoubleStarScene): _name = "NY Cephei" XMSUN = 1.9891e33 GRAV = 6.67259e-8 RSUN = 6.98e10 AU = 1.4959787e13 _s1 = 6.0 * RSUN _s2 = 5.8 * RSUN _m1 = 10.7 * XMSUN _m2 = 8.8 * XMSUN _an = 0.319 * AU _en = 0.443 _e = np.array([1., 0., 0.]) _ee = normalize(_e) _e = _ee * _en _hn = np.sqrt(GRAV * (_m1 + _m2) * _an * (1 - _en**2)) _h = np.asarray([0., 0., 1.]) * _hn _h = np.cross(np.cross(_h, _ee), _ee) _he = _h / LA.norm(_h) _v1 = 7.8e6 _v2 = 1.54e7 _e1 = np.asarray([0, 2, 0]) _e2 = np.asarray([0, 2, 0]) _w1 = np.asarray([0., 0., 1.]) * _v1 / _s1 _w2 = np.asarray([0., 0., 1.]) * _v2 / _s2 _w1 = euler(_w1, _e1) _w2 = euler(_w2, _e2) _spinscale = .5 _campos = np.asarray([-57, 42, 14]) * 2 _camup = np.asarray([0.066, -0.204, 0.977]) _camfocus = np.asarray([-1.1344, -1.7467, 1.0317]) _cycle = True def setup_parameters(self, *args, **kwargs): self.resolve_defaults(kwargs) super().setup_parameters(*args, **kwargs)