Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug related to codegen for sample python functions #307

Merged
merged 32 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
be47097
add more tests
Jul 14, 2023
a87ab8a
Merge branch 'main' into khwu/enhance_testv4
Jul 14, 2023
a0c9d64
add more integration tests for codegen
Jul 14, 2023
0ca26b3
fix bug when ConstantCodeGen hit Negative wvfm node.
Jul 17, 2023
0e906a1
Merge branch 'main' into khwu/enhance_testv4
Jul 17, 2023
69d9ce1
tmp
Jul 17, 2023
6d0c109
fix bug when slice produce duplicate time points
Jul 17, 2023
a8fccb7
Merge branch 'khwu/enhance_testv4' into khwu/enhance_testv5
Jul 17, 2023
fea7e20
tmp
Jul 17, 2023
4a1627e
Merge branch 'main' into khwu/enhance_testv5
Jul 17, 2023
698e834
tmp
Jul 17, 2023
c92ef69
Merge branch 'main' into khwu/enhance_testv5
Jul 17, 2023
af7c0da
adding fix for Sample interpolation.
weinbe58 Jul 17, 2023
af59e4c
tmp
Jul 17, 2023
9bfe755
Merge branch 'phil/fix-sample-waveform-ast' into khwu/enhance_testv5
Jul 17, 2023
61bf678
add framework for pretty print testing and fix bugs #297
Jul 17, 2023
2c725e7
fix bug in print with children
Jul 17, 2023
dfc4fc8
remove [html] from .coveragerc and fix bugs in print testing
Jul 17, 2023
48c181e
finished assignment scan tests
Jul 17, 2023
bf58a4d
fix bug in codegen slice
Jul 18, 2023
72e0fdb
fix conflict
Jul 18, 2023
0348945
making `Append` give correct value for `eval_decimal(duration)`.
weinbe58 Jul 18, 2023
5e8d290
add more tests for batch_assign
Jul 18, 2023
c0c15ba
Merge branch '302-record-does-not-properly-record-the-current-value' …
Jul 18, 2023
cc36d42
add more testing cases
Jul 18, 2023
4fa82cd
Merge branch 'main' into khwu/enhance_testv6
Jul 18, 2023
0263bd1
add more tests and fix bugs related to fn() sampling
Jul 18, 2023
e967816
Merge branch 'main' into khwu/enhance_testv8
Jul 18, 2023
68db7b2
Merge branch 'main' into khwu/enhance_testv8
weinbe58 Jul 19, 2023
b01c23d
fixing `samples` of `Sample` + adding example of using codegen directly.
weinbe58 Jul 19, 2023
80013b8
fix bug in matching of namedpulese
Jul 20, 2023
f37bd8e
Merge branch 'main' into khwu/enhance_testv8
Roger-luo Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing samples of Sample + adding example of using codegen directly.
  • Loading branch information
weinbe58 committed Jul 19, 2023
commit b01c23d566681ef1f26cfcf29e05fc4783f39c37
10 changes: 6 additions & 4 deletions src/bloqade/ir/control/waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,11 @@ def eval_decimal(self, clock_s: Decimal, **kwargs) -> Decimal:
return Decimal(0)

return Decimal(
self.fn(
float(clock_s),
**{k: float(kwargs[k]) for k in self.parameters if k in kwargs},
str(
self.fn(
float(clock_s),
**{k: float(kwargs[k]) for k in self.parameters if k in kwargs},
)
)
)

Expand Down Expand Up @@ -684,7 +686,7 @@ def samples(self, **kwargs) -> Tuple[List[Decimal], List[Decimal]]:
clock = Decimal("0.0")
clocks = []
values = []
while clock < duration:
while clock <= duration - dt:
values.append(self.waveform.eval_decimal(clock, **kwargs))
clocks.append(clock)
clock += dt
Expand Down
22 changes: 22 additions & 0 deletions tests/test_hardware_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@
import numpy as np


"""
import bloqade.ir.location as location
from bloqade.codegen.hardware.quera import SchemaCodeGen
from bloqade.submission.base import get_capabilities

bloqade_program = (
location.Square(1)
.rydberg.rabi.phase.uniform.piecewise_constant(
durations=[0.5, 0.5], values=[0, 1]
)
.piecewise_constant(
durations=[0.3] ,values = [0.2]
).program
)

capabilities = get_capabilities()
schema = SchemaCodeGen({},capabilities=capabilities).emit(10, bloqade_program)

print(schema.effective_hamiltonian.rydberg.rabi_frequency_phase.global_.times)
"""
Comment on lines +9 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed or no?



def test_integration_jump_err():
## jump at the end of linear -- constant
with pytest.raises(ValueError):
Expand Down
Loading