
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
QPySequence, which stands for *Qblox Python Sequence*, is a python library to programmatically create the `sequence.json` file that is uploaded to a Qblox sequencer.
QPySequence, which stands for Qblox Python Sequence, is a python library developed by Qilimanjaro Quantum Tech to create the sequence.json
file that is uploaded to a Qblox sequencer.
The sequences that are uploaded to the Qblox instruments is a dictionary of four components:
In the Qblox docs there are several examples on how to write a Q1ASM program to perform a certain experiment as well as the necessary waveforms, acquisitions and weights to complete the sequence. This is task usually done by manually writing the waveforms and weights dictionaries with an inline numpy array generating function, the acquisitions are specified also manually, and finally a Q1ASM program is writen as a python formated string, with some variables inside for certain parameters.
This procedure is feasible for small examples and certain simple experiments. However, when integrating this into a larger codebase, for example, inside of a general quantum control library, with a complex class structure, holding many instrument drivers and being developed by several colaborators; the maintenance, quality, readability and debugging of the code can become a cumbersome task.
While certain parts of this procedure could be modularized with some helper functions, the string nature of the Q1ASM program as well with the remaining parts of the sequence it is connected to, indirectly via integers (the indices) that have to be handled separately, still leaves a lot of room for improvement with the implementation of a higher abstraction layer that would handle the creation of the sequence in an easier and more robust manner.
QPySequence is a library that handles all the components of a sequence as python objects, from the sequence itself to each instruction of the program, including new abstractions as blocks and loops to structure the program in a more clear and readable way.
The main classes of QPySequence imitate the structure of the sequence.json
itself: Waveforms
, Acquisitions
, Weights
and Program
, as well as the class Sequence
which contains them.
The Program
class is the one with higher complexity of the main four, with several internal classes used to structure all the instructions it holds (instances of classes which inherit from the abstract Instruction
class). In contrast, the other three main classes (Acquisitions
, Weights
and Waveforms
) share a very similar structure, since their structure is that of their dictionary counterpart in sequence.json
, with the addition of methods that facilitate their construction.
All the classes that are not internal have an implementation of the repr()
method, which gives the equivalent string representation of that object that will be actually sent to the sequencer. In this way, when a Sequence
object is completed with all of its components and its repr()
method is called, it calls the repr()
method of its elements, which gets recursively repeated until until reaching the lower layers, obtaining finally the complete string representation of the sequence.json
file that can be directly uploaded to a Qblox sequencer.
The repr()
method can be called on any component of QPySequence, which allow to only generate the string representation of a single component, as the Program
for example, if desired.
This simple example illustrates how to create a sequence for an averaged readout
import qpysequence as qps
import numpy as np
# Experiment parameters
readout_duration = 1000
play_acq_delay = 120
averaging_repetitions = 1024
# Create waveforms
waveforms = qps.waveforms.Waveforms()
readout_pulse = np.array([1.0 + 0.0j for _ in range(readout_duration)], dtype=np.complex128)
ro_index_i, ro_index_q = waveforms.add_pair_from_complex(readout_pulse)
# Create acquisitions
acquisitions = qps.acquisitions.Acquisitions()
acq_index = acquisitions.add("averaged")
# Create an empty weights object
weights = {}
# Create the program
program = qps.program.Program()
main_loop = qps.program.Loop("main", averaging_repetitions)
play = qps.program.instructions.Play(ro_index_i, ro_index_q, play_acq_delay)
acquire = qps.program.instructions.Acquire(acq_index, bin_index=0, wait_time=readout_duration)
main_loop.append_components([play, acquire])
program.append_block(main_loop)
# Create the sequence with all the components
sequence = qps.Sequence(program, waveforms, acquisitions, weights)
# The sequence can now be converted to a json string and uploaded to a qblox sequencer
sequence_json = repr(sequence)
If you want to participate in the project, set up first your local environment, set up the git hooks and install the library.
Read the development documentation.
FAQs
QPySequence, which stands for *Qblox Python Sequence*, is a python library to programmatically create the `sequence.json` file that is uploaded to a Qblox sequencer.
We found that qpysequence demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.