Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

David/fixes split data fit #324

Merged
merged 27 commits into from
May 10, 2023
Merged

Conversation

DavidSarlle
Copy link
Contributor

This branch contins some fixes for PR #279.

Mostly fixes:

  • Lorentzian fit failures
  • Flipping fit
  • Drag tunning fit
  • some minor changes in plotting

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

DavidSarlle and others added 23 commits April 25, 2023 19:03
Copy link
Contributor

@andrea-pasquale andrea-pasquale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DavidSarlle for implementing this.
Please find below a few comments, nothing critical just some minor changes.

runcards/actions_qq.yml Outdated Show resolved Hide resolved
runcards/autocalibration_qblox.yml Outdated Show resolved Hide resolved
src/qibocal/protocols/characterization/classification.py Outdated Show resolved Hide resolved
src/qibocal/protocols/characterization/classification.py Outdated Show resolved Hide resolved
Comment on lines 234 to 235
f"q{qubit} | amplitude_correction_factor: {fit.amplitude_factors[qubit]:.4f}<br>"
+ f"q{qubit} | corrected_amplitude: {fit.amplitudes[qubit][0]:.4f}<br><br>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again keep capital letter at least for first word of each entry in the table.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -274,7 +274,7 @@ def _plot(data: RamseyData, fit: RamseyResults, qubit):
fitting_report
+ (f"{qubit} | delta_frequency: {fit.delta_phys[qubit]:,.1f} Hz<br>")
+ (f"{qubit} | drive_frequency: {fit.frequency[qubit] * 1e9} Hz<br>")
+ (f"{qubit} | T2: {fit.t2[qubit]:,.0f} ns.<br><br>")
# + (f"{qubit} | T2: {fit.t2[qubit]:,.0f} ns.<br><br>")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I think that we can keep T2 as an estimate.
It will not be modified in the runcard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"qubit": ro_pulse.qubit,
}
data.add(r)
count += 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

count can be removed I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines +91 to +104
# execute the pulse sequence
results = platform.execute_pulse_sequence(sequence)

# retrieve the results for every qubit
for ro_pulse in ro_pulses.values():
z_proj = 2 * results[ro_pulse.serial].ground_state_probability - 1
# store the results
r = {
"probability": z_proj,
"gateNumber": gateNumber,
"beta_param": params.beta_param,
"qubit": ro_pulse.qubit,
}
data.add(r)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I believe that the indentation was corrected before. Did you test it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested and it works as expected

Comment on lines 80 to 104
f0 = guess_center
fit_res = lmfit.model.ModelResult(model=model_Q, params=guess_parameters)

frequency[qubit] = f0

if data.power_level is PowerLevel.high:
bare_frequency[qubit] = f0

amplitudes[qubit] = data.amplitude
attenuations[qubit] = data.attenuation
fitted_parameters[qubit] = fit_res.params.valuesdict()

if data.power_level is PowerLevel.high:
return {
"frequency": frequency,
"fitted_parameters": fitted_parameters,
"bare_frequency": bare_frequency,
"amplitude": amplitudes,
}
else:
return {
"frequency": frequency,
"fitted_parameters": fitted_parameters,
"amplitude": amplitudes,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this part is not needed.
It should already be in _fit of resonator_spectroscopy.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the very beggining was in inside the lorentzian_fit. Sorry, I did not update after someone change it.
Fixed

Copy link
Contributor

@andrea-pasquale andrea-pasquale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DavidSarlle for implementing this.
Please find below a few comments, nothing critical just some minor changes.

@scarrazza scarrazza merged commit 90b5c18 into split_data_fit May 10, 2023
@scarrazza scarrazza deleted the david/fixes_split_data_fit branch May 10, 2023 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants