Package: aliro-quantum
aliro-quantumThis is an api for the Aliro Quantum AppThis Python package is automatically generated by theOpenAPI Generatorproject:API version: 1.0.0Package version: 2.33.0Build package: org.openapitools.codegen.languages.PythonClientCodegenRequirements.Python 2.7 and 3.4+Installation & Usagepip installpipinstallaliro-quantumThen import the package:importaliro_quantumGetting StartedPlease follow theinstallation procedureand then run the following:Aliro Quantum PIP Package Getting StartedInstall the Aliro Quantum pip packagepipinstallaliro-quantumImport necessary modulesimportaliro_quantumfromaliro_quantum.restimportApiExceptionfrompprintimportpprintfromtypingimportListSet up authenticationYou can retrieve your API token in your "Account" page athttps://app.aliro.io/configuration=aliro_quantum.Configuration()configuration.api_key['Authorization']='API_TOKEN'configuration.host='https://app.aliro.io'Retrieve possible languagesAt the time of this writing, possible languages are:QASMQuilquil_language:strwithaliro_quantum.ApiClient(configuration)asapi_client:info_api_instance=aliro_quantum.InfoApi(api_client)try:languages_list:aliro_quantum.InfoGetResponse=info_api_instance.info_languages_get(inputs_only=True)quil_language=next(language_info.valueforlanguage_infoinlanguages_list.dataiflanguage_info.id=='quil')pprint(languages_list)exceptApiExceptionase:print("Exception when calling InfoApi->info_languages_get:%s\n"%e)raisee{'data': [{'id': 'qasm', 'value': 'QASM'}, {'id': 'quil', 'value': 'Quil'}]}Retrieve possible execution typesAt the time of this writing, possible execution types are:realsimulatedbothsimulation_only_execution_type:strwithaliro_quantum.ApiClient(configuration)asapi_client:info_api_instance=aliro_quantum.InfoApi(api_client)try:execution_type_info_list:aliro_quantum.InfoGetResponse=info_api_instance.info_execution_types_get()simulation_only_execution_type=next(execution_type_info.valueforexecution_type_infoinexecution_type_info_list.dataifexecution_type_info.id=='2')pprint(execution_type_info_list)exceptApiExceptionase:print("Exception when calling InfoApi->auth_login_post:%s\n"%e)raisee{'data': [{'id': '1', 'value': 'real'},
          {'id': '2', 'value': 'simulated'},
          {'id': '3', 'value': 'both'}]}Get possible device targets and informationdevices_list:aliro_quantum.OwnerDetailswithaliro_quantum.ApiClient(configuration)asapi_client:device_rankings_api_instance=aliro_quantum.DeviceRankingsApi(api_client)try:devices_list_response:aliro_quantum.DeviceListResponse=device_rankings_api_instance.devices_list_get()devices_list=devices_list_response.datapprint(devices_list_response)exceptApiExceptionase:print("Exception when calling DeviceRankingsApi->devices_list_get:%s\n"%e)raisee{'data': {'owners': {'IBM': {'devices': {'ibmq_rome': {'device_id': 'ibmq_rome',
                                                       'display_name': 'ibmq_rome',
                                                       'gates': [{'fidelity': 0.9880405409838382,
                                                                  'gate_type': 'CX',
                                                                  'qubit_from': {'fidelity_rotation': 0.9994152165869413,
                                                                                 'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                                 'name': 4,
                                                                                 'pos_x': 200.0,
                                                                                 'pos_y': 0.0,
                                                                                 'real_qubit': 4},
                                                                  'qubit_to': {'fidelity_rotation': 0.9993837791241802,
                                                                               'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                               'name': 3,
                                                                               'pos_x': 150.0,
                                                                               'pos_y': 0.0,
                                                                               'real_qubit': 3}},
                                                                 {'fidelity': 0.9856693955271434,
                                                                  'gate_type': 'CX',
                                                                  'qubit_from': {'fidelity_rotation': 0.9993837791241802,
                                                                                 'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                                 'name': 3,
                                                                                 'pos_x': 150.0,
                                                                                 'pos_y': 0.0,
                                                                                 'real_qubit': 3},
                                                                  'qubit_to': {'fidelity_rotation': 0.9994152165869413,
                                                                               'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                               'name': 4,
                                                                               'pos_x': 200.0,
                                                                               'pos_y': 0.0,
                                                                               'real_qubit': 4}},
                                                                 {'fidelity': 0.9892630599738325,
                                                                  'gate_type': 'CX',
                                                                  'qubit_from': {'fidelity_rotation': 0.9993837791241802,
                                                                                 'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                                 'name': 3,
                                                                                 'pos_x': 150.0,
                                                                                 'pos_y': 0.0,
                                                                                 'real_qubit': 3},
                                                                  'qubit_to': {'fidelity_rotation': 0.9993763479004819,
                                                                               'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                               'name': 2,
                                                                               'pos_x': 100.0,
                                                                               'pos_y': 0.0,
                                                                               'real_qubit': 2}},
                                                                 {'fidelity': 0.9868122191056748,
                                                                  'gate_type': 'CX',
                                                                  'qubit_from': {'fidelity_rotation': 0.9993763479004819,
                                                                                 'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                                 'name': 2,
                                                                                 'pos_x': 100.0,
                                                                                 'pos_y': 0.0,
                                                                                 'real_qubit': 2},
                                                                  'qubit_to': {'fidelity_rotation': 0.9993837791241802,
                                                                               'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                               'name': 3,
                                                                               'pos_x': 150.0,
                                                                               'pos_y': 0.0,
                                                                               'real_qubit': 3}},
                                                                 {'fidelity': 0.9883232732901912,
                                                                  'gate_type': 'CX',
                                                                  'qubit_from': {'fidelity_rotation': 0.9993763479004819,
                                                                                 'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                                 'name': 2,
                                                                                 'pos_x': 100.0,
                                                                                 'pos_y': 0.0,
                                                                                 'real_qubit': 2},
                                                                  'qubit_to': {'fidelity_rotation': 0.9995167318229694,
                                                                               'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                               'name': 1,
                                                                               'pos_x': 50.0,
                                                                               'pos_y': 0.0,
                                                                               'real_qubit': 1}},
                                                                 {'fidelity': 0.9861370891980876,
                                                                  'gate_type': 'CX',
                                                                  'qubit_from': {'fidelity_rotation': 0.9995167318229694,
                                                                                 'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                                 'name': 1,
                                                                                 'pos_x': 50.0,
                                                                                 'pos_y': 0.0,
                                                                                 'real_qubit': 1},
                                                                  'qubit_to': {'fidelity_rotation': 0.9993763479004819,
                                                                               'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                               'name': 2,
                                                                               'pos_x': 100.0,
                                                                               'pos_y': 0.0,
                                                                               'real_qubit': 2}},
                                                                 {'fidelity': 0.9786906667138251,
                                                                  'gate_type': 'CX',
                                                                  'qubit_from': {'fidelity_rotation': 0.9995167318229694,
                                                                                 'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                                 'name': 1,
                                                                                 'pos_x': 50.0,
                                                                                 'pos_y': 0.0,
                                                                                 'real_qubit': 1},
                                                                  'qubit_to': {'fidelity_rotation': 0.999416000095865,
                                                                               'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                               'name': 0,
                                                                               'pos_x': 0.0,
                                                                               'pos_y': 0.0,
                                                                               'real_qubit': 0}},
                                                                 {'fidelity': 0.9766032827219325,
                                                                  'gate_type': 'CX',
                                                                  'qubit_from': {'fidelity_rotation': 0.999416000095865,
                                                                                 'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                                 'name': 0,
                                                                                 'pos_x': 0.0,
                                                                                 'pos_y': 0.0,
                                                                                 'real_qubit': 0},
                                                                  'qubit_to': {'fidelity_rotation': 0.9995167318229694,
                                                                               'last_reported_fidelity_rotation_datetime': '2020-06-18T09:25:03+00:00',
                                                                               'name': 1,
                                                                               'pos_x': 50.0,
                                                                               'pos_y': 0.0,
                                                                               'real_qubit': 1}}],
                                                       'is_simulator': False,
                                                       'last_calibration': '2020-06-18T09:25:03+00:00',
                                                       'max_shots': 8192,
                                                       'next_available_time': None,
                                                       'price': None,
                                                       't1': 70.59164221606711,
                                                       't2': 92.8079648560683}}}}}}Choose desired target (owner + device ID) from devices_listexample_owner=list(devices_list.owners.keys())[0]exmaple_device_id=list(devices_list.owners[example_owner].devices.keys())[0]example_target=aliro_quantum.OwnerDetails(owners={example_owner:aliro_quantum.OwnerDetailsOwners(devices={exmaple_device_id:aliro_quantum.DeviceDetails()})})pprint(f'Owner:{example_owner}')pprint(f'Device ID:{exmaple_device_id}')'Owner: IBM'
