calculate aspect ratio