Skip to content

Add child data support to ExperimentData#451

Merged
chriseclectic merged 14 commits into
qiskit-community:mainfrom
chriseclectic:expdata
Nov 4, 2021
Merged

Add child data support to ExperimentData#451
chriseclectic merged 14 commits into
qiskit-community:mainfrom
chriseclectic:expdata

Conversation

@chriseclectic
Copy link
Copy Markdown
Collaborator

@chriseclectic chriseclectic commented Oct 22, 2021

Summary

This PR build on #364 to integrate the parent-child experiment data relationships supported in the experiment DB into the ExperimentData class. The main motivation for this is to remove having multiple subclasses of ExperimentData so that all experiments use the same data class, and this is the only user facing data class for interacting with experiment results and result database.

Details and comments

A couple of other API changes included in this PR are:

  • Remove CompositeExperimentData class (functionality is now in ExperimentData)
  • remove __experiment_data__ attribute from BaseExperiment
  • Remove experiment_data kwarg from BaseExperiment.run.
  • Add add_child_data methods to ExperimentData for adding a child experiment data container
  • Add child_data method to ExperimentData for accessing child data containers (this is same functionality of previous component_experiment_data from CompositeExperimentData). The component naming was changed to child to avoid confusion with the experiment components used for defining experiments and analysis results.

@chriseclectic chriseclectic force-pushed the expdata branch 2 times, most recently from 828acf9 to 21f0296 Compare October 22, 2021 21:57
yaelbh
yaelbh previously requested changes Oct 26, 2021
Copy link
Copy Markdown
Collaborator

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

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

Partition to at least three smaller PRs. For example (similar to what you wrote):

  • Removal of CompositeExperimentData.
  • Refactor of AnalysisResult.run and creation of AnalysisResult.run_analysis.
  • A new update parameter in AnalysisResult.run and removal of experiment_data from the list of parameters of BaseExperiment.run.
  • blcok_for_jobs refactor.
  • Removal of __experiment_data__ from BaseExperiment.

It appears that the existing tests are not enough for testing these changes. I think I found a few bugs, if indeed then this means that effort has to be done to increase test coverage and better verify the changes.

#209 is relevant in this context. I started to work on #209 for T1. Think how you can test stuff that's related to saving and loading without waiting for #209 to be done.

Comment thread qiskit_experiments/database_service/db_experiment_data.py
Comment thread qiskit_experiments/framework/base_analysis.py Outdated
Comment thread qiskit_experiments/framework/base_analysis.py Outdated
Comment thread qiskit_experiments/framework/base_experiment.py Outdated
if not isinstance(experiment_data, CompositeExperimentData):
raise QiskitError("CompositeAnalysis must be run on CompositeExperimentData.")
# Maginalize data
self._marginalize_data(experiment_data)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Previously the data was marginalized in CompositeExperimentData, now it happens during analysis. But this new location is incorrect. Data can change without performing analysis.

In addition, if we rerun analysis on data that wasn't changed since the last time, we rerun _marginalize_data, which is not needed and can be expensive.

And: what if we analyze only a child, without analyzing the parent, while the data was changed once: the child analysis will be carried out on the old data, without being updated.

Comment thread qiskit_experiments/database_service/db_experiment_data.py
Comment thread test/calibration/experiments/test_rabi.py
Comment thread test/quantum_volume/test_qv.py
Comment thread test/test_composite.py Outdated
Comment thread test/test_composite.py Outdated
@chriseclectic
Copy link
Copy Markdown
Collaborator Author

@yaelbh Split out two separate PR for changes to BaseExperiment.run (#463), and BaseAnalysis.run (#464) which should be merged before this.

@chriseclectic chriseclectic force-pushed the expdata branch 2 times, most recently from 9a4733f to 586d17c Compare November 2, 2021 15:03
@chriseclectic
Copy link
Copy Markdown
Collaborator Author

@yaelbh I've reworked the composite experiment so that all the handling of child experiment data and marginalization is in the analysis class. Unfortunately this still depends on the original composite experiment (but no longer the child data already being initialized). Eventually I'd like to remove this dependency but that will have to wait till after refactoring how analysis class and metadata is handled in the experiment framework.

@yaelbh
Copy link
Copy Markdown
Collaborator

yaelbh commented Nov 3, 2021

We face the following constraints:

  1. Sub-experiments data must be updated whenever data is added, for the reasons that I outlined in Add child data support to ExperimentData #451 (comment).
  2. You want to be able to analyze data that was constructed without calling add_data.

I see two solutions. I’m OK with both, although I'm very strongly inclined towards the first one. They both require to externalize the method that computes sub-experiments data from the main data.

  1. Maintain an invariant that sub-experiments data must all the time be consistent with the main data. If you construct your data using add_data, then add_data guarantees for you that the invariant is respected. Otherwise, if you construct your data in any other way, then it’s your responsibility to maintain the invariant (you’re invited to use a method that we provide for updating sub-experiments data).
  2. Sub-experiments data is computed in both locations: in add_data, and also during analysis. We can in addition (not mandatory) introduce a Boolean flag that signals whether the sub-experiments are up-to-date.

As a side note, I think _marginalize_data should work directly on the experiment data (and not on experiment_data.data()). Metadata of experiment_data.data is very similar to experiment_data.metadata and can probably be removed. Instead of working with composite_index, composite_clbits etc., work with the information that's stored in the experiment data and its descendants. But anyway, this is only a side note, not for this PR.

@chriseclectic
Copy link
Copy Markdown
Collaborator Author

In my view in general a child experiment data is independent of its parent. It's just connected via an ID and a user can create or remove that connection if they want to (I'm not sure how removing works with DB, something to try), so adding data to either one doesn't intrinsically have anything to do with the other. We could make the add_child_data method internal (_add_child_data) so for now a user won't create this connection arbitrarily though.

CompositeExperiments are a specific use case (and for the moment the only use case), and in this case the child-data is a by-product of analysis of the main experiment data. That is why I think marginalization and creation of the marginalized child data should be entirely handled by the analysis of that experiment. In this case if you modify a child experiment, but then re-run the main analysis, you will lose your changes since it will be overridden by the regeneration of data and results from the main analysis.

The circuit level metadata can't be moved to the main experiment, since then there is no way to combine experiments with different number of circuits, because each circuit may only contain some subset of the component experiments, not all of them. Each circuit could also contain different numbers of classical bits so the bits being marginalized to for each sub experiment can change on a circuit to circuit basis.

@chriseclectic chriseclectic force-pushed the expdata branch 2 times, most recently from a7bd841 to 922ba5a Compare November 3, 2021 18:30
Copy link
Copy Markdown
Collaborator

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

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

I like the new approach this PR implements. But the logic in CompositeAnalysis._run_analysis is complicated so more documentation is necessary for friendliness for developers. Once one finds ExperimentData.child_data is not automatically created, it's easy to read the logic but otherwise this looks super complicated.

if not isinstance(experiment_data, CompositeExperimentData):
raise QiskitError("CompositeAnalysis must be run on CompositeExperimentData.")
composite_exp = experiment_data.experiment
component_exps = composite_exp.component_experiment()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
component_exps = composite_exp.component_experiment()
component_exps = composite_exp.component_experiments()

?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is the current name of the method in the CompositeExperiment class

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is suggestion from @wshanks #460 (comment)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It could be changed, would just be an API change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

component_experiment() could be kept if desired. It seems to me like making component_experiments a property that gives back _experiments would be best. My point in that comment was that the API of a function with a singular name that takes an index and returns one value and also takes no input and gives back all values is confusing, so I would just make a separate plural API point that gives back all the values and has a plural name for that case.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I would also be fine with just having the plural version and allowing it to take None, int or slice to return all, single, or subset like we do with analysis_resultsand child_data, but that can be done in separate PR

