Exemple #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
Exemple #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
Exemple #3
0
def angle_to_radius(angle, distance):
    """Radius (pc), distance(kpc), angle(deg)"""
    return tan(radians(angle)) * kpc.to(pc) * distance
Exemple #4
0
def radius_to_angle(radius, distance):
    """Radius (pc), distance(kpc), angle(deg)"""
    return degrees(arctan(kpc.to(pc) * radius / distance))
Exemple #5
0
def flux_to_luminosity(flux, distance):
    """Distance is assumed to be in kpc"""
    return flux * (4 * pi * (kpc.to(cm) * distance) ** 2)
Exemple #6
0
def luminosity_to_flux(luminosity, distance):
    """Distance is assumed to be in kpc"""
    return luminosity / (4 * pi * (kpc.to(cm) * distance) ** 2)