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. $$
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$.
$$ \hat{q} = \exp\left(\theta \delta\right) $$
Now remove this part of the rotation from $q$
$$ 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) $$