export_to_file
DrivenControl.export_to_file(filename, file_format='Q-CTRL expanded', file_type='CSV', coordinates='cylindrical')
Prepares and saves the driven control in a file.
Parameters
- filename (str) – Name and path of the file to save the control into.
- file_format (str , optional) – Specified file format for saving the control. Defaults to ‘Q-CTRL expanded’. Currently does not support any other format. For details of the Q-CTRL expanded format, see Notes.
- file_type (str , optional) – One of ‘CSV’ or ‘JSON’. Defaults to ‘CSV’.
- coordinates (str , optional) – The coordinate system in which to save the control. Must be ‘cylindrical’ or ‘cartesian’. Defaults to ‘cylindrical’.
Notes
The Q-CTRL expanded format is designed for direct integration of control solutions into experimental hardware. The format represents controls as vectors defined for the relevant operators sampled in time (corresponding to the segmentation of the Rabi rate, azimuthal angle, and detuning).
The exact data format depends on the file type and coordinate system. In all cases, the data contain four lists of real floating point numbers. Each list has the same length, and the n’th element of each list describes the n’th segment of the driven control.
For Cartesian coordinates, the four lists are X-amplitude, Y-amplitude, detuning, and duration. The maximum Rabi rate is also included in the data, and the X-amplitude and Y-amplitude are normalized to that maximum Rabi rate.
For cylindrical coordinates, the four lists are Rabi rate, azimuthal angle, detuning, and duration. The maximum Rabi rate is also included in the data, and the Rabi rate is normalized to that maximum Rabi rate.
For CSV, the data are formatted as five columns, with one row of titles, followed by N rows of data. The first four columns contain the relevant Cartesian or cylindrical data. The fifth column contains the maximum Rabi rate, and has the same value in each row.
For JSON, the data are formatted as a single object (dictionary) with four array fields, a “maximum_rabi_rate” field giving the maximum Rabi rate, and optionally a “name” field giving the name of the control.
For example, the CSV cylindrical representation of a control with two segments would be:
rabi_rate,azimuthal_angle,detuning,duration,maximum_rabi_rate
0.8,1.57,3000000.,0.000001,10000000
1.0,3.14,-3000000.,0.000002,10000000
The JSON Cartesian representation of the same control would be:
{
"name": "a custom control",
"maximum_rabi_rate": 10000000,
"amplitude_x": [0.0,-1.0],
"amplitude_y": [0.8,0.0],
"detuning": [3000000.0,-3000000.0],
"duration": [0.000001,0.000002],
}