Quaternions: Magnitude of rotation about an arbitrary axis Given a unit quaternion in hamiltonian notiation $q$ which describes some arbitrary rotation of $\alpha$ about axis $\beta$ as
$$
  q =\begin{bmatrix} \cos(\alpha/2) \\ 
\sin(\alpha/2)\beta_x \\
\sin(\alpha/2)\beta_y \\
\sin(\alpha/2)\beta_z \\ 
\end{bmatrix} 
$$ 
how would I calculate the magnitude of rotation (in radians) that quaternion gives me about some arbitrary axis $v$?
As further clarification, what I mean by "magnitude of rotation about an arbitrary axis" would be the same as finding the angle $\alpha^\star$ which minimizes the angle $\tilde{\alpha}$ encoded by the "error" between the two quaternions $$ \tilde{q} = q^{-1} \otimes q^\star $$ where $$ q^\star =\begin{bmatrix} \cos(\alpha^\star/2) \\ 
\sin(\alpha^\star/2)v_x \\
\sin(\alpha^\star/2)v_y \\
\sin(\alpha^\star/2)v_z \\ 
\end{bmatrix} 
$$
and 
$$ \tilde q =\begin{bmatrix} \cos(\tilde\alpha /2) \\ 
\sin(\tilde\alpha /2)\tilde\beta_x \\
\sin(\tilde\alpha /2)\tilde\beta_y \\
\sin(\tilde\alpha /2)\tilde\beta_z \\ 
\end{bmatrix} 
$$
and $v=\begin{bmatrix} v_x & v_y & v_z \end{bmatrix}^\top$ is the arbitrary axis of rotation.
I believe that this calculation is similar to calculating euler angles from a quaternion, i.e. "yaw" is typically the amount of rotation about the $z$ axis, and is can be calculated with (link)
$$
\psi = \textrm{atan}\frac{2(q_w q_z + q_x q_y)}{ 1-2(q_y^2+q_z^2)}
$$
and you can form a quaternion with rotation only about $z$ through an angle $\psi$ with
$$q_\psi = \begin{bmatrix} \cos\left(\frac{\psi}{2}\right) & 0 & 0 & \sin\left(\frac{\psi}{2}\right) \end{bmatrix}^\top. $$
 A: First of all, I want to note that your formulas are slightly wrong: you should have, e.g., $q=(\cos(\alpha/2), \sin(\alpha/2)\beta_x, \sin(\alpha/2)\beta_y, \sin(\alpha/2)\beta_z)$, where ${\bf \beta}=(\beta_x, \beta_y, \beta_z)$ is the unit vector representing the rotation axis; instead you write $\cos(\beta_x/2)$, etc., which doesn't really make mathematical sense. I'll assume that all of the quaternions are in this corrected form in what follows.
Let's break this down a little bit. For clarity's sake, I'll use $\bf{q}$ for the imaginary (i.e. vector) part of $q$, and similarly $\bf{\widetilde{q}}$, etc; $\mathbf{v}$ here is the unit vector that you're trying to find a 'comparable' rotation around. (Note that by this notation, ${\bf q^\star}=\sin(\alpha^\star/2){\bf v}$).
By your own formula, we have $\widetilde{q} = q^{-1}q^\star$, and we're interested in finding a $q^\star$ that maximizes the real part of $\widetilde{q}$. (This is equivalent to minimizing the angle $\tilde{\alpha}$, since $\cos$ is a decreasing function in the domain we're interested in.)  But that part is $\widetilde{q}_w=(q^{-1})_wq^\star_w-{\bf q^{-1}}\cdot{\bf q^\star}$ $= \cos(\alpha/2)\cos(\alpha^\star/2) + \sin(\alpha/2)\sin(\alpha^\star/2){\bf \beta}\cdot{\bf v}$. (Sanity check: when ${\bf \beta\cdot v}=1$ — i.e., when they're the same vector — this expression is $\cos((\alpha-\alpha^\star)/2)$ and we maximize it by taking $\alpha^\star=\alpha$, which is what you'd expect.)
Now, in general, to maximize an expression of the form $a\cos(\theta)+b\sin(\theta)$, we can view it as the (2d) dot product of $(a,b)$ with $(\cos(\theta), \sin(\theta))$; seen this way, it's clear that the maximum is achieved when these two vectors are aligned — that is, when $\theta=\arctan(\frac ba)$.  Written in this form, you can see that the optimal $\alpha^\star$ is the one with $\tan(\alpha^\star/2)={\bf \beta\cdot v}\tan(\alpha/2)$.
A: Another way  is to find the rotation which is closest to $q$ but which has no component in the direction of $v$, then remove that intermediate quaternion, $\hat{q}$ from the original, $q$.
Notation:
$$
\begin{aligned}
R(q):& \, \textrm{rotation matrix formed from q (performs a passive rotation)}\\
(\cdot)^\times:& \, \textrm{skew-symmetric matrix}
\\
\exp(\cdot):& \, \textrm{Quaternion exponential map} \\
\otimes:& \, \textrm{quaternion multiplication operator}
\end{aligned}
$$
First, find a the quaternion closest to $q$ with no rotation about $v$.

*

*Rotate $v$ by $q$ to get $w$
$$ w = R\left(q\right)^\top v $$

*Then, use the exponential map of the quaternion to find the shortest rotation $\hat{q}$ between $w$ and $v$.  Being the shortest rotation, $\hat{q}$ by definition has no rotation about either $v$ or $w$.  Let $\theta=v^\top w$ be the angle of rotation and $\delta=(v)^\times w$ be the axis of rotation between $v$ and $w$.

$$ \hat{q} = \exp\left(\theta \delta\right) $$
Now remove this part of the rotation from $q$

*

*At this point, it's pretty straight-forward to find $q^\star$
$$ q^\star = q \otimes \hat{q}^{-1} $$
The nice thing about this approach is that it is easy to find on-manifold jacobians across this operation using Lie algebra techniques.
Compute the magnitude of rotation in $q^\star$
$$
\phi = 2\arccos(q_w)
$$
