def convert2MSAcenter(xin, yin, xtin, ytin, arcsec):
    """
    This function is a python translation of Tonys IDL equivalent function. It converts the
    measured coordinates of each star into the frame relative to the center of the MSA.
    Args:
        xin: numpy array of the measured V2s
        yin: numpy array of the measured V2s
        xtin: numpy array of true V2s
        ytin: numpy array of true V3s

    Returns:
        4 numpy arrays: x, y, xt, yt - Corrected arrays
    """
    # Center coordinates of NIRSpec V2, V3
    x0_XAN = 376.769       # V2 in arcsec
    y0_YAN = -428.453      # V3 in arcsec

    # measured V2 V3 in degrees
    if arcsec:
        x0 = x0_XAN            # conversion of V2 to XAN in degrees
        y0_YANd = y0_YAN       # intermediate conversion: V3 arcsec to V3 degrees=-0.119015
        y0 = -y0_YANd -468.0   # convert V3 degrees to YAN=+0.249015
    else:
        x0 = x0_XAN/3600.      # conversion of V2 to XAN in degrees
        y0_YANd = y0_YAN/3600. # intermediate conversion: V3 arcsec to V3 degrees=-0.119015
        y0 = -y0_YANd -0.13    # convert V3 degrees to YAN=+0.249015

    # convert inputs to MSA center
    x = xin - x0
    y = yin - y0
    xt = xtin - x0
    yt = ytin - y0
    return x, y, xt, yt