Comment thread qiskit_experiments/framework/composite/composite_experiment.py
component_metadata.append(
{
"job_ids": [job.job_id() for job in jobs],
"experiment_options": copy.copy(sub_exp.experiment_options.__dict__),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"experiment_options": copy.copy(sub_exp.experiment_options.__dict__),
"experiment_options": sub_exp.experiment_options.__dict__.copy(),

probably this is simpler?

Comment thread qiskit_experiments/framework/experiment_data.py
"""Load a saved experiment data from a database service.
def add_child_data(self, experiment_data: ExperimentData):
"""Add child experiment data to the current experiment data"""
experiment_data._parent_id = self.experiment_id
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overriding parent_id of the experiment_data without changing its id doesn't break reference structure in the remote db? (If it is retrieved from db)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good question! Need to check what happens if you change the parent ID of data already saved to DB. I expected it was just a field that could be changed, but havent tested myself.

Comment thread qiskit_experiments/framework/experiment_data.py Outdated
Comment thread releasenotes/notes/update_expdata-ab3576f3bdd5057a.yaml Outdated

comp_exp = experiment_data.experiment
# Add component job metadata
sub_exp_data._metadata["job_metadata"] = [component_metadata[i]]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
sub_exp_data._metadata["job_metadata"] = [component_metadata[i]]
sub_exp_data._metadata["job_metadata"].update(component_metadata[i])

component_metadata can be empty (I guess this is the case when manually adding retrieved data). This should not override original data.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is intended to override the data. Since these containers are dynamically created and updated by analysis there is no reason to keep any previous job data (There is actually no need to have this as a list in base experiment since #463 , since you can't re-run in an existing container).

Comment thread qiskit_experiments/framework/composite/composite_analysis.py Outdated
Comment thread qiskit_experiments/framework/composite/composite_analysis.py Outdated
Copy link
Copy Markdown
Collaborator

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

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

I'm trying to review the code but I'm getting lost, especially in composite_analysis.py. Can you please add, somewhere in the code, an extensive documentation of the data structures of: experiment_data, experiment_data.data, experiment_data.metadata, experiment_data.data.metadata. What do you expect in each? What are the keys that are expected to exist in the different dictionaries, what do their values mean and what are their data structures, in which cases would these keys exist? What are the attributes that are expected to exist in different class objects, what do their values mean and what are their data structures, in which cases would these attributes exist? What about circuit level data, which information goes there, when, and why? How is the information propagated, what's its flow - for example, I think circuit data is copied to experiment_data.data in DbExperimentData.add_data - is this correct? Any other things are copied from one place to another: if yes, then what and when, can the original or the copy change after the copy, and what happens then?

Please illustrate a few common use cases. When and where can data be added or modified, for parents and children, when and where can analysis be carried on, for parents and children? What are the consequences of such operations on the data structures, for the case where replace_results is True, and for the case where it's False? When and where are the sub-experiment data created?

It all feels delicate and fragile. I wouldn't know to maintain it and I can't review it. I hope that good documentation will be enough to solve this, and that we won't have to further change the code for an improved design. But I can't tell for now.

raise QiskitError("CompositeAnalysis must be run on CompositeExperimentData.")
composite_exp = experiment_data.experiment
component_exps = composite_exp.component_experiment()
if "component_job_metadata" in experiment_data.metadata:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't understand these lines. What does the existence of component_job_metadata in the metadata mean, and why, if it exists, are you taking the last of experiment_data.metadata["component_job_metadata"][-1] ? Please write inline documentation to explain.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If I understand correctly the component_job_metadata is another set of metadata to initialize child experiment data. This is generated per job run so this means the last set of children. The metadata also contains job_metadata but this represents configurations of a full set of composite experiment (i.e. parent) so this doesn't help analysis. I don't think job_metadata is really necessary for composite experiment (more specifically, only run options is necessary to reconstruct experiment because other configs are usually unique to children).

Copy link
Copy Markdown
Collaborator

@nkanazawa1989 nkanazawa1989 Nov 4, 2021

Choose a reason for hiding this comment

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

The important point we need to understand here is children is not generated by job execution, but this is generated on the fly by analysis. This is because experiment data child is not limited only to the composite, but also, for example, we can create pseudo RDB of experiment data. i.e.

my_all_result_for_writing_prx_paper = ExperimentData()
my_all_result_for_writing_prx_paper.add_child_data(my_data_of_calibration)
my_all_result_for_writing_prx_paper.add_child_data(my_data_of_rb)
my_all_result_for_writing_prx_paper.add_child_data(my_data_of_quantum_volume)
etc...

then we can write my_all_result_for_writing_prx_paper id in paper for reproducibility.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is to deal with how regular ExperimentData stores job metadata, which is used by some analysis (curve analysis in particular i think). If its not there certain experiments analysis wont run (note I think this should be changed, but it's beyond the scope of this PR).

Since each component experiment might need this for its respective analysis to work this is just storing the list of these component job metadata in the parent experiment so it can be added later along with the marginalized data. Previously this was all done when calling run which initialized all the child containers, but this is just moving it to analysis.

The [-1] was because this structure is a list for each run job, and you want the most recent one (same as job_metadata). Since #463 this isn't really necessary since you can't re-run more experiment jobs into the same container.

Change child data to be stored as a ThreadSafeOrderedDict instead of ThreadSafeList, where the keys are the child experiment ids. This allows child data to also be looked up by experiment id as well as index. The child ids are now only copied to metadata when saving to DB, and popped back off metadata when loading.
This change moves all creation and update of child experiment data for a composite experiment into the `CompositeAnalysis._run_analysis method`.
Looking at a component experiment in result DB it is not currently possible to tell if its analysis has run or not yet. This adds a list of analysis results for each component experiment to store the experiment id and experiment type for convenient viewing in the online DB.
@chriseclectic chriseclectic added this to the Release 0.2 milestone Nov 4, 2021
This adds back in functionality to initialize the empty child data containers during CompositeExperiment.run, so that if someone does `expdata.child_data` before analysis has run they can access the empty containers. The current analysis logic still works on this case, but will also be able to initalize these child data if they arent already there, such as when loading experiment data from a composite experiment job ID instead of a saved experiment.
@chriseclectic
Copy link
Copy Markdown
Collaborator Author

@yaelbh The main use cases haven't changed. You can run parallel and batch experiments the same as you could before. The only difference is the component experiments data is cleared and as part of analysis.run instead of experiment.run since this is significantly more robust than how it was handled before. It was more delicate and fragile before these changes.

Eg you can use it like:

par_exp = ParallelExperiment([StateTomography(XGate(), qubits=[i]) for i in range(3)])
par_data = par_exp.run(sim).block_for_results()
for sub_data in par_data.child_data():
    print(sub_data.experiment_type)
    for result in sub_data.analysis_results():
        print(result)

Then if you want to try and break things you can add some dummy child data from another experiment:

other_data = StandardRB(qubits, lengths).run(backend)
par_data.add_child_data(other_data)

If you now re-run analysis, these added experiments will be copied but not modified, while the actual component experiments will have their data regenerated and analysis rerun (clearing all previous data and analysis results):

par_data2 = par_exp.run_analysis(par_data).block_for_results()

Same if you do replace results the extra child experiments that aren't from the composite experiment are just left unchanged, while the component experiments will have their data cleared and re-generated, and any existing analysis results updated by the re-run of analysis.

par_exp.run_analysis(par_data2, replace_results=True).block_for_results()

@yaelbh
Copy link
Copy Markdown
Collaborator

yaelbh commented Nov 4, 2021

Thanks for the answer. My question also refers to internal implementation. Suppose that in some location in the code, there is a bug because some metadata field is not updated while it should have been updated. As a reviewer (and future maintainer) I have no way to catch it, because I'm not aware of this metadata field in the first place... This is why I'm asking for a description of the classes involved, their attributes and metadata keys, and how (if everything works correctly) they're supposed to change following operations.

I agree that it's more robust than before. But this effort (made for the sake of robustness) to identify when to copy instead of modifying, and the operations themselves of copying and modifying, introduce complexity to the code (without competition with how it was before 😄).

Copy link
Copy Markdown
Collaborator

@nkanazawa1989 nkanazawa1989 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@chriseclectic
Copy link
Copy Markdown
Collaborator Author

@yaelbh I agree with these issues regarding metadata and it not being very clear what is needed and where it is used in the internal code. Me and @nkanazawa1989 have been discussing some ideas for how to improve this, but that will be tackled in a separate follow-up PR since it is more complex and will effect all experiments. The hope is having his PR in place first will make that easier to start since there is only one ExperimentData class that needs updating, and composite experiments are updated to behave more like regular experiments with this more standard separation of job execution and data analysis.

@yaelbh
Copy link
Copy Markdown
Collaborator

yaelbh commented Nov 4, 2021

Metadata keys are particularly difficult because they're kind of hiding, like kwargs. I find it confusing (not only in this PR but also more generally in qiskit-experiments and even in Qiskit) that properties are sometimes represented as class attributes, and sometimes as dictionary items in the metadata attributes. I don't always follow why a certain property is represented as an item in the metadata. It seems to me that attributes should be preferred if possible because they're more structured and explicit.

@nkanazawa1989
Copy link
Copy Markdown
Collaborator

nkanazawa1989 commented Nov 4, 2021

I agree. But currently this dict is used everywhere in the codebase. If we want to change it, we need to review tons of (extra) files for minor change. Documentation for dict keys in this PR is not necessary because later we can replace it with more structured data.

@yaelbh
Copy link
Copy Markdown
Collaborator

yaelbh commented Nov 4, 2021

Ok, so don't change the code, but if you can document the current situation, this will be very helpful. Another option, if you and @nkanazawa1989 plan to change the code very soon, and are confident that the current code is ok, and don't want to spend the effort of documenting something that will soon be removed, is that I dismiss my review. But please pick this option only if you're really going to make these changes soon.

@nkanazawa1989
Copy link
Copy Markdown
Collaborator

Yeah probably we can write an issue to track this @chriseclectic

@chriseclectic chriseclectic merged commit 727bf69 into qiskit-community:main Nov 4, 2021
gadial pushed a commit to gadial/qiskit-experiments that referenced this pull request Dec 7, 2021
coruscating added a commit that referenced this pull request Jan 13, 2022
* Mitigation experiment initial commit

* Added mitigation analysis

* Small fixes to ensure figures are generated

* Linting

* Adding tensored mitigation as parallel experiment

* Changing method into class

* Bug fixes

* Restructuring to avoid reliance on composite experiment, and simplifying tensored experiment

* Refactor mitigation experiment to have two experiment classes

* RB Interleaved element fix (#399)

* Slightly changing the way interleaved element is passed and used

* Linting

* Linting

* Linting

* Allow splitting of jobs for all backends (#402)

* Allow splitting of jobs for all backends

Allows splitting experiments containing more circuits than can be executed at once into multiple jobs for legacy backends and 3rd party backends that don't support job splitting automatically.

* Update requirements.txt mpl req

* Add test

Also had to fix bug in FakeJob where the job id of the result and job didn't match which would lead to errors in the number of added jobs.

* Fixup

* Fix missing callback

Fix missing callback call when all added data is non-job data

* Add lock to add_data

* Fix type hint for run_analysis

* Update releasenotes/notes/job-splitting-775dc9aed9cf20c2.yaml

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* FineAmp without schedules (#420)

* * FineAmp can now run without a schedule.

* * Added test on gates.

* * Made fine drag work without schedules.

* Update qiskit_experiments/library/calibration/fine_drag.py

* * Docstring

* Update qiskit_experiments/library/calibration/fine_drag.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/fine_drag.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix bug in curve_fit for sigma=None (#422)

Setting `sigma=None` for curve_fit would raise an error from trying to call `np.isnan(None)`. This adds a check that sigma is not None first.

* Fix bug in DbExperimentData._retrieve_data (#421)

* Add analysis callback to ExperimentData (#407)

* Add default pre-processing to curve analysis (#409)

* add pre-processing to curve fit

* black&lint

* add reno

* rb notebook update

* update averaging method with shot number

* revert RB analysis

* update reno

* fix test

* revert rb notebook

* fix documentation from comments

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* add shots to data sort

* fix bug

* black

* fix bug

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* Improve calibration experiments (#251)

Co-authored-by: Will Shanks <wshaos@posteo.net>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* english (#429)

* PR for saving and loading composite experiments (#364)

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Bump terra to the most recent master (#426)

* * Terra bump

* * Constraints.

* * Delete constraints.

* Make verify_headers verify files in the test folder (#433)

* Make verify_headers verify files in the test folder

* made verify_headers nicer

* lint

* update tox.ini to run black and lint also for the tools folder

* Fix bug with ExperimentData.load (#423)

* * Fix issue 430 (#434)

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* * Added loading bug fix and corresponding test. (#444)

* * Added tearDown. (#449)

* Adjust tomography doc strings to automatic template (#375)

* tomography autotemplate doc

* fix lint errors

* fix indentation

* add blank lines

* small doc change

* Update qpt_analysis.py

* Update qpt_experiment.py

* Update qst_analysis.py

* lint docs fix

* misc

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: knzwnao <knzwnao@jp.ibm.com>

* Drag fit instability (#450)

* * Exposed seed in mock iq backend.
* Changed default bounds and initial p0 guess in drag analysis.

* * Fix tests.

* * Improve doc and black.

* Amp cal refactor (#439)

* * Added specializations.
* Moved fine amp to characterization.
* Refactored some tests.

* * Added tests.
* Added transpile options.

* * Removed obsolete test.
* Black

* * Docs and lint.

* * Docs and tests.

* * Begining of NB reworking.

* * Updated the tutorial.

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Documentation.

* * Documentation.

* * Added metadata hook in base class.
* Added metadata in fine amp cal circuits.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix DB display for non-float values (#301)

* Fix DB display for non-finite floats

* Add safe JSON serialization of inf and NaN

* Fix some issues with safe float and recusion

* A few more fixes

* Add string conversion for result display

Add ability to display complex, list, and array results in result DB by converting to string. Currently this limits display to cases where the resulting string is < 60 characters.

* Add tests for display conversion

* Fix array2string conversion

* Remove special handling for non float values

Now only complex numbers are converted to strings, and any string values are uploaded to the database without checking their length (the service should do its own checking and truncation if required). For values that are not a float or string type, they are uploaded as a string of the class name "(cls)".

* Fixup tests for renamed method

* Remove unused import

* Include safe nan handling for chisq

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* remove double test (#454)

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* Update computation of probability (#424)

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Documentation patch for PR424 (#458)

* Cleaned up composite_analysis.py (#443)

* Hack for non-existing parent id (#461)

* Remove ``experiment_data`` from ``BaseExperiment.run`` (#463)

* Remove experiment_data for BaseExperiment.run to prevent adding additional job data to existing experiment using this method. Now all executions must return unique ExperimentData objects, which can still manually be combined using `add_data` if the user wants.

* Add backend property to experiments (#462)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Add ExperimentConfig dataclass (#469)

* Half angle (#418)

* * First draft of half angle calibration.

* * inits and docstring.

* * Added transpile options, reference and more doc.

* * First draft of half angle.

* * Docs and test

* * removed transpile options (for a future PR).
* extended test.
* added analysis class.

* * fix docs.

* * Docstring

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* * Added transpiler options for inst_map
* Bumped terra to main

* * ParameterRepr

* * Calibration class
* Black
* Tests

* * Improved doc.
* Implemented update rule.

* * Fixed update rule.

* * Update for half angle cal.

* * Bug fixes.
* Tutorial clean-up.

* * Black

* * Test align to bug fix.

* * Lint.

* * Added comment on options.

* Update qiskit_experiments/library/characterization/half_angle.py

* Update qiskit_experiments/library/characterization/half_angle.py

* Update qiskit_experiments/library/calibration/half_angle_cal.py

* * Changed init arg order.

* * refactor update rule.

* * Black

* Update qiskit_experiments/library/calibration/analysis/fine_half_angle_analysis.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/half_angle_cal.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update docs/tutorials/fine_calibrations.ipynb

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Doc.

* * Decorators, and decorators.

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Will Shanks <wshaos@posteo.net>

* Rabi refactor (#466)

* * Moved Rabi to characterization.

* * Refactor EFRabi and tests accordingly.
* Added tests for rough amp calibration.
* Reworked init files and docs in them.
* Added rough amplitude cal.
* Moved mock rabi backend.
* Removed amplitude update from updates.

* * Black and lint.

* * Docs

* * Docs.

* * Updated NB and caught some bugs.

* * Lint and removed updater amplitude test as Amplitude no longer exists.

* * Black

* * Test lint

* * Black.

* * Removed dt info

* * rabi_rate_12

* * Named tuple.

* * Bug fix with options.

* * Test fix after merge main.

* * setting of transpile options and the config test.

* Update qiskit_experiments/library/characterization/rabi.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update docs/tutorials/calibrating_armonk.ipynb

Co-authored-by: Will Shanks <wshaos@posteo.net>

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Add ``replace_results`` kwarg to ``BaseAnalysis.run`` (#464)

* This fixes issue with re-analyzing experiment data when trying to save to the result database. Now if replace_results is True any previous analysis results will be cleared and replaced with the new results, while if False a copy (with a new experiment id) will be generated containing only the new results.
* This change also requires a change that `BaseAnalysis.run` runs as an analysis callback, rather than just `BaseExperiment.run`.

* Fix typos in t1/t2 experiments (#480)

* T1 T2 analysis migration (#427)

* analysis class migration

* fix t1 test

* black

* fix conversion factor handling

* update tutorials

* bug fix

* documentation fix

* move some evaluation criteria from common analysis

* remove conversion factor and unit from result metadata

* keep conversion factor

* remove osc_freq from initial guess

* update conversion factor logic for init guess

* lint

* typo fix

* Added 0/1 cals for fine sx amp (#483)

* * Added 0/1 cals for fine sx amp.
* Added dedicated class for fine X amp analysis.

* * Aligned cal and characterization value.
* Fixed tests.
* Updated NB.

* * Fix method redefine.

* * Dropped negative bound on amp.

* Fix output array shape of SVD data processing node (#476)

* fix SVD shape

* fix docs

* fix comment

* fix var name

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* comments

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Edge-case: fitting constant y values with decay analysis (#487)

* Small fixes from recent PRs (#489)

Fixes a couple bugs from recent PRs
* set_backend has to be called last during initialization so that all instance attributes are created first in case they are used by _set_backend
* block_for_results in CompositeExperimentData was not returning self like the super class does
* BaseExperiment.run and BaseExperiment.run_analysis should return the output of Analysis.run / run_analysis in case a copy of the experiment data is created by the `replace_results` analysis kwarg.

* Drag cal refactor (#473)

* * Moved calibration.DragCal -> characterization.RoughDrag.
* New cal class RoughDragCal.
* Added test and refactored tests.
* Adjusted inits.

* * Default options.

* * Black.
* Amp. update fix.

* * Removed Drag update library test as this is now redundent with RoughDragCal test.

* * Removed Drag updater.

* * Removed unused import.

* * updated NB.

* * Aligned tests to the gate naming.

* * Tutorial NB.

* * Config test.

* * Args order and set options.

* Ramsey refactor. (#485)

* * Moved RamseyXY to characterization.
* Added a cal version of the class.

* * refactored RamseyXY.

* * Test config.

* Update qiskit_experiments/calibration_management/base_calibration_experiment.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Arg order in init.

* * Removed updated and fixed tests.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix some typos in warnings (#493)

* Fix some typos in warnings

* Update qiskit_experiments/database_service/db_experiment_data.py

* Update qiskit_experiments/database_service/db_experiment_data.py

* Add child data support to ExperimentData (#451)

* BaseExperiment to accept only a list of qubits (#431)

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Replace `str(uuid4())` with `uuid4().hex` (#492)

* Revert "Replace `str(uuid4())` with `uuid4().hex` (#492)" (#501)

This reverts commit f5da13c.

* Fine drag cal refactor (#519)

* * First draft of framework to save and rebuild calibrations from metadata.

* * Moved FineDrag to characterization and created a calibration version of the experiment.

* * Undo git merging issues.

* * Fix merge issues.

* * Lint

* * Docs.

* * Lint.

* * Docs

* * Docs.

* Fix storing of component metadata in composite experiment (#510)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Consolidate the analysis classes in characterization. (#523)

* * Consolidated the analysis classes in characterization.

* * Black.

* Update qiskit_experiments/library/characterization/cr_hamiltonian.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* * Removed ~

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Add ``Settings`` mixin class (#520)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Refactor where the calibration metadata is stored. (#524)

* * refactor of where the calibration metadata is stored.

* * Lint.

* Improve JSON encoder and decoder (#470)

* Move error about less than three points from T1 to DecayAnalysis (#490)

* Move error about less than three points from T1 to DecayAnalysis

* removed check also from decay

* lint

* Save-load test and bug fixes (#467)

* Test counts in composite experiments (#506)

* Bug fix: T1 and T2Ramsey don't run correctly on devices (#529)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Recursive methods for adding and removing tags (#522)

* wrote add_tags_recursive and remove_tag_recursive

* docs

* lint

* Update qiskit_experiments/database_service/db_experiment_data.py

Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>

* release notes

* fix method docs

* fixed test

* black

Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>

* Readout angle experiment (#525)

* Readout angle experiment

* readout angle files

* removed fix_class_docs

* bug fix in composite save

* removed debug prints

* moved location of analysis file

* removed the parallel test

* black

* lint

* black

* lint

* black

* update init file

* docs

* release notes

* addressing review comments

* Update ``ExperimentData.analysis_results`` to be blocking by default (#486)

* Serialize the basis gate library (#539)

* * Serialization support for the BasisGateLibrary.

* Update qiskit_experiments/calibration_management/basis_gate_library.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Internal clean-up of basis gate library.

* * Warning message.

* * Hashing of basis gate library.

* * dict(...) -> .copy()

* * Added a test for raising a user warning on different hash values.

* * Test docs.

* * Refactored schedule building.

* * Made test robust.

* * Test fix and cleaner implementation.

* * removed use_drag.

* * Test fix.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Data processor with uncertainties package (#481)

* fix SVD shape

* fix docs

* fix comment

* fix var name

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* comments

* update except for SVD

* update note tests

* fix processor logic

* documentation

* lint

* add reno

use np.testing

* fix test

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add description for correlation

* remove typehint for trainable node

* update return doc

* add type check

* detail for full array

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add comment

* fix document

* black

* Update qiskit_experiments/data_processing/__init__.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* update docs

* update docs

* restrict count validation

* update return type of data processor

* lint

* add svd test

* update average node

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add comment

* add handling for level2 memory

* black

* lint

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* ignore assigning-non-slot (#553)

* Clean-up of Base calibration experiments (#547)

* * Removed unused methods and added some validation.

* * Moved validation to after init.

* * Moved validation to before super().__init__
* Removed validate schedules.

* * Fix validation.

* Change config from property to method (#555)

* Add StoreInitArgs mixin (#554)

* Start of BaseAnalysis refactor (#517)

* Analysis refactor part 2 (#556)

* small fixes

* Change to deprecated analysis class usage

* Analysis returns mitigator object instead of matrices

* Refactoring mitigation experiment

* Refactoring mitigation analysis

* Linting

* Linting

* Linting

* Linting

* Mitigation tutorial notebook

* Mitigation tutorial notebook update

* Mitigation experiment tests

* Linting

* Changes to visualization

* Bugfix

* Linting

* Avoiding failing test due to small bug in Terra

* Linting

* Linting

* Refactoring

* Tutorial texts

* Plot fix

* Release note

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com>
Co-authored-by: Will Shanks <wshaos@posteo.net>
Co-authored-by: Naoki Kanazawa <knzwnao@jp.ibm.com>
Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: dekelmeirom <33314493+dekelmeirom@users.noreply.github.com>
Co-authored-by: Will Shanks <willshanks@us.ibm.com>
Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>
nkanazawa1989 added a commit to nkanazawa1989/qiskit-experiments that referenced this pull request Jan 19, 2022
* Mitigation experiment initial commit

* Added mitigation analysis

* Small fixes to ensure figures are generated

* Linting

* Adding tensored mitigation as parallel experiment

* Changing method into class

* Bug fixes

* Restructuring to avoid reliance on composite experiment, and simplifying tensored experiment

* Refactor mitigation experiment to have two experiment classes

* RB Interleaved element fix (qiskit-community#399)

* Slightly changing the way interleaved element is passed and used

* Linting

* Linting

* Linting

* Allow splitting of jobs for all backends (qiskit-community#402)

* Allow splitting of jobs for all backends

Allows splitting experiments containing more circuits than can be executed at once into multiple jobs for legacy backends and 3rd party backends that don't support job splitting automatically.

* Update requirements.txt mpl req

* Add test

Also had to fix bug in FakeJob where the job id of the result and job didn't match which would lead to errors in the number of added jobs.

* Fixup

* Fix missing callback

Fix missing callback call when all added data is non-job data

* Add lock to add_data

* Fix type hint for run_analysis

* Update releasenotes/notes/job-splitting-775dc9aed9cf20c2.yaml

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* FineAmp without schedules (qiskit-community#420)

* * FineAmp can now run without a schedule.

* * Added test on gates.

* * Made fine drag work without schedules.

* Update qiskit_experiments/library/calibration/fine_drag.py

* * Docstring

* Update qiskit_experiments/library/calibration/fine_drag.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/fine_drag.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix bug in curve_fit for sigma=None (qiskit-community#422)

Setting `sigma=None` for curve_fit would raise an error from trying to call `np.isnan(None)`. This adds a check that sigma is not None first.

* Fix bug in DbExperimentData._retrieve_data (qiskit-community#421)

* Add analysis callback to ExperimentData (qiskit-community#407)

* Add default pre-processing to curve analysis (qiskit-community#409)

* add pre-processing to curve fit

* black&lint

* add reno

* rb notebook update

* update averaging method with shot number

* revert RB analysis

* update reno

* fix test

* revert rb notebook

* fix documentation from comments

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* add shots to data sort

* fix bug

* black

* fix bug

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* Improve calibration experiments (qiskit-community#251)

Co-authored-by: Will Shanks <wshaos@posteo.net>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* english (qiskit-community#429)

* PR for saving and loading composite experiments (qiskit-community#364)

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Bump terra to the most recent master (qiskit-community#426)

* * Terra bump

* * Constraints.

* * Delete constraints.

* Make verify_headers verify files in the test folder (qiskit-community#433)

* Make verify_headers verify files in the test folder

* made verify_headers nicer

* lint

* update tox.ini to run black and lint also for the tools folder

* Fix bug with ExperimentData.load (qiskit-community#423)

* * Fix issue 430 (qiskit-community#434)

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* * Added loading bug fix and corresponding test. (qiskit-community#444)

* * Added tearDown. (qiskit-community#449)

* Adjust tomography doc strings to automatic template (qiskit-community#375)

* tomography autotemplate doc

* fix lint errors

* fix indentation

* add blank lines

* small doc change

* Update qpt_analysis.py

* Update qpt_experiment.py

* Update qst_analysis.py

* lint docs fix

* misc

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: knzwnao <knzwnao@jp.ibm.com>

* Drag fit instability (qiskit-community#450)

* * Exposed seed in mock iq backend.
* Changed default bounds and initial p0 guess in drag analysis.

* * Fix tests.

* * Improve doc and black.

* Amp cal refactor (qiskit-community#439)

* * Added specializations.
* Moved fine amp to characterization.
* Refactored some tests.

* * Added tests.
* Added transpile options.

* * Removed obsolete test.
* Black

* * Docs and lint.

* * Docs and tests.

* * Begining of NB reworking.

* * Updated the tutorial.

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Documentation.

* * Documentation.

* * Added metadata hook in base class.
* Added metadata in fine amp cal circuits.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix DB display for non-float values (qiskit-community#301)

* Fix DB display for non-finite floats

* Add safe JSON serialization of inf and NaN

* Fix some issues with safe float and recusion

* A few more fixes

* Add string conversion for result display

Add ability to display complex, list, and array results in result DB by converting to string. Currently this limits display to cases where the resulting string is < 60 characters.

* Add tests for display conversion

* Fix array2string conversion

* Remove special handling for non float values

Now only complex numbers are converted to strings, and any string values are uploaded to the database without checking their length (the service should do its own checking and truncation if required). For values that are not a float or string type, they are uploaded as a string of the class name "(cls)".

* Fixup tests for renamed method

* Remove unused import

* Include safe nan handling for chisq

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* remove double test (qiskit-community#454)

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* Update computation of probability (qiskit-community#424)

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Documentation patch for PR424 (qiskit-community#458)

* Cleaned up composite_analysis.py (qiskit-community#443)

* Hack for non-existing parent id (qiskit-community#461)

* Remove ``experiment_data`` from ``BaseExperiment.run`` (qiskit-community#463)

* Remove experiment_data for BaseExperiment.run to prevent adding additional job data to existing experiment using this method. Now all executions must return unique ExperimentData objects, which can still manually be combined using `add_data` if the user wants.

* Add backend property to experiments (qiskit-community#462)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Add ExperimentConfig dataclass (qiskit-community#469)

* Half angle (qiskit-community#418)

* * First draft of half angle calibration.

* * inits and docstring.

* * Added transpile options, reference and more doc.

* * First draft of half angle.

* * Docs and test

* * removed transpile options (for a future PR).
* extended test.
* added analysis class.

* * fix docs.

* * Docstring

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* * Added transpiler options for inst_map
* Bumped terra to main

* * ParameterRepr

* * Calibration class
* Black
* Tests

* * Improved doc.
* Implemented update rule.

* * Fixed update rule.

* * Update for half angle cal.

* * Bug fixes.
* Tutorial clean-up.

* * Black

* * Test align to bug fix.

* * Lint.

* * Added comment on options.

* Update qiskit_experiments/library/characterization/half_angle.py

* Update qiskit_experiments/library/characterization/half_angle.py

* Update qiskit_experiments/library/calibration/half_angle_cal.py

* * Changed init arg order.

* * refactor update rule.

* * Black

* Update qiskit_experiments/library/calibration/analysis/fine_half_angle_analysis.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/half_angle_cal.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update docs/tutorials/fine_calibrations.ipynb

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Doc.

* * Decorators, and decorators.

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Will Shanks <wshaos@posteo.net>

* Rabi refactor (qiskit-community#466)

* * Moved Rabi to characterization.

* * Refactor EFRabi and tests accordingly.
* Added tests for rough amp calibration.
* Reworked init files and docs in them.
* Added rough amplitude cal.
* Moved mock rabi backend.
* Removed amplitude update from updates.

* * Black and lint.

* * Docs

* * Docs.

* * Updated NB and caught some bugs.

* * Lint and removed updater amplitude test as Amplitude no longer exists.

* * Black

* * Test lint

* * Black.

* * Removed dt info

* * rabi_rate_12

* * Named tuple.

* * Bug fix with options.

* * Test fix after merge main.

* * setting of transpile options and the config test.

* Update qiskit_experiments/library/characterization/rabi.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update docs/tutorials/calibrating_armonk.ipynb

Co-authored-by: Will Shanks <wshaos@posteo.net>

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Add ``replace_results`` kwarg to ``BaseAnalysis.run`` (qiskit-community#464)

* This fixes issue with re-analyzing experiment data when trying to save to the result database. Now if replace_results is True any previous analysis results will be cleared and replaced with the new results, while if False a copy (with a new experiment id) will be generated containing only the new results.
* This change also requires a change that `BaseAnalysis.run` runs as an analysis callback, rather than just `BaseExperiment.run`.

* Fix typos in t1/t2 experiments (qiskit-community#480)

* T1 T2 analysis migration (qiskit-community#427)

* analysis class migration

* fix t1 test

* black

* fix conversion factor handling

* update tutorials

* bug fix

* documentation fix

* move some evaluation criteria from common analysis

* remove conversion factor and unit from result metadata

* keep conversion factor

* remove osc_freq from initial guess

* update conversion factor logic for init guess

* lint

* typo fix

* Added 0/1 cals for fine sx amp (qiskit-community#483)

* * Added 0/1 cals for fine sx amp.
* Added dedicated class for fine X amp analysis.

* * Aligned cal and characterization value.
* Fixed tests.
* Updated NB.

* * Fix method redefine.

* * Dropped negative bound on amp.

* Fix output array shape of SVD data processing node (qiskit-community#476)

* fix SVD shape

* fix docs

* fix comment

* fix var name

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* comments

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Edge-case: fitting constant y values with decay analysis (qiskit-community#487)

* Small fixes from recent PRs (qiskit-community#489)

Fixes a couple bugs from recent PRs
* set_backend has to be called last during initialization so that all instance attributes are created first in case they are used by _set_backend
* block_for_results in CompositeExperimentData was not returning self like the super class does
* BaseExperiment.run and BaseExperiment.run_analysis should return the output of Analysis.run / run_analysis in case a copy of the experiment data is created by the `replace_results` analysis kwarg.

* Drag cal refactor (qiskit-community#473)

* * Moved calibration.DragCal -> characterization.RoughDrag.
* New cal class RoughDragCal.
* Added test and refactored tests.
* Adjusted inits.

* * Default options.

* * Black.
* Amp. update fix.

* * Removed Drag update library test as this is now redundent with RoughDragCal test.

* * Removed Drag updater.

* * Removed unused import.

* * updated NB.

* * Aligned tests to the gate naming.

* * Tutorial NB.

* * Config test.

* * Args order and set options.

* Ramsey refactor. (qiskit-community#485)

* * Moved RamseyXY to characterization.
* Added a cal version of the class.

* * refactored RamseyXY.

* * Test config.

* Update qiskit_experiments/calibration_management/base_calibration_experiment.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Arg order in init.

* * Removed updated and fixed tests.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix some typos in warnings (qiskit-community#493)

* Fix some typos in warnings

* Update qiskit_experiments/database_service/db_experiment_data.py

* Update qiskit_experiments/database_service/db_experiment_data.py

* Add child data support to ExperimentData (qiskit-community#451)

* BaseExperiment to accept only a list of qubits (qiskit-community#431)

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Replace `str(uuid4())` with `uuid4().hex` (qiskit-community#492)

* Revert "Replace `str(uuid4())` with `uuid4().hex` (qiskit-community#492)" (qiskit-community#501)

This reverts commit f5da13c.

* Fine drag cal refactor (qiskit-community#519)

* * First draft of framework to save and rebuild calibrations from metadata.

* * Moved FineDrag to characterization and created a calibration version of the experiment.

* * Undo git merging issues.

* * Fix merge issues.

* * Lint

* * Docs.

* * Lint.

* * Docs

* * Docs.

* Fix storing of component metadata in composite experiment (qiskit-community#510)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Consolidate the analysis classes in characterization. (qiskit-community#523)

* * Consolidated the analysis classes in characterization.

* * Black.

* Update qiskit_experiments/library/characterization/cr_hamiltonian.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* * Removed ~

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Add ``Settings`` mixin class (qiskit-community#520)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Refactor where the calibration metadata is stored. (qiskit-community#524)

* * refactor of where the calibration metadata is stored.

* * Lint.

* Improve JSON encoder and decoder (qiskit-community#470)

* Move error about less than three points from T1 to DecayAnalysis (qiskit-community#490)

* Move error about less than three points from T1 to DecayAnalysis

* removed check also from decay

* lint

* Save-load test and bug fixes (qiskit-community#467)

* Test counts in composite experiments (qiskit-community#506)

* Bug fix: T1 and T2Ramsey don't run correctly on devices (qiskit-community#529)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Recursive methods for adding and removing tags (qiskit-community#522)

* wrote add_tags_recursive and remove_tag_recursive

* docs

* lint

* Update qiskit_experiments/database_service/db_experiment_data.py

Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>

* release notes

* fix method docs

* fixed test

* black

Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>

* Readout angle experiment (qiskit-community#525)

* Readout angle experiment

* readout angle files

* removed fix_class_docs

* bug fix in composite save

* removed debug prints

* moved location of analysis file

* removed the parallel test

* black

* lint

* black

* lint

* black

* update init file

* docs

* release notes

* addressing review comments

* Update ``ExperimentData.analysis_results`` to be blocking by default (qiskit-community#486)

* Serialize the basis gate library (qiskit-community#539)

* * Serialization support for the BasisGateLibrary.

* Update qiskit_experiments/calibration_management/basis_gate_library.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Internal clean-up of basis gate library.

* * Warning message.

* * Hashing of basis gate library.

* * dict(...) -> .copy()

* * Added a test for raising a user warning on different hash values.

* * Test docs.

* * Refactored schedule building.

* * Made test robust.

* * Test fix and cleaner implementation.

* * removed use_drag.

* * Test fix.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Data processor with uncertainties package (qiskit-community#481)

* fix SVD shape

* fix docs

* fix comment

* fix var name

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* comments

* update except for SVD

* update note tests

* fix processor logic

* documentation

* lint

* add reno

use np.testing

* fix test

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add description for correlation

* remove typehint for trainable node

* update return doc

* add type check

* detail for full array

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add comment

* fix document

* black

* Update qiskit_experiments/data_processing/__init__.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* update docs

* update docs

* restrict count validation

* update return type of data processor

* lint

* add svd test

* update average node

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add comment

* add handling for level2 memory

* black

* lint

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* ignore assigning-non-slot (qiskit-community#553)

* Clean-up of Base calibration experiments (qiskit-community#547)

* * Removed unused methods and added some validation.

* * Moved validation to after init.

* * Moved validation to before super().__init__
* Removed validate schedules.

* * Fix validation.

* Change config from property to method (qiskit-community#555)

* Add StoreInitArgs mixin (qiskit-community#554)

* Start of BaseAnalysis refactor (qiskit-community#517)

* Analysis refactor part 2 (qiskit-community#556)

* small fixes

* Change to deprecated analysis class usage

* Analysis returns mitigator object instead of matrices

* Refactoring mitigation experiment

* Refactoring mitigation analysis

* Linting

* Linting

* Linting

* Linting

* Mitigation tutorial notebook

* Mitigation tutorial notebook update

* Mitigation experiment tests

* Linting

* Changes to visualization

* Bugfix

* Linting

* Avoiding failing test due to small bug in Terra

* Linting

* Linting

* Refactoring

* Tutorial texts

* Plot fix

* Release note

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com>
Co-authored-by: Will Shanks <wshaos@posteo.net>
Co-authored-by: Naoki Kanazawa <knzwnao@jp.ibm.com>
Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: dekelmeirom <33314493+dekelmeirom@users.noreply.github.com>
Co-authored-by: Will Shanks <willshanks@us.ibm.com>
Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>
@chriseclectic chriseclectic deleted the expdata branch March 3, 2022 22:43
paco-ri pushed a commit to paco-ri/qiskit-experiments that referenced this pull request Jul 11, 2022
paco-ri pushed a commit to paco-ri/qiskit-experiments that referenced this pull request Jul 11, 2022
* Mitigation experiment initial commit

* Added mitigation analysis

* Small fixes to ensure figures are generated

* Linting

* Adding tensored mitigation as parallel experiment

* Changing method into class

* Bug fixes

* Restructuring to avoid reliance on composite experiment, and simplifying tensored experiment

* Refactor mitigation experiment to have two experiment classes

* RB Interleaved element fix (qiskit-community#399)

* Slightly changing the way interleaved element is passed and used

* Linting

* Linting

* Linting

* Allow splitting of jobs for all backends (qiskit-community#402)

* Allow splitting of jobs for all backends

Allows splitting experiments containing more circuits than can be executed at once into multiple jobs for legacy backends and 3rd party backends that don't support job splitting automatically.

* Update requirements.txt mpl req

* Add test

Also had to fix bug in FakeJob where the job id of the result and job didn't match which would lead to errors in the number of added jobs.

* Fixup

* Fix missing callback

Fix missing callback call when all added data is non-job data

* Add lock to add_data

* Fix type hint for run_analysis

* Update releasenotes/notes/job-splitting-775dc9aed9cf20c2.yaml

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

* FineAmp without schedules (qiskit-community#420)

* * FineAmp can now run without a schedule.

* * Added test on gates.

* * Made fine drag work without schedules.

* Update qiskit_experiments/library/calibration/fine_drag.py

* * Docstring

* Update qiskit_experiments/library/calibration/fine_drag.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/fine_drag.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix bug in curve_fit for sigma=None (qiskit-community#422)

Setting `sigma=None` for curve_fit would raise an error from trying to call `np.isnan(None)`. This adds a check that sigma is not None first.

* Fix bug in DbExperimentData._retrieve_data (qiskit-community#421)

* Add analysis callback to ExperimentData (qiskit-community#407)

* Add default pre-processing to curve analysis (qiskit-community#409)

* add pre-processing to curve fit

* black&lint

* add reno

* rb notebook update

* update averaging method with shot number

* revert RB analysis

* update reno

* fix test

* revert rb notebook

* fix documentation from comments

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* add shots to data sort

* fix bug

* black

* fix bug

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* Improve calibration experiments (qiskit-community#251)

Co-authored-by: Will Shanks <wshaos@posteo.net>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* english (qiskit-community#429)

* PR for saving and loading composite experiments (qiskit-community#364)

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Bump terra to the most recent master (qiskit-community#426)

* * Terra bump

* * Constraints.

* * Delete constraints.

* Make verify_headers verify files in the test folder (qiskit-community#433)

* Make verify_headers verify files in the test folder

* made verify_headers nicer

* lint

* update tox.ini to run black and lint also for the tools folder

* Fix bug with ExperimentData.load (qiskit-community#423)

* * Fix issue 430 (qiskit-community#434)

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* * Added loading bug fix and corresponding test. (qiskit-community#444)

* * Added tearDown. (qiskit-community#449)

* Adjust tomography doc strings to automatic template (qiskit-community#375)

* tomography autotemplate doc

* fix lint errors

* fix indentation

* add blank lines

* small doc change

* Update qpt_analysis.py

* Update qpt_experiment.py

* Update qst_analysis.py

* lint docs fix

* misc

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: knzwnao <knzwnao@jp.ibm.com>

* Drag fit instability (qiskit-community#450)

* * Exposed seed in mock iq backend.
* Changed default bounds and initial p0 guess in drag analysis.

* * Fix tests.

* * Improve doc and black.

* Amp cal refactor (qiskit-community#439)

* * Added specializations.
* Moved fine amp to characterization.
* Refactored some tests.

* * Added tests.
* Added transpile options.

* * Removed obsolete test.
* Black

* * Docs and lint.

* * Docs and tests.

* * Begining of NB reworking.

* * Updated the tutorial.

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/fine_amplitude.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Documentation.

* * Documentation.

* * Added metadata hook in base class.
* Added metadata in fine amp cal circuits.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix DB display for non-float values (qiskit-community#301)

* Fix DB display for non-finite floats

* Add safe JSON serialization of inf and NaN

* Fix some issues with safe float and recusion

* A few more fixes

* Add string conversion for result display

Add ability to display complex, list, and array results in result DB by converting to string. Currently this limits display to cases where the resulting string is < 60 characters.

* Add tests for display conversion

* Fix array2string conversion

* Remove special handling for non float values

Now only complex numbers are converted to strings, and any string values are uploaded to the database without checking their length (the service should do its own checking and truncation if required). For values that are not a float or string type, they are uploaded as a string of the class name "(cls)".

* Fixup tests for renamed method

* Remove unused import

* Include safe nan handling for chisq

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* remove double test (qiskit-community#454)

Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>

* Update computation of probability (qiskit-community#424)

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>
Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Documentation patch for PR424 (qiskit-community#458)

* Cleaned up composite_analysis.py (qiskit-community#443)

* Hack for non-existing parent id (qiskit-community#461)

* Remove ``experiment_data`` from ``BaseExperiment.run`` (qiskit-community#463)

* Remove experiment_data for BaseExperiment.run to prevent adding additional job data to existing experiment using this method. Now all executions must return unique ExperimentData objects, which can still manually be combined using `add_data` if the user wants.

* Add backend property to experiments (qiskit-community#462)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Add ExperimentConfig dataclass (qiskit-community#469)

* Half angle (qiskit-community#418)

* * First draft of half angle calibration.

* * inits and docstring.

* * Added transpile options, reference and more doc.

* * First draft of half angle.

* * Docs and test

* * removed transpile options (for a future PR).
* extended test.
* added analysis class.

* * fix docs.

* * Docstring

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* * Added transpiler options for inst_map
* Bumped terra to main

* * ParameterRepr

* * Calibration class
* Black
* Tests

* * Improved doc.
* Implemented update rule.

* * Fixed update rule.

* * Update for half angle cal.

* * Bug fixes.
* Tutorial clean-up.

* * Black

* * Test align to bug fix.

* * Lint.

* * Added comment on options.

* Update qiskit_experiments/library/characterization/half_angle.py

* Update qiskit_experiments/library/characterization/half_angle.py

* Update qiskit_experiments/library/calibration/half_angle_cal.py

* * Changed init arg order.

* * refactor update rule.

* * Black

* Update qiskit_experiments/library/calibration/analysis/fine_half_angle_analysis.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/calibration/half_angle_cal.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update qiskit_experiments/library/characterization/half_angle.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update docs/tutorials/fine_calibrations.ipynb

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Doc.

* * Decorators, and decorators.

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Will Shanks <wshaos@posteo.net>

* Rabi refactor (qiskit-community#466)

* * Moved Rabi to characterization.

* * Refactor EFRabi and tests accordingly.
* Added tests for rough amp calibration.
* Reworked init files and docs in them.
* Added rough amplitude cal.
* Moved mock rabi backend.
* Removed amplitude update from updates.

* * Black and lint.

* * Docs

* * Docs.

* * Updated NB and caught some bugs.

* * Lint and removed updater amplitude test as Amplitude no longer exists.

* * Black

* * Test lint

* * Black.

* * Removed dt info

* * rabi_rate_12

* * Named tuple.

* * Bug fix with options.

* * Test fix after merge main.

* * setting of transpile options and the config test.

* Update qiskit_experiments/library/characterization/rabi.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Update docs/tutorials/calibrating_armonk.ipynb

Co-authored-by: Will Shanks <wshaos@posteo.net>

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Add ``replace_results`` kwarg to ``BaseAnalysis.run`` (qiskit-community#464)

* This fixes issue with re-analyzing experiment data when trying to save to the result database. Now if replace_results is True any previous analysis results will be cleared and replaced with the new results, while if False a copy (with a new experiment id) will be generated containing only the new results.
* This change also requires a change that `BaseAnalysis.run` runs as an analysis callback, rather than just `BaseExperiment.run`.

* Fix typos in t1/t2 experiments (qiskit-community#480)

* T1 T2 analysis migration (qiskit-community#427)

* analysis class migration

* fix t1 test

* black

* fix conversion factor handling

* update tutorials

* bug fix

* documentation fix

* move some evaluation criteria from common analysis

* remove conversion factor and unit from result metadata

* keep conversion factor

* remove osc_freq from initial guess

* update conversion factor logic for init guess

* lint

* typo fix

* Added 0/1 cals for fine sx amp (qiskit-community#483)

* * Added 0/1 cals for fine sx amp.
* Added dedicated class for fine X amp analysis.

* * Aligned cal and characterization value.
* Fixed tests.
* Updated NB.

* * Fix method redefine.

* * Dropped negative bound on amp.

* Fix output array shape of SVD data processing node (qiskit-community#476)

* fix SVD shape

* fix docs

* fix comment

* fix var name

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* comments

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Edge-case: fitting constant y values with decay analysis (qiskit-community#487)

* Small fixes from recent PRs (qiskit-community#489)

Fixes a couple bugs from recent PRs
* set_backend has to be called last during initialization so that all instance attributes are created first in case they are used by _set_backend
* block_for_results in CompositeExperimentData was not returning self like the super class does
* BaseExperiment.run and BaseExperiment.run_analysis should return the output of Analysis.run / run_analysis in case a copy of the experiment data is created by the `replace_results` analysis kwarg.

* Drag cal refactor (qiskit-community#473)

* * Moved calibration.DragCal -> characterization.RoughDrag.
* New cal class RoughDragCal.
* Added test and refactored tests.
* Adjusted inits.

* * Default options.

* * Black.
* Amp. update fix.

* * Removed Drag update library test as this is now redundent with RoughDragCal test.

* * Removed Drag updater.

* * Removed unused import.

* * updated NB.

* * Aligned tests to the gate naming.

* * Tutorial NB.

* * Config test.

* * Args order and set options.

* Ramsey refactor. (qiskit-community#485)

* * Moved RamseyXY to characterization.
* Added a cal version of the class.

* * refactored RamseyXY.

* * Test config.

* Update qiskit_experiments/calibration_management/base_calibration_experiment.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Arg order in init.

* * Removed updated and fixed tests.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Fix some typos in warnings (qiskit-community#493)

* Fix some typos in warnings

* Update qiskit_experiments/database_service/db_experiment_data.py

* Update qiskit_experiments/database_service/db_experiment_data.py

* Add child data support to ExperimentData (qiskit-community#451)

* BaseExperiment to accept only a list of qubits (qiskit-community#431)

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>

* Replace `str(uuid4())` with `uuid4().hex` (qiskit-community#492)

* Revert "Replace `str(uuid4())` with `uuid4().hex` (qiskit-community#492)" (qiskit-community#501)

This reverts commit f5da13c.

* Fine drag cal refactor (qiskit-community#519)

* * First draft of framework to save and rebuild calibrations from metadata.

* * Moved FineDrag to characterization and created a calibration version of the experiment.

* * Undo git merging issues.

* * Fix merge issues.

* * Lint

* * Docs.

* * Lint.

* * Docs

* * Docs.

* Fix storing of component metadata in composite experiment (qiskit-community#510)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Consolidate the analysis classes in characterization. (qiskit-community#523)

* * Consolidated the analysis classes in characterization.

* * Black.

* Update qiskit_experiments/library/characterization/cr_hamiltonian.py

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* * Removed ~

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Add ``Settings`` mixin class (qiskit-community#520)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Refactor where the calibration metadata is stored. (qiskit-community#524)

* * refactor of where the calibration metadata is stored.

* * Lint.

* Improve JSON encoder and decoder (qiskit-community#470)

* Move error about less than three points from T1 to DecayAnalysis (qiskit-community#490)

* Move error about less than three points from T1 to DecayAnalysis

* removed check also from decay

* lint

* Save-load test and bug fixes (qiskit-community#467)

* Test counts in composite experiments (qiskit-community#506)

* Bug fix: T1 and T2Ramsey don't run correctly on devices (qiskit-community#529)

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* Recursive methods for adding and removing tags (qiskit-community#522)

* wrote add_tags_recursive and remove_tag_recursive

* docs

* lint

* Update qiskit_experiments/database_service/db_experiment_data.py

Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>

* release notes

* fix method docs

* fixed test

* black

Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>

* Readout angle experiment (qiskit-community#525)

* Readout angle experiment

* readout angle files

* removed fix_class_docs

* bug fix in composite save

* removed debug prints

* moved location of analysis file

* removed the parallel test

* black

* lint

* black

* lint

* black

* update init file

* docs

* release notes

* addressing review comments

* Update ``ExperimentData.analysis_results`` to be blocking by default (qiskit-community#486)

* Serialize the basis gate library (qiskit-community#539)

* * Serialization support for the BasisGateLibrary.

* Update qiskit_experiments/calibration_management/basis_gate_library.py

Co-authored-by: Will Shanks <wshaos@posteo.net>

* * Internal clean-up of basis gate library.

* * Warning message.

* * Hashing of basis gate library.

* * dict(...) -> .copy()

* * Added a test for raising a user warning on different hash values.

* * Test docs.

* * Refactored schedule building.

* * Made test robust.

* * Test fix and cleaner implementation.

* * removed use_drag.

* * Test fix.

Co-authored-by: Will Shanks <wshaos@posteo.net>

* Data processor with uncertainties package (qiskit-community#481)

* fix SVD shape

* fix docs

* fix comment

* fix var name

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* comments

* update except for SVD

* update note tests

* fix processor logic

* documentation

* lint

* add reno

use np.testing

* fix test

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_action.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add description for correlation

* remove typehint for trainable node

* update return doc

* add type check

* detail for full array

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add comment

* fix document

* black

* Update qiskit_experiments/data_processing/__init__.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* update docs

* update docs

* restrict count validation

* update return type of data processor

* lint

* add svd test

* update average node

* Update qiskit_experiments/data_processing/data_processor.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* Update qiskit_experiments/data_processing/nodes.py

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* add comment

* add handling for level2 memory

* black

* lint

Co-authored-by: Daniel J. Egger <38065505+eggerdj@users.noreply.github.com>

* ignore assigning-non-slot (qiskit-community#553)

* Clean-up of Base calibration experiments (qiskit-community#547)

* * Removed unused methods and added some validation.

* * Moved validation to after init.

* * Moved validation to before super().__init__
* Removed validate schedules.

* * Fix validation.

* Change config from property to method (qiskit-community#555)

* Add StoreInitArgs mixin (qiskit-community#554)

* Start of BaseAnalysis refactor (qiskit-community#517)

* Analysis refactor part 2 (qiskit-community#556)

* small fixes

* Change to deprecated analysis class usage

* Analysis returns mitigator object instead of matrices

* Refactoring mitigation experiment

* Refactoring mitigation analysis

* Linting

* Linting

* Linting

* Linting

* Mitigation tutorial notebook

* Mitigation tutorial notebook update

* Mitigation experiment tests

* Linting

* Changes to visualization

* Bugfix

* Linting

* Avoiding failing test due to small bug in Terra

* Linting

* Linting

* Refactoring

* Tutorial texts

* Plot fix

* Release note

Co-authored-by: Christopher J. Wood <cjwood@us.ibm.com>
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Co-authored-by: Daniel Egger <38065505+eggerdj@users.noreply.github.com>
Co-authored-by: Will Shanks <wshaos@posteo.net>
Co-authored-by: Naoki Kanazawa <knzwnao@jp.ibm.com>
Co-authored-by: Yael Ben-Haim <yaelbh@il.ibm.com>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: dekelmeirom <33314493+dekelmeirom@users.noreply.github.com>
Co-authored-by: Will Shanks <willshanks@us.ibm.com>
Co-authored-by: Helena Zhang <Helena.Zhang@ibm.com>
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