OxIonics / ionics_fits

Small python fitting library with an emphasis on Atomic Molecular and Optical Physics
Apache License 2.0
1 stars 0 forks source link

Parameterisation of Rabi flops #31

Closed AUTProgram closed 1 year ago

AUTProgram commented 2 years ago

When reading the new code for fitting Rabi flops in models.rabi the first time, I felt that the docstring was not easy to read and the parameterisation not clear. I think we should improve the terminology used and be more careful in defining the various parameters.

Ultimately, a Rabi flopping experiment is a set of measurements of the probability $P(E)$ that some event $E$ of interest happens as the ion changes state due to an applied driving field. In our case, this event is usually "ion bright", but someone else might measure the fraction of events in which the ion is dark instead. So in general the variable y of this model could correspond to either event (or even some other observable being measured), therefore probably be best to continue not using "bright" or "dark". Similarly, the mapping from the atomic states $|0\rangle$ and $|1\rangle$ to the probability $P(E)$ is in the general case also arbitrary (depends on shelving procedure and the like), so have to be careful in referring to "0" or "1" explicitly. What is known, however, is that $$P(E) = P(E|0) P(0) + P(E|1) P(1)$$ where $P(E|i)$ denotes the conditional probability that event $E$ occurs given that the particle is in state $|i \rangle$, which depends on the readout process. The $P(i)$ are the underlying time-dependent populations. In the most general case, the atom can start out in an arbitrary superposition at $t = 0$, while the driving pulse may induce rotations around an arbitrary axis for any duration. The dependence $P(E,t)$ is then rather complicated and I believe that for example the maximum and minimum values of the curve $P(E,t)$ are not easily related to the readout parameters $P(E|i)$.

So for now it may be best for the model to require that the atom starts out in one of the states $|0\rangle$ or $|1\rangle$ at $t = 0$ (which I think holds for most of our experiments anyway). Even then, we still need an unambiguous, intuitive way of referring to the relevant quantities involved. I will define $$g(t) = \frac{1}{2} \frac{\Omega^2}{\Omega^2 + \delta^2} \left[1 - \mathrm{e}^{-t / \tau} \cos\left(\sqrt{\Omega^2 + \delta^2} t\right)\right]$$ If $|\psi(0) \rangle = |0 \rangle$, then at later times $P(1) = g(t)$ and $P(0) = 1 - g(t)$, whereas if $|\psi(0) \rangle = |1 \rangle$, then $P(1) = 1 - g(t)$ and $P(0) = g(t)$. Letting $P{\mathrm{init}}(1)$ denote the population in $|1 \rangle$ at $t = 0$, which under the conditions assumed here can only take the values 0 or 1, therefore write $P(1) = P{\mathrm{init}}(1) [1 - g(t)] + \left[1 - P_{\mathrm{init}}(1)\right] g(t)$. However, I believe this expression only holds if the particle starts out either in $|0 \rangle$ or $|1 \rangle$ and is not valid in the general case when particle may initially be in a superposition.

The probability of observing event $E$ can be written $$P(E) = P(E|0) + \left[P(E|1) - P(E|0)\right] P(1)$$ Taking into account expression for $P(1)$, it follows that not all of $P(E|0)$, $P(E|1)$ and $P{\mathrm{init}}(1)$ can be parameters in a fit. This is because the observed $P(E)$ is unchanged under the transformation $P(E|0) \rightarrow P(E|1)$, $P(E|1) \rightarrow P(E|0)$ and $P{\mathrm{init}}(1) \rightarrow 1 - P{\mathrm{init}}(1)$. This means that one of these quantities would always have to be fixed to the correct value by the user. In practice, this would probably be the initial population $P{\mathrm{init}}$ since the user typically knows what state the particle starts in. So $P_{\mathrm{init}}$ would not really be a parameter of the fit.

Now consider for example the case where particle starts out in $|0 \rangle$. With $W = \sqrt{\Omega^2 + \delta^2}$, find $$P(E) = P(E|0) + \left[P(E|1) - P(E|0)\right] \left(\frac{\Omega^2}{2 W^2} + \mathrm{e}^{-t / \tau} \left[\left(\frac{\Omega t}{2}\right)^2 \operatorname{sinc}^2\left(\frac{W t}{2 \pi}\right) - \frac{\Omega^2}{2 W^2}\right]\right)$$ The sinc function is defined as in numpy. For $\tau = \infty$, the maximum and minimum values that the curve for $P(E)$ reaches are given by $P(E|0) + \left[P(E|1) - P(E|0)\right] \Omega^2 / W^2$ and $P(E|0)$, respectively. Hence, the contrast is $d = \left[P(E|1) - P(E|0)\right] \Omega^2 / W^2$. This doesn't seem to match the expression for the contrast given in docstring and used in model function. Instead, get $$P(E) = P(E|0) + d /2 + \mathrm{e}^{-t / \tau} \left[\left(\frac{\Omega t}{2}\right)^2 \operatorname{sinc}^2\left(\frac{W t}{2 \pi}\right) - d/2\right]$$

\left[\left(1 - \mathrm{e}^{-t / \tau}\right) + \left(\frac{\Omega t}{2}\right)^2 \mathrm{e}^{-t / \tau} \operatorname{sinc}^2\left(\frac{W t}{2 \pi}\right)\right]

hartytp commented 2 years ago

So for now it may be best for the model to require that the atom starts out in one of the states or at (which I think holds for most of our experiments anyway)

Agreed. That was always my intention here, but we should add a note to the docs and maybe a runtime check to enforce it.

AUTProgram commented 2 years ago

I would therefore suggest the following changes to the Rabi model:

hartytp commented 2 years ago

I would therefore remove this parameter and instead require the user to pass it to the constructor of the model instance

ack. In that case we could make the argument a boolean to select the initial state.

AUTProgram commented 1 year ago

Issues addressed in https://github.com/OxIonics/ionics_fits/pull/42