Skip to content

Alias_sampling_basic.json not updated after local_variables QREF change #102

@b-goldsmith

Description

@b-goldsmith

Describe the bug

In issue #71 (PR #79) local_variables is changed from a list of strings to a dictionary. Similarly, in QREF (PsiQ/qref#106) local_variables is changed to be a dictionary, as well.

However, the alias_sampling_basic.json has not been updated and trying to call qref_to_bartiq after loading the JSON results in:

pydantic_core._pydantic_core.ValidationError: 3 validation errors for SchemaV1
program.children.0.local_variables
  Input should be a valid dictionary [type=dict_type, input_value=['R=ceiling(log_2(L))'], input_type=list]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
program.children.2.local_variables
  Input should be a valid dictionary [type=dict_type, input_value=['R=ceiling(log_2(L))'], input_type=list]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type
program.local_variables
  Input should be a valid dictionary [type=dict_type, input_value=['R=ceiling(log_2(L))'], input_type=list]
    For further information visit https://errors.pydantic.dev/2.7/v/dict_type

How to Reproduce

This can be duplicated with the following code:

import json
from bartiq import Routine, compile_routine, evaluate
from bartiq.integrations import qref_to_bartiq

with open("docs/data/alias_sampling_basic.json", "r") as f:
    routine_dict = json.load(f)

uncompiled_routine = qref_to_bartiq(routine_dict)

Expected behavior

The provided sample json file should be in the appropriate format so that it can be changed into a routine properly.

Actual behavior

Calling qref_to_bartiq throws an error complaining that local_variables is not a dictionary.

Environment:

  • Bartiq 0.5.0
  • Python version 3.11.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions