|
| 1 | +# Copyright 2025 Scaleway |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License.from typing import Optional, List, Dict |
| 14 | +import os |
| 15 | +import numpy as np |
| 16 | + |
| 17 | +from pulser import Pulse, Sequence, BlackmanWaveform, RampWaveform |
| 18 | +from pulser.backend import QPUBackend |
| 19 | +from pulser.register import Register |
| 20 | + |
| 21 | +from pulser_scaleway import ScalewayProvider |
| 22 | + |
| 23 | + |
| 24 | +qaas_connection = ScalewayProvider( |
| 25 | + project_id=os.environ["PULSER_SCALEWAY_PROJECT_ID"], |
| 26 | + secret_key=os.environ["PULSER_SCALEWAY_SECRET_KEY"], |
| 27 | +) |
| 28 | + |
| 29 | +platform = "pasqal_fresnel_simulation" |
| 30 | + |
| 31 | +devices = qaas_connection.fetch_available_devices() |
| 32 | +fresnel_device = devices[platform] |
| 33 | +register = Register.square(5, 5).with_automatic_layout(fresnel_device) |
| 34 | +sequence = Sequence(register, fresnel_device) |
| 35 | + |
| 36 | +sequence.declare_channel("rydberg_global", "rydberg_global") |
| 37 | +t = sequence.declare_variable("t", dtype=int) |
| 38 | + |
| 39 | +amp_wf = BlackmanWaveform(t, np.pi) |
| 40 | +det_wf = RampWaveform(t, -5, 5) |
| 41 | +sequence.add(Pulse(amp_wf, det_wf, 0), "rydberg_global") |
| 42 | + |
| 43 | +backend = QPUBackend(sequence=sequence, connection=qaas_connection) |
| 44 | + |
| 45 | +results = backend.run( |
| 46 | + job_params=[ |
| 47 | + {"runs": 100, "variables": {"t": 1000}}, |
| 48 | + {"runs": 20, "variables": {"t": 2000}}, |
| 49 | + ], |
| 50 | + wait=True, |
| 51 | +) |
| 52 | + |
| 53 | +print(results.results) |
0 commit comments