def squeeze_constvol(pos,yfact=-1,zfact=-1):
    """Squeezes 3D positions along y and z axes while preserving volume.

    Args:
        pos (np.ndarray): (N,3) Positions.
        yfact (Optional[float]): Factor that y direction is squeezed by. 
            (0 < yfact < 1)
        zfact (Optional[float]): Factor that z direction is squeezed by. 
            (0 < zfact < 1)

    Returns:
        pos (np.ndarray): (N,3) Transformed positions.

    """
    squfact = 1.0
    if yfact > 0:
        squfact*=yfact
        pos[:,1]*=yfact
    if zfact > 0:
        squfact*=zfact
        pos[:,2]*=zfact
    pos*=(squfact**(-1./3.))
    return pos