Beispiel #1
0
def spherical_velocity(x, y, z, vx, vy, vz):
    """Computes the projected angular velocity in spherical coordinates."""
    d = sqrt(x ** 2 + y ** 2 + z ** 2)
    r = sqrt(x ** 2 + y ** 2)
    
    v_lon = degrees(1. / (kpc.to(km) * r) * (-y * vx + x * vy)) * year.to(second) * 1e6
    v_lat = (degrees(vz / (sqrt(1 - (z / d) ** 2) * kpc.to(km) * d ) - 
              sqrt(vx ** 2 + vy ** 2 + vz ** 2) * z / 
              (kpc.to(km) * (sqrt(1 - (z / d) ** 2) * d ** 2))) * year.to(second) * 1e6)
    return v_lon, v_lat
Beispiel #2
0
def motion_since_birth(x, y, z, v, age, theta, phi):
    """Takes x[kpc], y[kpc], z[kpc], v[km/s] and age[years] chooses an arbitrary direction
    and computes the new position. Doesn't include any galactic potential modelation.
    Returns the new position."""
    vx = v * cos(phi) * sin(theta)
    vy = v * sin(phi) * sin(theta)
    vz = v * cos(theta)

    age = year.to(second) * age

    # Compute new positions
    x = x + kpc.to(km) * vx * age
    y = y + kpc.to(km) * vy * age
    z = z + kpc.to(km) * vz * age

    return x, y, z, vx, vy, vz