save_results
- qililab.result.save_results(results, loops, data_path, name=None)
Save the given results and the platform.
A timestamp is used to create a folder to save the data. The data will be saved within the file located in:
path/yearmonthday/hourminutesecond_name/results.h5.- Parameters:
results (
np.ndarray) – Array containing the results to be saved.loops (
dict) – A dictionary containing all the loops used in an experiment. The keys are used to identify the loop and the values of the dictionary correspond to the values of the loop.data_path (
str) – Path to the main data directory.name (
str, optional) – Name of the experiment. If given, the name is added to the name of the folder. Defaults to None.
- Returns:
Path to folder where the results are saved.
- Return type:
str
Examples
Imagine you want to run the following sequence:
circuit = Circuit(1) circuit.add(gates.X(0)) circuit.add(gates.M(0)) results = [] gain_values = np.arange(0, 1, step=0.01) for gain in gain_values: platform.set_parameter(alias="drive_q0", parameter=ql.Parameter.GAIN, value=gain) result = platform.execute(circuit, num_avg=1000, repetition_duration=200000) results.append(result) results = np.hstack(results)You can then save the results by running:
loops = {"drive_q0_gain": gain_values} ql.save_results(results=results, loops=loops, path="data/", name="rabi")Imagine we call the cell above on August 22nd of 2023, at 15:14:12. The file will then be saved to:
data/20230822/151412_rabi/results.h5.