'Device ID: ibmq_rome'Create submission infosubmission_name='test_submission'submission_post_parameters=aliro_quantum.Submission(circuits=[aliro_quantum.Circuit(body='DECLARE ro BIT[1]\nH 0\nMEASURE 0 ro[0]\n',jobs=[aliro_quantum.Job(allocations=aliro_quantum.JobAllocations(input_parameters=aliro_quantum.CompilationParameters(num_allocations=4)),execution=aliro_quantum.JobExecution(parameters=aliro_quantum.ExecutionParameters(num_shots=200,output_type=simulation_only_execution_type)),target=example_target)],language=quil_language)],name=submission_name)Submit the new submissionwithaliro_quantum.ApiClient(configuration)asapi_client:submissions_api_instance=aliro_quantum.SubmissionsApi(api_client)try:submission_api_response=submissions_api_instance.submissions_post(submission_post_parameters=submission_post_parameters)pprint(submission_api_response)exceptApiExceptionase:print("Exception when calling SubmissionsApi->submissions_post:%s\n"%e){'success': True}Wait for completionThis will likely take a few minutes or more.submission_details:aliro_quantum.Submissionwithaliro_quantum.ApiClient(configuration)asapi_client:submissions_api_instance=aliro_quantum.SubmissionsApi(api_client)try:forsubmission_get_responseinsubmissions_api_instance.submissions_submission_name_stream_get(submission_name=submission_name,completion_only='true'):submission_details=submission_get_response.submission_detailbreakexceptApiExceptionase:print("Exception when calling SubmissionsApi->submissions_submission_name_stream_get:%s\n"%e)Print resultsShot-for-shot results will be a list of measurements for each allocation of the circuit.first_circuit:aliro_quantum.Circuit=submission_details.circuits[0]first_job:aliro_quantum.Job=first_circuit.jobs[0]errors:List[aliro_quantum.JobErrors]=first_job.errorsiflen(errors):pprint(errors)else:execution:aliro_quantum.JobExecution=first_job.executionresults:aliro_quantum.ExecutionResults=execution.resultsresults_simulated:aliro_quantum.ResultsData=results.simulatedresults_simulated_measurements:aliro_quantum.ResultsDataMeasurements=results_simulated.measurementspprint(results_simulated_measurements.raw)[[[1],
  [1],
  [0],
  [0],
  [1],
  [1],
  [1],
  [1],
  [0],
  [1],
  [1],
  [1],
  [1],
  [0],
  [0],
  [1],
  [1],
  [0],
  [0],
  [0],
  [1],
  [1],
  [1],
  [1],
  [0],
  [0],
  [1],
  [1],
  [0],
  [0],
  [1],
  [1],
  [1],
  [0],
  [0],
  [0],
  [1],
  [0],
  [0],
  [0],
  [1],
  [0],
  [0],
  [0],
  [1],
  [0],
  [0],
  [0],
  [1],
  [1]],
 [[0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [1],
  [0],
  [1],
  [0],
  [1],
  [1],
  [0],
  [1],
  [0],
  [1],
  [0],
  [0],
  [0],
  [1],
  [0],
  [1],
  [0],
  [0],
  [1],
  [1],
  [0],
  [1],
  [0],
  [1],
  [0],
  [0],
  [0],
  [1],
  [1],
  [1],
  [0],
  [1],
  [1],
  [0],
  [1],
  [0],
  [1],
  [1],
  [0],
  [1],
  [1],
  [1]],
 [[1],
  [0],
  [1],
  [0],
  [0],
  [1],
  [1],
  [1],
  [1],
  [1],
  [0],
  [0],
  [1],
  [1],
  [1],
  [1],
  [0],
  [0],
  [1],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [1],
  [1],
  [1],
  [1],
  [0],
  [1],
  [0],
  [0],
  [1],
  [1],
  [1],
  [1],
  [0],
  [1],
  [1],
  [1],
  [1],
  [0],
  [1],
  [1],
  [1],
  [1],
  [0],
  [0],
  [1]],
 [[0],
  [0],
  [1],
  [0],
  [1],
  [0],
  [1],
  [0],
  [1],
  [1],
  [0],
  [1],
  [1],
  [0],
  [0],
  [0],
  [1],
  [1],
  [1],
  [1],
  [1],
  [0],
  [1],
  [0],
  [1],
  [1],
  [0],
  [0],
  [0],
  [1],
  [1],
  [1],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [1],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [0],
  [1]]]Documentation for API EndpointsAll URIs are relative tohttps://app.aliro.ioClassMethodHTTP requestDescriptionAuthenticationApiauth_login_postPOST/auth/loginlogin using username and passwordCircuitApicircuit_qaoa_postPOST/circuit/qaoacompiles a quantum circuit for use in QAOACircuitApicircuit_translation_postPOST/circuit/translationtranslates circuits into other quantum languagesCircuitApicircuit_visualization_getGET/circuit/visualizationCircuitApicircuit_visualization_postPOST/circuit/visualizationconverts a Quil circuit into a PNG imageCredentialsApicredentials_vendor_deleteDELETE/credentials/{vendor}delete vendor credentials for a userCredentialsApicredentials_vendor_putPUT/credentials/{vendor}add vendor credentials for a userDeviceRankingsApidevices_list_getGET/devicesListretrieves list of potential devices to run the circuit onDeviceRankingsApidevices_list_stream_getGET/devicesList/streamstreams device detail updatesDeviceRankingsApidevices_next_available_getGET/devices/nextAvailableretrieves list of next avaiable times for devicesDeviceRankingsApirankings_list_postPOST/rankingsListretrieves predicted device rankingsInfoApiinfo_execution_types_getGET/info/executionTypesget list of possible execution types for jobsInfoApiinfo_languages_getGET/info/languagesget list of languages in databaseJobsApijobs_cancel_job_id_postPOST/jobs/cancel/{jobId}cancel jobSubmissionsApisubmissions_deleteDELETE/submissionsdelete submissionsSubmissionsApisubmissions_getGET/submissionsget all user's submissionsSubmissionsApisubmissions_postPOST/submissionssubmit a new submissionSubmissionsApisubmissions_submission_name_getGET/submissions/{submissionName}get submissionsSubmissionsApisubmissions_submission_name_stream_getGET/submissions/{submissionName}/streamstream submission updatesUserApiuser_information_update_postPOST/user/informationUpdateupdate user email and nameUserApiuser_password_change_postPOST/user/passwordChangechange user password from known passwordDocumentation For ModelsAllocationBasicSuccessChangePasswordParamsCircuitCircuitInputCompilationParametersCompiledCircuitCompiledCircuitResponseControlFlowGraphCircuitCredentialsAddParametersCredentialsAqtCredentialsBasicCredentialsDeleteParametersCredentialsHoneywellCredentialsIbmCredentialsIbmProviderCredentialsRigettiCredentialsVendorDeleteSubmissionParametersDeviceDetailsDeviceListResponseDeviceRankingDeviceRankingResponseDeviceRankingsParametersExecutionParametersExecutionResultsGateInfoGetResponseInfoGetResponseDataJobJobAllocationsJobCostsJobErrorsJobExecutionLoginResponseOwnerDetailsOwnerDetailsOwnersPidResponseQubitReservationResultsDataResultsDataMeasurementsSubmissionSubmissionDetailResponseSubmissionSummarySubmissionSummaryJobsSubmissionSummaryResponseTranslationParametersTranslationResponseUpdateUserInformationParamsUserInfoVisualizationResponseDocumentation For AuthorizationAliro users can retrieve their API key in their account page athttps://app.aliro.io/JwtKeyAuthType: API keyAPI key parameter name: AuthorizationLocation: HTTP headerAuthornick@aliroquantum.com