Comments (5)
Perhaps the last one can be just a line scan. So there are roughly two types. Another case would be 2D scan, but I don't have any mandatory experiment for now. Thus it can be future extension.
from qiskit-experiments.
A dataclass seems like a nice way to document metadata for an experiment. Though if we use them we should try and use the dataclass package functionality rather than add our own dict like API wrapper on top of it. Most of the extra methods here seem unnecessary:
- rather than wrap
to_dict
just use its built inasdict
, though in general if we are using dataclass we should avoid using them as dicts except when serializing for execution or DB storage. check_entry
should usehasattr(datacls, attr)
not conversion to dict. You could probably do something withdataclasses.fields
instead. Part of the point of using dataclasses is you dont need to do these checks, you can use type checking instead to know it has certain fields or not.- I don't think building in methods for returning xvalues is necessary. If an experiment has a metadata parameter for x-values it should just save it as
xval: float
. This can just be accessed usingdata.xval
or `getattr(data, xval). Of course this only matters for experiments where you plan on using common analysis classes (such as curve fitting).
from qiskit-experiments.
Thanks Chris for the feedback
- About
to_dict
; Yes we can use built-in function. However, this indicates we need to importdataclass
in many modules. This is just to avoid importingdataclass
. - About
check_entry
; I totally agree. The code above is just an example to show concept (maybe I should write pseudo code...). - About
xval
; I think this depends who uses metadata. If metadata is a public member (and intended to be exposed to end-users), I prefer more meaningful name rather than justxval
. Another useful case of method is multi axes scan. Addingdata.xval1
anddata.xval2
will be the most straightforward approach to create metadata, but this is quite confusing and developer may induce a bug. If this is implemented as a method, we can override this with, for example
def get_x_value(self) -> Tuple[float, float]:
return (self.frequency, self.amp)
from qiskit-experiments.
Anything the end user cares about should be in the analysis result, and the average user never needs to see raw metadata. It's only there so you can run the analysis. This is why I think it should just be a simple container (whether dict, simple namespace, dataclass etc), not something you add a lot of methods to. Extra methods for getting values or processing should be part of the analysis classes + data processor classes where the metadata is used.
It seems like most of what this is aiming to accomplish with the x-y values would also be accomplished by having general purpose analysis classes for the various types of curve fitting. These should then be used as parent classes for other experiments.
from qiskit-experiments.
I understand. It sounds like dataclass is not necessary and analysis should know the field of metadata, i.e. generator and analysis are attached to the same experiment. The purpose of this issue is to decouple metadata from analysis to make general purpose analysis as you mentioned. This means extract function API proposed in #23 is sufficient and I can close the issue.
from qiskit-experiments.
Related Issues (20)
- Deprecate BackendData.is_simulator HOT 1
- Experiment serialization HOT 9
- Investigate performance of ExperimentData regarding adding more data to it
- `save` to report success and result database link
- Copied analysis result not saving to cloud service
- Clearly mark analysis result names in documentation
- Build release notes for older patch releases
- Implementing an adaptive Trotter decomposition that dynamically adjusts the number of Trotter steps based on the complexity of the quantum circuit. HOT 2
- Median Quartiles and Box Plots HOT 1
- Investigation of Quantum Sources for Time-Correlated Noise in Solid-State Quantum Devices HOT 2
- Error in the plotter if there is no valid fitter error
- Returning `Pauli` or `SparsePauliOp` analysis results implicitly calls their `to_matrix` method when adding to dataframe HOT 2
- Progress/status indicator?
- Randomized benchmarking fails to analyze the results from IBM Eagle, due to the lack of 2Q gate decomposition value for ECR gate
- Add `SamplerV2` support
- Jobs retrieved from hardware do not write "physical_qubits" metadata, causing MitigatedTomographyAnalysis to fail HOT 2
- Extensions patch release blocking `qiskit` PR HOT 3
- Regularize provider/service interface
- Track changes in experiment circuits
- Update visualization tutorial
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qiskit-experiments.