def amplitude_calc(x, p, beta=1, alpha=0):
    """
    Simple amplitude calculation of position and momentum coordinates
    relative to twiss beta and alpha. 

    J = (gamma x^2 + 2 alpha x p + beta p^2)/2
        
      = (x_bar^2 + px_bar^2)/ 2
      
    where gamma = (1+alpha^2)/beta
    
    """
    return (1+alpha**2)/beta/2 * x**2 + alpha*x*p + beta/2*p**2