bbndb package

Submodules

bbndb.auspex module

class bbndb.auspex.Average(**kwargs)[source]

Bases: bbndb.auspex.FilterProxy, bbndb.auspex.NodeMixin

Takes data and collapses along the specified axis. Threshold is used for state identification.

axis
connection_from
connection_to
hash_val
id
label
node_type
qubit_name
threshold
class bbndb.auspex.Buffer(**kwargs)[source]

Bases: bbndb.auspex.OutputProxy, bbndb.auspex.NodeMixin

Saves data in a buffer

connection_from
connection_to
hash_val
id
label
max_size
node_type
qubit_name
class bbndb.auspex.Connection(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

id
node1_id
node1_name
node2_id
node2_name
pipeline_name
time
class bbndb.auspex.Demodulate(**kwargs)[source]

Bases: bbndb.auspex.FilterProxy, bbndb.auspex.NodeMixin

Digital demodulation and filtering to select a signal at a particular frequency component. This filter does the following:

  1. First stage decimating filter on data
  2. Take product of result with with reference signal at demodulation frequency
  3. Second stage decimating filter on result to boost n_bandwidth
  4. Final channel selecting filter at n_bandwidth/2

If an axis name is supplied to follow_axis then the filter will demodulate at the freqency axis_frequency_value - follow_freq_offset otherwise it will demodulate at frequency. Note that the filter coefficients are still calculated with respect to the frequency paramter, so it should be chosen accordingly when follow_axis is defined.

bandwidth
connection_from
connection_to
decimation_factor
follow_axis
follow_freq_offset
frequency
hash_val
id
label
node_type
qubit_name
validate_bandwidth(key, value)[source]
validate_decimation_factor(key, value)[source]
validate_frequency(key, value)[source]
class bbndb.auspex.Display(**kwargs)[source]

Bases: bbndb.auspex.OutputProxy, bbndb.auspex.NodeMixin

Create a plot tab within the plotting interface.

connection_from
connection_to
hash_val
id
label
node_type
plot_dims
plot_mode
qubit_name
validate_plot_dims(key, value)[source]
class bbndb.auspex.FidelityKernel(**kwargs)[source]

Bases: bbndb.auspex.FilterProxy, bbndb.auspex.NodeMixin

Calculates the single shot fidelity from given input

connection_from
connection_to
hash_val
id
label
logistic_regression
node_type
optimal_integration_time
qubit_name
save_kernel
set_threshold
tolerance
zero_mean
class bbndb.auspex.FilterProxy(**kwargs)[source]

Bases: bbndb.auspex.NodeMixin, bbndb.auspex.NodeProxy

docstring for FilterProxy

add(filter_obj, connector_out='source', connector_in='sink')[source]
connection_from
connection_to
drop()[source]
hash_val
id
label
node_label()[source]
node_type
qubit_name
class bbndb.auspex.Framer(**kwargs)[source]

Bases: bbndb.auspex.FilterProxy, bbndb.auspex.NodeMixin

Emit out data in increments defined by the specified axis.

axis
connection_from
connection_to
hash_val
id
label
node_type
qubit_name
class bbndb.auspex.Integrate(**kwargs)[source]

Bases: bbndb.auspex.FilterProxy, bbndb.auspex.NodeMixin

bias
box_car_start
box_car_stop
connection_from
connection_to
demod_frequency
hash_val
id

Integrate with a given kernel or using a simple boxcar. Kernel will be padded/truncated to match record length

kernel
label
node_type
qubit_name
simple_kernel
validate_box_car_start(key, value)[source]
validate_box_car_stop(key, value)[source]
class bbndb.auspex.NodeMixin[source]

Bases: object

id = Column(None, Integer(), ForeignKey('nodeproxy.id'), table=None, primary_key=True, nullable=False)
class bbndb.auspex.NodeProxy(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

connection_from
connection_to
hash_val
id
label
node_type
print(show=True)[source]
qubit_name
class bbndb.auspex.OutputProxy(**kwargs)[source]

Bases: bbndb.auspex.FilterProxy, bbndb.auspex.NodeMixin

connection_from
connection_to
hash_val
id
label
node_type
qubit_name
class bbndb.auspex.StreamSelect(pipelineMgr=None, **kwargs)[source]

Bases: bbndb.auspex.NodeMixin, bbndb.auspex.NodeProxy

docstring for FilterProxy

add(filter_obj, connector_out='source', connector_in='sink')[source]
clear_pipeline()[source]

Remove all nodes coresponding to the qubit

connection_from
connection_to
create_default_pipeline(average=True, buffers=False)[source]
dsp_channel
hash_val
id
if_freq
kernel

The kernel as represented by a numpy complex128 array, or the name of a kernel file.

kernel_bias
kernel_data
label
node_label()[source]
node_type
qubit_name
show_connectivity()[source]
show_pipeline()[source]
stream_type
threshold
threshold_invert
validate_stream_type(key, value)[source]
class bbndb.auspex.Write(**kwargs)[source]

Bases: bbndb.auspex.OutputProxy, bbndb.auspex.NodeMixin

Writes data to file.

add_date
connection_from
connection_to
filename
groupname
hash_val
id
label
node_type
qubit_name

bbndb.qgl module

Channels is where we store information for mapping virtual (qubit) channel to real channels.

Created on Jan 19, 2012 in the QGL package

Original Author: Colm Ryan Modified By: Graham Rowlands (moved to bbndb using sqlalchemy)

Copyright 2013 Raytheon BBN Technologies

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class bbndb.qgl.Attenuator(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

address
ch(name)[source]
channel_db_id
channels
get_chan(name)[source]
id
label
model
standalone
class bbndb.qgl.AttenuatorChannel(**kwargs)[source]

Bases: bbndb.qgl.PhysicalChannel, bbndb.qgl.ChannelMixin

Physical Channel on an Attenutator

DCsource
DCsource_id
attenuation
attenuator
attenuator_id
channel
channel_db_id
delay
generator
generator_id
id
instrument
label
log_chan
receiver
receiver_id
sampling_rate
spectrumanalyzer
spectrumanalyzer_id
translator
transmitter
transmitter_id
type
class bbndb.qgl.Channel(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Every channel has a label and some printers.

channel_db_id
id
label
type
class bbndb.qgl.ChannelDatabase(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

DCSources
all_instruments()[source]
attenuators
channels
generators
id
instruments
label
notes
processors
receivers
spectrum_analyzers
time
transceivers
transmitters
class bbndb.qgl.ChannelMixin[source]

Bases: object

id = Column(None, Integer(), ForeignKey('channel.id'), table=None, primary_key=True, nullable=False)
class bbndb.qgl.DCSource(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

address
channel_db_id
id
label
level
mode
model
output
phys_chans
pump_source
standalone
class bbndb.qgl.DatabaseItem[source]

Bases: object

channel_db_id = Column(None, Integer(), ForeignKey('channeldatabase.id'), table=None)
id = Column(None, Integer(), table=None, primary_key=True, nullable=False)
label = Column(None, String(), table=None, nullable=False)
standalone = Column(None, Boolean(), table=None, nullable=False, default=ColumnDefault(False))
class bbndb.qgl.DigitalInput(**kwargs)[source]

Bases: bbndb.qgl.PhysicalChannel, bbndb.qgl.ChannelMixin

A digital input channel on a Processor.

DCsource
DCsource_id
channel
channel_db_id
delay
generator
generator_id
id
instrument
label
log_chan
meas_chan_id
processor
processor_id
receiver
receiver_id
sampling_rate
spectrumanalyzer
spectrumanalyzer_id
translator
transmitter
transmitter_id
type
class bbndb.qgl.Edge(**kwargs)[source]

Bases: bbndb.qgl.LogicalChannel, bbndb.qgl.ChannelMixin

Defines an arc/directed edge between qubit vertices. If a device supports bi-directional connectivity, that is represented with two independent Edges.

An Edge is also effectively an abstract channel, so it carries the same properties as a Qubit channel.

channel_db_id
frequency
gate_chan
gate_chan_id
id
isforward(source, target)[source]

Test whether (source, target) matches the directionality of the edge.

label
phys_chan_id
pulse_params
source_id
target_id
type
class bbndb.qgl.Generator(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

DCsource_id
address
channel_db_id
frequency
id
label
model
phys_chans
power
reference
spectrumanalyzer_id
standalone
class bbndb.qgl.Instrument(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

address
channel_db_id
id
label
model
parameters
standalone
class bbndb.qgl.LogicalChannel(**kwargs)[source]

Bases: bbndb.qgl.ChannelMixin, bbndb.qgl.Channel

The main class from which we will generate sequences. At some point it needs to be assigned to a physical channel.

frequency: modulation frequency of the channel (can be positive or negative)
channel_db_id
frequency
gate_chan
gate_chan_id
id
label
phys_chan_id
pulse_params
type
class bbndb.qgl.LogicalMarkerChannel(**kwargs)[source]

Bases: bbndb.qgl.LogicalChannel, bbndb.qgl.ChannelMixin

A class for digital channels for gating sources or triggering other things.

channel_db_id
frequency
gate_chan
gate_chan_id
id
label
meas_chan_id
phys_chan_id
pulse_params
type
class bbndb.qgl.Measurement(**kwargs)[source]

Bases: bbndb.qgl.LogicalChannel, bbndb.qgl.ChannelMixin

A class for measurement channels. Measurements are special because they can be different types: autodyne which needs an IQ pair or hetero/homodyne which needs just a marker channel.

meas_type: Type of measurement (autodyne, homodyne) autodyne_freq: use to bake the modulation into the pulse, so that it has constant phase frequency: use to associate modulation with the channel
autodyne_freq
channel_db_id
control_chan_id
frequency
gate_chan
gate_chan_id
id
label
meas_type
phys_chan_id
processor_chan
pulse_params
receiver_chan
trig_chan
type
validate_frequency(key, value)[source]
validate_meas_type(key, source)[source]
class bbndb.qgl.MutableDict[source]

Bases: sqlalchemy.ext.mutable.Mutable, dict

classmethod coerce(key, value)[source]

Given a value, coerce it into the target type.

Can be overridden by custom subclasses to coerce incoming data into a particular type.

By default, raises ValueError.

This method is called in different scenarios depending on if the parent class is of type Mutable or of type MutableComposite. In the case of the former, it is called for both attribute-set operations as well as during ORM loading operations. For the latter, it is only called during attribute-set operations; the mechanics of the composite() construct handle coercion during load operations.

Parameters:
  • key – string name of the ORM-mapped attribute being set.
  • value – the incoming value.
Returns:

the method should return the coerced value, or raise ValueError if the coercion cannot be completed.

class bbndb.qgl.PhysicalChannel(**kwargs)[source]

Bases: bbndb.qgl.ChannelMixin, bbndb.qgl.Channel

The main class for actual Transmitter channels.

DCsource
DCsource_id
channel_db_id
delay
generator
generator_id
id
instrument
label
log_chan
q()[source]
receiver
receiver_id
sampling_rate
spectrumanalyzer
spectrumanalyzer_id
translator
transmitter
transmitter_id
type
class bbndb.qgl.PhysicalMarkerChannel(**kwargs)[source]

Bases: bbndb.qgl.PhysicalChannel, bbndb.qgl.ChannelMixin

A digital output channel on an Transmitter.
gate_buffer: How much extra time should be added onto the beginning of a gating pulse gate_min_width: The minimum marker pulse width
DCsource
DCsource_id
channel
channel_db_id
delay
gate_buffer
gate_min_width
generator
generator_id
id
instrument
label
log_chan
receiver
receiver_id
sampling_rate
sequence_file
spectrumanalyzer
spectrumanalyzer_id
translator
transmitter
transmitter_id
type
class bbndb.qgl.PhysicalQuadratureChannel(**kwargs)[source]

Bases: bbndb.qgl.PhysicalChannel, bbndb.qgl.ChannelMixin

Something used to implement a standard qubit channel with two analog channels and a microwave gating channel.

DCsource
DCsource_id
I_channel_amp_factor
I_channel_offset
Q_channel_amp_factor
Q_channel_offset
amp_factor
attenuation
channel
channel_db_id
delay
generator
generator_id
id
instrument
label
log_chan
phase_skew
receiver
receiver_id
sampling_rate
sequence_file
spectrumanalyzer
spectrumanalyzer_id
translator
transmitter
transmitter_id
type
class bbndb.qgl.Processor(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

A hardware unit used for signal processing, e.g. a TDM model: currently TDM is the only supported model address: instrument address (string) master: true if trigger master (boolean) trigger_interval: (s) trigger_source: internal / external (string) channels: digital inputs (typically carrying the results of qubit state assignment). Used to map meas. results into memory (see QGL.PulsePrimitives.MEASA)

address
ch(name)[source]
channel_db_id
channels
get_chan(name)[source]
id
label
master
model
standalone
transceiver_id
trigger_interval
trigger_source
class bbndb.qgl.Qubit(**kwargs)[source]

Bases: bbndb.qgl.LogicalChannel, bbndb.qgl.ChannelMixin

The main class for generating qubit pulses. Effectively a logical “QuadratureChannel”.
frequency: modulation frequency of the channel (can be positive or negative)
channel_db_id
edge_source
edge_target
frequency
gate_chan
gate_chan_id
id
label
measure_chan
phys_chan_id
pulse_params
type
class bbndb.qgl.Receiver(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

A receiver , or generally an analog to digitial converter

acquire_mode
address
ch(name)[source]
channel_db_id
channels
get_chan(name)[source]
id
label
model
number_averages
number_segments
number_waveforms
record_length
reference
sampling_rate
standalone
stream_sel
stream_types
transceiver_id
trigger_source
validate_acquire_mode(key, source)[source]
validate_reference(key, source)[source]
validate_trigger_source(key, source)[source]
vertical_scale
class bbndb.qgl.ReceiverChannel(**kwargs)[source]

Bases: bbndb.qgl.PhysicalChannel, bbndb.qgl.ChannelMixin

ReceiverChannel denotes the physical receive channel on a transceiver. The actual stream type, and the dsp stream id, are handled by the pipeline.

DCsource
DCsource_id
channel
channel_db_id
delay
generator
generator_id
id
instrument
label
log_chan
pulse_check()[source]
receiver
receiver_id
sampling_rate
spectrumanalyzer
spectrumanalyzer_id
translator
transmitter
transmitter_id
triggering_chan_id
type
validate_stream_type(key, source)[source]
class bbndb.qgl.SpectrumAnalyzer(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

LO_source
address
channel_db_id
id
label
model
phys_chans
standalone
class bbndb.qgl.Transceiver(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

A single machine or rack of a2ds and d2as that we want to treat as a unit.

address
channel_db_id
get_thing(thing_type, name)[source]
id
initialize_separately
label
master
model
processors
px(name)[source]
receivers
rx(name)[source]
standalone
transmitters
tx(name)[source]
class bbndb.qgl.Transmitter(**kwargs)[source]

Bases: bbndb.qgl.DatabaseItem, sqlalchemy.ext.declarative.api.Base

An arbitrary waveform generator, or generally a digital to analog converter

address
ch(name)[source]
channel_db_id
channels
delay
get_chan(name)[source]
id
label
master
model
sequence_file
standalone
transceiver_id
trigger_interval
trigger_source
validate_trigger_source(key, source)[source]

bbndb.calibration module

class bbndb.calibration.Calibration(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

category
date
id
name
sample_id
uncertainty
value
class bbndb.calibration.Sample(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

calibrations
id
name

bbndb.session module

bbndb.session.get_cl_session()[source]
bbndb.session.get_pl_session()[source]
bbndb.session.initialize_db(provider)[source]
bbndb.session.session_scope()[source]

Provide a transactional scope around a series of operations.

Module contents

bbndb.copy_sqla_object(obj, omit_fk=True)[source]

Given an SQLAlchemy object, creates a new object and copies across all attributes, omitting PKs, FKs (by default), and relationship attributes.

Originally from Rudolf Cardinal: https://groups.google.com/forum/#!topic/sqlalchemy/wb2M_oYkQdY

bbndb.deepcopy_sqla_object(startobj, session, flush=True)[source]

Originally from Rudolf Cardinal: https://groups.google.com/forum/#!topic/sqlalchemy/wb2M_oYkQdY

bbndb.set_defaults_up_front(obj, args, kwargs)[source]