Ejemplo n.º 1
0
class BackendConfigurationSchema(BaseSchema):
    """Schema for BackendConfiguration."""
    # Required properties.
    backend_name = fields.String(required=True)
    backend_version = fields.String(required=True,
                                    validate=Regexp("[0-9]+.[0-9]+.[0-9]+$"))
    n_qubits = fields.Integer(required=True, validate=Range(min=1))
    basis_gates = fields.List(fields.String(), required=True)
    gates = fields.Nested(GateConfigSchema, required=True, many=True)
    local = fields.Boolean(required=True)
    simulator = fields.Boolean(required=True)
    conditional = fields.Boolean(required=True)
    open_pulse = fields.Boolean(required=True)
    memory = fields.Boolean(required=True)
    max_shots = fields.Integer(required=True, validate=Range(min=1))
    coupling_map = fields.List(fields.List(fields.Integer(),
                                           validate=Length(min=1)),
                               validate=Length(min=1),
                               allow_none=True,
                               required=True)

    # Optional properties.
    max_experiments = fields.Integer(validate=Range(min=1))
    sample_name = fields.String()
    n_registers = fields.Integer(validate=Range(min=1))
    register_map = fields.List(fields.List(
        fields.Integer(validate=OneOf([0, 1])), validate=Length(min=1)),
                               validate=Length(min=1))
    configurable = fields.Boolean()
    credits_required = fields.Boolean()
    online_date = fields.DateTime()
    display_name = fields.String()
    description = fields.String()
    tags = fields.List(fields.String())
Ejemplo n.º 2
0
class NduvSchema(BaseSchema):
    """Schema for name-date-unit-value."""

    # Required properties.
    date = fields.DateTime(required=True)
    name = fields.String(required=True)
    unit = fields.String(required=True)
    value = fields.Number(required=True)
Ejemplo n.º 3
0
class BackendPropertiesSchema(BaseSchema):
    """Schema for BackendProperties."""

    # Required properties.
    backend_name = fields.String(required=True)
    backend_version = fields.String(required=True,
                                    validate=Regexp("[0-9]+.[0-9]+.[0-9]+$"))
    last_update_date = fields.DateTime(required=True)
    qubits = fields.List(fields.Nested(NduvSchema,
                                       many=True,
                                       validate=Length(min=1)),
                         required=True,
                         validate=Length(min=1))
    gates = fields.Nested(GateSchema,
                          required=True,
                          many=True,
                          validate=Length(min=1))
    general = fields.Nested(NduvSchema, required=True, many=True)