Ejemplo n.º 1
0
 def translate(self, tvec, inner):
     self.pointmass = glb.translate_point_array(self.pointmass, tvec)
     self.com += tvec
     if self.inner and inner:
         self.qlm = trs.translate_qlm(self.qlm, tvec)
     elif self.inner and not inner:
         self.inner = False
         self.qlm = trs.translate_q2Q(self.qlm, tvec)
     else:
         self.qlm = trs.translate_Qlmb(self.qlm, tvec)
Ejemplo n.º 2
0
def test_q2Q():
    """
    Check that the inner to outer translate method matches PointGravity. This
    translation method is worse for smaller translations. For R=10, the error
    approaches 1e7*epsilon.
    """
    d = 1
    R = 100
    m, M = 1, 1
    dr = 99
    m1 = np.array([[m, d, 0, 0], [m, -d, 0, 0]])
    m2 = np.array([[M, R, 0, 0], [M, -R, 0, 0]])
    # Create inner moments of each points at +/-r
    qm0 = pgm.qmoments(10, np.array([m1[0]]))
    qm0b = pgm.qmoments(10, np.array([m1[1]]))
    # Get outer moments of points at +/-R
    Qm2 = pgm.Qmomentsb(10, m2)
    # Find outer moments from inner qm0 and qm0b translated to +/-R
    Qlm = trs.translate_q2Q(qm0, [dr, 0, 0])
    Qlmb = trs.translate_q2Q(qm0b, [-dr, 0, 0])
    assert (abs(Qlm+Qlmb-Qm2) < 11*np.finfo(float).eps).all()
Ejemplo n.º 3
0
cylhtot = np.copy(cylh3i)
cylhtot += rot.rotate_qlm(cylh3i, np.pi/3, 0, 0)
cylhtot += rot.rotate_qlm(cylh3i, 2*np.pi/3, 0, 0)
cylhtot += rot.rotate_qlm(cylh3i, np.pi, 0, 0)
cylhtot += rot.rotate_qlm(cylh3i, 4*np.pi/3, 0, 0)
cylhtot += rot.rotate_qlm(cylh3i, 5*np.pi/3, 0, 0)
cylhtot += cylh2i
cylhtot += rot.rotate_qlm(cylh2i, np.pi/2, 0, 0)
cylhtot += rot.rotate_qlm(cylh2i, np.pi, 0, 0)
cylhtot += rot.rotate_qlm(cylh2i, 3*np.pi/2, 0, 0)
#cyltot += cylhtot

# create a test-mirror
tm = qlm.cylinder(LMax, mtm, htm, rtm)
tm = rot.rotate_qlm(tm, np.pi/2, np.pi/2, -np.pi/2)
tm = trs.translate_q2Q(tm, [dx, dy, 0])

# Figure out the force at different rotor angles
nAng = 120
forces = np.zeros([nAng, 3], dtype='complex')
nlm, nc, ns = mplb.torque_lm(LMax, cyltot, tm)
dphi = 2*np.pi/nAng
# Now rotate the cylindrical test-masses through various angles and calculate
# the forces
# seems like last rotation matrix may have error, compute extra to be safe
ds = rot.wignerDl(LMax+1, dphi, 0, 0)
for k in range(nAng):
    print('Angle = ', np.round((k+1)*dphi*180/np.pi, 2), ' degrees')
    cyltot = rot.rotate_qlm_Ds(cyltot, ds[:-1])
    forces[k] = mplb.multipole_force(LMax, cyltot, tm, 0, 0, 0)