Skip to content

Waveform

Recordable

record

record(name: str) -> Record

Copy or "record" the value at the end of the waveform into a variable so that it can be used in another place.

A common design pattern is to couple this with .slice() considering you may not know exactly what the end value of a .slice() is, especially in parameter sweeps where it becomes cumbersome to handle.

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

Usage Example:
# define program of interest
>>> from bloqade import start
>>> prog = start.rydberg.rabi.amplitude.uniform
>>> prog_with_wf = prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
values=[0.0, 2.0, 2.0, 0.0])
# We now slice the piecewise_linear from above and record the
# value at the end of that slice. We then use that value
# to construct a new waveform that can be appended to the previous
# one without introducing discontinuity (refer to the
# "Quantum Scar Dynamics" tutorial for how this could be handy)
>>> prog_with_record = prog_with_wf.slice(0.0, 1.0).record("end_of_wf")
>>> record_applied_prog = prog_with_record.linear(start="end_of_wf"
, stop=0.0, duration=0.3)
  • Your next steps include:
  • Continue building your waveform via:
    • ...slice(start, stop).linear(start, stop, duration): to append another linear waveform
    • ...slice(start, stop).constant(value, duration): to append a constant waveform
    • ...slice(start, stop).piecewise_linear(): to append a piecewise linear waveform
    • ...slice(start, stop).piecewise_constant(): to append a piecewise constant waveform
    • ...slice(start, stop).poly([coefficients], duration): to append a polynomial waveform
    • ...slice(start, stop).apply(wf:bloqade.ir.Waveform): to append a pre-defined waveform
    • ...slilce(start, stop).fn(f(t,...)): to append a waveform defined by a python function
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...slice(start, stop).uniform: To address all atoms in the field
    • ...slice(start, stop).location(int): To address an atom at a specific location via index
    • ...slice(start, stop).scale(str)
      • To address an atom at a specific location via variable
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...slice(start, stop).assign(variable_name = value): to assign a single value to a variable
    • ...slice(start, stop) .batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...slice(start, stop).args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...slice(start, stop).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...slice(start, stop).bloqade: to run on the Bloqade local emulator
    • ...slice(start, stop).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...slice(start, stop).parallelize(spacing)
  • Start targeting another level coupling
    • ...slice(start, stop).rydberg: to target the Rydberg level coupling
    • ...slice(start, stop).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...slice(start, stop).amplitude: to target the real-valued Rabi Amplitude field
    • ...slice(start, stop).phase: to target the real-valued Rabi Phase field
    • ...slice(start, stop).detuning: to target the Detuning field
    • ...slice(start, stop).rabi: to target the complex-valued Rabi field ```
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
@beartype
def record(self, name: str) -> "Record":
    """
    Copy or "record" the value at the end of the waveform into a variable
    so that it can be used in another place.

    A common design pattern is to couple this with `.slice()` considering
    you may not know exactly what the end value of a `.slice()` is,
    especially in parameter sweeps where it becomes cumbersome to handle.

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.

    ### Usage Example:
    ```
    # define program of interest
    >>> from bloqade import start
    >>> prog = start.rydberg.rabi.amplitude.uniform
    >>> prog_with_wf = prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
    values=[0.0, 2.0, 2.0, 0.0])
    # We now slice the piecewise_linear from above and record the
    # value at the end of that slice. We then use that value
    # to construct a new waveform that can be appended to the previous
    # one without introducing discontinuity (refer to the
    # "Quantum Scar Dynamics" tutorial for how this could be handy)
    >>> prog_with_record = prog_with_wf.slice(0.0, 1.0).record("end_of_wf")
    >>> record_applied_prog = prog_with_record.linear(start="end_of_wf"
    , stop=0.0, duration=0.3)
    ```

    - Your next steps include:
    - Continue building your waveform via:
        - `...slice(start, stop).linear(start, stop, duration)`:
            to append another linear waveform
        - `...slice(start, stop).constant(value, duration)`:
            to append a constant waveform
        - `...slice(start, stop).piecewise_linear()`:
            to append a piecewise linear waveform
        - `...slice(start, stop).piecewise_constant()`:
            to append a piecewise constant waveform
        - `...slice(start, stop).poly([coefficients], duration)`:
            to append a polynomial waveform
        - `...slice(start, stop).apply(wf:bloqade.ir.Waveform)`:
            to append a pre-defined waveform
        - `...slilce(start, stop).fn(f(t,...))`:
            to append a waveform defined by a python function
    - Begin constructing another drive by starting a new spatial modulation
        (this drive will be summed to the one you just created):
        - `...slice(start, stop).uniform`:
            To address all atoms in the field
        - `...slice(start, stop).location(int)`:
            To address an atom at a specific location via index
        - `...slice(start, stop).scale(str)`
            - To address an atom at a specific location via variable
            - To address multiple atoms at specific locations by specifying
                a single variable and then assigning it a list of coordinates
    - Assign values to pre-existing variables via:
        - `...slice(start, stop).assign(variable_name = value)`:
            to assign a single value to a variable
        - `...slice(start, stop)
            .batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...slice(start, stop).args(["previously_defined_var"])`:
            to defer assignment of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...slice(start, stop).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...slice(start, stop).bloqade`:
            to run on the Bloqade local emulator
        - `...slice(start, stop).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...slice(start, stop).parallelize(spacing)`
    - Start targeting another level coupling
        - `...slice(start, stop).rydberg`:
            to target the Rydberg level coupling
        - `...slice(start, stop).hyperfine`:
            to target the Hyperfine level coupling
    - Start targeting other fields within your current level coupling
      (previously selected as `rydberg` or `hyperfine`):
        - `...slice(start, stop).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...slice(start, stop).phase`:
            to target the real-valued Rabi Phase field
        - `...slice(start, stop).detuning`:
            to target the Detuning field
        - `...slice(start, stop).rabi`:
            to target the complex-valued Rabi field
    ```
    """
    return Record(name, self)

Sliceable

slice

slice(
    start: Optional[ScalarType] = None,
    stop: Optional[ScalarType] = None,
) -> Slice

Indicate that you only want a portion of your waveform to be used in the program.

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

Usage Example:
# define a program with a waveform of interest
>>> from bloqade import start
>>> prog = start.add_position((0,0)).rydberg.rabi.amplitude.uniform
>>> prog_with_wf = prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
values=[0.0, 2.0, 2.0, 0.0])
# instead of using the full waveform we opt to only take the first 1 us
>>> prog_with_slice = prog_with_wf.slice(0.0, 1.0)
# you may use variables as well
>>> prog_with_slice = prog_with_wf.slice("start", "end")
  • Your next steps include:
  • Continue building your waveform via:
    • ...slice(start, stop).linear(start, stop, duration): to append another linear waveform
    • ...slice(start, stop).constant(value, duration): to append a constant waveform
    • ...slice(start, stop).piecewise_linear(): to append a piecewise linear waveform
    • ...slice(start, stop).piecewise_constant(): to append a piecewise constant waveform
    • ...slice(start, stop).poly([coefficients], duration): to append a polynomial waveform
    • ...slice(start, stop).apply(wf:bloqade.ir.Waveform): to append a pre-defined waveform
    • ...slilce(start, stop).fn(f(t,...)): to append a waveform defined by a python function
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...slice(start, stop).uniform: To address all atoms in the field
    • ...slice(start, stop).location(int): To address an atom at a specific location via index
    • ...slice(start, stop).scale(...)
      • To address an atom at a specific location via variable
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...slice(start, stop).assign(variable_name = value): to assign a single value to a variable
    • ...slice(start, stop) .batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...slice(start, stop).args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...slice(start, stop).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...slice(start, stop).bloqade: to run on the Bloqade local emulator
    • ...slice(start, stop).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...slice(start, stop).parallelize(spacing)
  • Start targeting another level coupling
    • ...slice(start, stop).rydberg: to target the Rydberg level coupling
    • ...slice(start, stop).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...slice(start, stop).amplitude: to target the real-valued Rabi Amplitude field
    • ...slice(start, stop).phase: to target the real-valued Rabi Phase field
    • ...slice(start, stop).detuning: to target the Detuning field
    • ...slice(start, stop).rabi: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
@beartype
def slice(
    self,
    start: Optional[ScalarType] = None,
    stop: Optional[ScalarType] = None,
) -> "Slice":
    """
    Indicate that you only want a portion of your waveform to be used in
    the program.

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.


    ### Usage Example:
    ```
    # define a program with a waveform of interest
    >>> from bloqade import start
    >>> prog = start.add_position((0,0)).rydberg.rabi.amplitude.uniform
    >>> prog_with_wf = prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
    values=[0.0, 2.0, 2.0, 0.0])
    # instead of using the full waveform we opt to only take the first 1 us
    >>> prog_with_slice = prog_with_wf.slice(0.0, 1.0)
    # you may use variables as well
    >>> prog_with_slice = prog_with_wf.slice("start", "end")
    ```

    - Your next steps include:
    - Continue building your waveform via:
        - `...slice(start, stop).linear(start, stop, duration)`:
            to append another linear waveform
        - `...slice(start, stop).constant(value, duration)`:
            to append a constant waveform
        - `...slice(start, stop).piecewise_linear()`:
            to append a piecewise linear waveform
        - `...slice(start, stop).piecewise_constant()`:
            to append a piecewise constant waveform
        - `...slice(start, stop).poly([coefficients], duration)`:
            to append a polynomial waveform
        - `...slice(start, stop).apply(wf:bloqade.ir.Waveform)`:
            to append a pre-defined waveform
        - `...slilce(start, stop).fn(f(t,...))`:
            to append a waveform defined by a python function
    - Begin constructing another drive by starting a new spatial modulation
        (this drive will be summed to the one you just created):
        - `...slice(start, stop).uniform`:
            To address all atoms in the field
        - `...slice(start, stop).location(int)`:
            To address an atom at a specific location via index
        - `...slice(start, stop).scale(...)`
            - To address an atom at a specific location via variable
            - To address multiple atoms at specific locations by specifying
                a single variable and then assigning it a list of coordinates
    - Assign values to pre-existing variables via:
        - `...slice(start, stop).assign(variable_name = value)`:
            to assign a single value to a variable
        - `...slice(start, stop)
            .batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...slice(start, stop).args(["previously_defined_var"])`:
            to defer assignment of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...slice(start, stop).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...slice(start, stop).bloqade`:
            to run on the Bloqade local emulator
        - `...slice(start, stop).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...slice(start, stop).parallelize(spacing)`
    - Start targeting another level coupling
        - `...slice(start, stop).rydberg`:
            to target the Rydberg level coupling
        - `...slice(start, stop).hyperfine`:
            to target the Hyperfine level coupling
    - Start targeting other fields within your current level coupling
      (previously selected as `rydberg` or `hyperfine`):
        - `...slice(start, stop).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...slice(start, stop).phase`:
            to target the real-valued Rabi Phase field
        - `...slice(start, stop).detuning`:
            to target the Detuning field
        - `...slice(start, stop).rabi`:
            to target the complex-valued Rabi field
    """
    return Slice(start, stop, self)

WaveformAttachable

WaveformAttachable(parent: Optional[Builder] = None)

Bases: Builder

Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10
11
12
13
14
def __init__(
    self,
    parent: Optional["Builder"] = None,
) -> None:
    self.__parent__ = parent

apply

apply(wf: Waveform) -> Apply

Apply a [Waveform][bloqade.ir.control.Waveform] built previously to current location(s).

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# build our waveform independently of the main program
>>> from bloqade import piecewise_linear
>>> wf = piecewise_linear(durations=[0.3, 2.5, 0.3],
values=[0.0, 2.0, 2.0, 0.0])
>>> prog.apply(wf)
  • Your next steps include:
  • Continue building your waveform via:
    • ...apply(waveform).linear(start, stop, duration): to append another linear waveform
    • ...apply(waveform).constant(value, duration): to append a constant waveform
    • ...apply(waveform).piecewise_linear([durations], [values]): to append a piecewise linear waveform
    • ...apply(waveform).piecewise_constant([durations], [values]): to append a piecewise constant waveform
    • ...apply(waveform).poly([coefficients], duration): to append a polynomial waveform
    • ...apply(waveform).apply(waveform): to append a pre-defined waveform
    • ...apply(waveform).fn(f(t,...)): to append a waveform defined by a python function
  • Slice a portion of the waveform to be used:
    • ...apply(waveform).slice(start, stop, duration)
  • Save the ending value of your waveform to be reused elsewhere
    • ...apply(waveform).record("you_variable_here")
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...apply(waveform).uniform: To address all atoms in the field
    • ...apply(waveform).location(int): To address an atom at a specific location via index
    • ...apply(waveform).scale(...)
      • To address an atom at a specific location via variable
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...apply(waveform).assign(variable_name = value): to assign a single value to a variable
    • ...apply(waveform).batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...apply(waveform).args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...apply(waveform).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...apply(waveform).bloqade: to run on the Bloqade local emulator
    • ...apply(waveform).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...apply(waveform).parallelize(spacing)
  • Start targeting another level coupling
    • ...apply(waveform).rydberg: to target the Rydberg level coupling
    • ...apply(waveform).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...apply(waveform).amplitude: to target the real-valued Rabi Amplitude field
    • ...apply(waveform).phase: to target the real-valued Rabi Phase field
    • ...apply(waveform).detuning: to target the Detuning field
    • ...apply(waveform).rabi: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
@beartype
def apply(self, wf: ir.Waveform) -> "Apply":
    """
    Apply a [`Waveform`][bloqade.ir.control.Waveform] built previously to
    current location(s).

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.

    ### Usage Example:
    ```
    >>> prog = start.add_position((0,0)).rydberg.detuning.uniform
    # build our waveform independently of the main program
    >>> from bloqade import piecewise_linear
    >>> wf = piecewise_linear(durations=[0.3, 2.5, 0.3],
    values=[0.0, 2.0, 2.0, 0.0])
    >>> prog.apply(wf)
    ```

    - Your next steps include:
    - Continue building your waveform via:
        - `...apply(waveform).linear(start, stop, duration)`:
            to append another linear waveform
        - `...apply(waveform).constant(value, duration)`:
            to append a constant waveform
        - `...apply(waveform).piecewise_linear([durations], [values])`:
            to append a piecewise linear waveform
        - `...apply(waveform).piecewise_constant([durations], [values])`:
            to append a piecewise constant waveform
        - `...apply(waveform).poly([coefficients], duration)`:
            to append a polynomial waveform
        - `...apply(waveform).apply(waveform)`:
            to append a pre-defined waveform
        - `...apply(waveform).fn(f(t,...))`:
            to append a waveform defined by a python function
    - Slice a portion of the waveform to be used:
        - `...apply(waveform).slice(start, stop, duration)`
    - Save the ending value of your waveform to be reused elsewhere
        - `...apply(waveform).record("you_variable_here")`
    - Begin constructing another drive by starting a new spatial modulation
      (this drive will be summed to the one you just created):
        - `...apply(waveform).uniform`: To address all atoms in the field
        - `...apply(waveform).location(int)`:
            To address an atom at a specific location via index
        - `...apply(waveform).scale(...)`
            - To address an atom at a specific location via variable
            - To address multiple atoms at specific locations by specifying a
                single variable and then assigning it a list of coordinates
    - Assign values to pre-existing variables via:
        - `...apply(waveform).assign(variable_name = value)`:
            to assign a single value to a variable
        - `...apply(waveform).batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...apply(waveform).args(["previously_defined_var"])`:
            to defer assignment of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...apply(waveform).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...apply(waveform).bloqade`:
            to run on the Bloqade local emulator
        - `...apply(waveform).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...apply(waveform).parallelize(spacing)`
    - Start targeting another level coupling
        - `...apply(waveform).rydberg`: to target the Rydberg level coupling
        - `...apply(waveform).hyperfine`: to target the Hyperfine level coupling
    - Start targeting other fields within your current level coupling
      (previously selected as `rydberg` or `hyperfine`):
        - `...apply(waveform).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...apply(waveform).phase`:
            to target the real-valued Rabi Phase field
        - `...apply(waveform).detuning`:
            to target the Detuning field
        - `...apply(waveform).rabi`:
            to target the complex-valued Rabi field
    """
    return Apply(wf, self)

constant

constant(
    value: ScalarType, duration: ScalarType
) -> Constant

Append or assign a constant waveform to the current location(s).

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# apply a constant waveform of 1.9 radians/us for 0.5 us
>>> prog.constant(value=1.9,duration=0.5)
  • Your next steps include:
  • Continue building your waveform via:
    • ...constant(value, duration).linear(start, stop, duration): to append another linear waveform
    • ...constant(value, duration).constant(value, duration): to append a constant waveform
    • ...constant(value, duration) .piecewise_linear([durations], [values]): to append a piecewise linear waveform
    • ...constant(value, duration) .piecewise_constant([durations], [values]): to append a piecewise constant waveform
    • ...constant(value, duration).poly([coefficients], duration): to append a polynomial waveform
    • ...constant(value, duration).apply(wf:bloqade.ir.Waveform): to append a pre-defined waveform
    • ...constant(value, duration).fn(f(t,...)): to append a waveform defined by a python function
  • Slice a portion of the waveform to be used:
    • ...constant(value, duration).slice(start, stop, duration)
  • Save the ending value of your waveform to be reused elsewhere
    • ...constant(value, duration).record("you_variable_here")
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...constant(value, duration).uniform: To address all atoms in the field
    • ...constant(value, duration).scale(...): To address an atom at a specific location via index
    • ...constant(value, duration).location(int)
      • To address an atom at a specific location via variable
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...constant(value, duration).assign(variable_name = value): to assign a single value to a variable
    • ...constant(value, duration) .batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...constant(value, duration).args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...constant(value, duration).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...constant(value, duration).bloqade: to run on the Bloqade local emulator
    • ...constant(value, duration).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...constant(start, stop, duration).parallelize(spacing)
  • Start targeting another level coupling
    • ...constant(value, duration).rydberg: to target the Rydberg level coupling
    • ...constant(value, duration).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...constant(value, duration).amplitude: to target the real-valued Rabi Amplitude field
    • ...constant(value, duration).phase: to target the real-valued Rabi Phase field
    • ...constant(value, duration).detuning: to target the Detuning field
    • ...constant(value, duration).rabi: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
@beartype
def constant(self, value: ScalarType, duration: ScalarType) -> "Constant":
    """
    Append or assign a constant waveform to the current location(s).

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.

    ### Usage Example:
    ```
    >>> prog = start.add_position((0,0)).rydberg.detuning.uniform
    # apply a constant waveform of 1.9 radians/us for 0.5 us
    >>> prog.constant(value=1.9,duration=0.5)
    ```

    - Your next steps include:
    - Continue building your waveform via:
        - `...constant(value, duration).linear(start, stop, duration)`:
            to append another linear waveform
        - `...constant(value, duration).constant(value, duration)`:
            to append a constant waveform
        - `...constant(value, duration)
            .piecewise_linear([durations], [values])`:
            to append a piecewise linear waveform
        - `...constant(value, duration)
            .piecewise_constant([durations], [values])`:
            to append a piecewise constant waveform
        - `...constant(value, duration).poly([coefficients], duration)`:
            to append a polynomial waveform
        - `...constant(value, duration).apply(wf:bloqade.ir.Waveform)`:
            to append a pre-defined waveform
        - `...constant(value, duration).fn(f(t,...))`:
            to append a waveform defined by a python function
    - Slice a portion of the waveform to be used:
        - `...constant(value, duration).slice(start, stop, duration)`
    - Save the ending value of your waveform to be reused elsewhere
        - `...constant(value, duration).record("you_variable_here")`
    - Begin constructing another drive by starting a new spatial modulation
        (this drive will be summed to the one you just created):
        - `...constant(value, duration).uniform`:
            To address all atoms in the field
        - `...constant(value, duration).scale(...)`:
            To address an atom at a specific location via index
        - `...constant(value, duration).location(int)`
            - To address an atom at a specific location via variable
            - To address multiple atoms at specific locations by specifying
                a single variable and then assigning it a list of coordinates
    - Assign values to pre-existing variables via:
        - `...constant(value, duration).assign(variable_name = value)`:
            to assign a single value to a variable
        - `...constant(value, duration)
            .batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...constant(value, duration).args(["previously_defined_var"])`:
            to defer assignment of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...constant(value, duration).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...constant(value, duration).bloqade`:
            to run on the Bloqade local emulator
        - `...constant(value, duration).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...constant(start, stop, duration).parallelize(spacing)`
    - Start targeting another level coupling
        - `...constant(value, duration).rydberg`:
            to target the Rydberg level coupling
        - `...constant(value, duration).hyperfine`:
            to target the Hyperfine level coupling
    - Start targeting other fields within your current
      level coupling (previously selected as `rydberg` or `hyperfine`):
        - `...constant(value, duration).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...constant(value, duration).phase`:
            to target the real-valued Rabi Phase field
        - `...constant(value, duration).detuning`:
            to target the Detuning field
        - `...constant(value, duration).rabi`:
            to target the complex-valued Rabi field

    """
    return Constant(value, duration, self)

fn

fn(fn: Callable, duration: ScalarType) -> Fn

Append or assign a custom function as a waveform.

The function must have its first argument be that of time but can also have other arguments which are treated as variables. You can assign values to later in the program via .assign or .batch_assign.

The function must also return a singular float value.

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

### Usage Examples:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# define our custom waveform. It must have one argument
# be time followed by any other number of arguments that can
# be assigned a value later in the program via `.assign` or `.batch_assign`
>>> def custom_waveform_function(t, arg1, arg2):
        return arg1*t + arg2
>>> prog = prog.fn(custom_waveform_function, duration = 0.5)
# assign values
>>> assigned_vars_prog = prog.assign(arg1 = 1.0, arg2 = 2.0)
# or go for batching!
>>> assigned_vars_batch_prog = prog.assign(arg1 = 1.0, arg2 = [1.0, 2.0, 3.0])
  • Your next steps include:
  • Continue building your waveform via:
    • ...fn(f(t,...)) .linear(start, stop, duration): to append another linear waveform
    • ...fn(f(t,...)) .constant(value, duration): to append a constant waveform
    • ...fn(f(t,...)) .piecewise_linear(durations, values): to append a piecewise linear waveform
    • ...fn(f(t,...)) .piecewise_constant(durations, values): to append a piecewise constant waveform
    • ...fn(f(t,...)) .poly([coefficients], duration): to append a polynomial waveform
    • ...fn(f(t,...)) .apply(waveform): to append a pre-defined waveform
    • ...fn(f(t,...)) .fn(f(t,...)): to append a waveform defined by a python function
  • Slice a portion of the waveform to be used:
    • ...fn(f(t,...)).slice(start, stop, duration)
  • Save the ending value of your waveform to be reused elsewhere
    • ...fn(f(t,...)).record("you_variable_here")
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...fn(f(t,...)).uniform: To address all atoms in the field
    • ...fn(f(t,...)).scale(...): To address an atom at a specific location via index
    • ...fn(f(t,...)).location(int)`
      • To address an atom at a specific location via variable
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...fn(f(t,...)) .assign(variable_name = value): to assign a single value to a variable
    • ...fn(f(t,...)) .batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...fn(f(t,...)) .args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...fn(f(t,...)).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...fn(f(t,...)).bloqade: to run on the Bloqade local emulator
    • ...fn(f(t,...)).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...fn(f(t,...)).parallelize(spacing)
  • Start targeting another level coupling
    • ...fn(f(t,...)).rydberg: to target the Rydberg level coupling
    • ...fn(f(t,...)).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...fn(f(t,...)).amplitude: to target the real-valued Rabi Amplitude field
    • ...fn(f(t,...)).phase: to target the real-valued Rabi Phase field
    • ...fn(f(t,...)).detuning: to target the Detuning field
    • ...fn(f(t,...)).rabi: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
@beartype
def fn(self, fn: Callable, duration: ScalarType) -> "Fn":
    """
    Append or assign a custom function as a waveform.

    The function must have its first argument be that of time but
    can also have other arguments which are treated as variables.
    You can assign values to later in the program via `.assign` or `.batch_assign`.

    The function must also return a singular float value.

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.

    ### ### Usage Examples:
    ```
    >>> prog = start.add_position((0,0)).rydberg.detuning.uniform
    # define our custom waveform. It must have one argument
    # be time followed by any other number of arguments that can
    # be assigned a value later in the program via `.assign` or `.batch_assign`
    >>> def custom_waveform_function(t, arg1, arg2):
            return arg1*t + arg2
    >>> prog = prog.fn(custom_waveform_function, duration = 0.5)
    # assign values
    >>> assigned_vars_prog = prog.assign(arg1 = 1.0, arg2 = 2.0)
    # or go for batching!
    >>> assigned_vars_batch_prog = prog.assign(arg1 = 1.0, arg2 = [1.0, 2.0, 3.0])
    ```

    - Your next steps include:
    - Continue building your waveform via:
        - `...fn(f(t,...))
            .linear(start, stop, duration)`: to append another linear waveform
        - `...fn(f(t,...))
            .constant(value, duration)`: to append a constant waveform
        - `...fn(f(t,...))
            .piecewise_linear(durations, values)`:
            to append a piecewise linear waveform
        - `...fn(f(t,...))
            .piecewise_constant(durations, values)`:
            to append a piecewise constant waveform
        - `...fn(f(t,...))
            .poly([coefficients], duration)`: to append a polynomial waveform
        - `...fn(f(t,...))
            .apply(waveform)`: to append a pre-defined waveform
        - `...fn(f(t,...))
            .fn(f(t,...))`: to append a waveform defined by a python function
    - Slice a portion of the waveform to be used:
        - `...fn(f(t,...)).slice(start, stop, duration)`
    - Save the ending value of your waveform to be reused elsewhere
        - `...fn(f(t,...)).record("you_variable_here")`
    - Begin constructing another drive by starting a new spatial modulation
      (this drive will be summed to the one you just created):
        - `...fn(f(t,...)).uniform`:
            To address all atoms in the field
        - `...fn(f(t,...)).scale(...)`:
            To address an atom at a specific location via index
        - ...fn(f(t,...)).location(int)`
            - To address an atom at a specific location via variable
            - To address multiple atoms at specific locations by
                specifying a single variable and then assigning it a
                list of coordinates
    - Assign values to pre-existing variables via:
        - `...fn(f(t,...))
            .assign(variable_name = value)`: to assign a single value to a variable
        - `...fn(f(t,...))
            .batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...fn(f(t,...))
            .args(["previously_defined_var"])`:
            to defer assignment of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...fn(f(t,...)).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...fn(f(t,...)).bloqade`:
            to run on the Bloqade local emulator
        - `...fn(f(t,...)).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...fn(f(t,...)).parallelize(spacing)`
    - Start targeting another level coupling
        - `...fn(f(t,...)).rydberg`:
            to target the Rydberg level coupling
        - `...fn(f(t,...)).hyperfine`:
            to target the Hyperfine level coupling
    - Start targeting other fields within your current level coupling
      (previously selected as `rydberg` or `hyperfine`):
        - `...fn(f(t,...)).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...fn(f(t,...)).phase`:
            to target the real-valued Rabi Phase field
        - `...fn(f(t,...)).detuning`:
            to target the Detuning field
        - `...fn(f(t,...)).rabi`:
            to target the complex-valued Rabi field

    """
    return Fn(fn, duration, self)

linear

linear(
    start: ScalarType,
    stop: ScalarType,
    duration: ScalarType,
) -> Linear

Append or assign a linear waveform to the current location(s).

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# apply a linear waveform that goes from 0 to 1 radians/us in 0.5 us
>>> prog.linear(start=0,stop=1,duration=0.5)
  • Your next steps include:
  • Continue building your waveform via:
    • ...linear(start, stop, duration).linear(start, stop, duration): to append another linear waveform
    • ...linear(start, stop, duration).constant(value, duration): to append a constant waveform
    • ...linear(start, stop, duration) .piecewise_linear([durations], [values]): to append a piecewise linear waveform
    • ...linear(start, stop, duration) .piecewise_constant([durations], [values]): to append a piecewise constant waveform
    • ...linear(start, stop, duration).poly([coefficients], duration): to append a polynomial waveform
    • ...linear(start, stop, duration).apply(wf:bloqade.ir.Waveform): to append a pre-defined waveform
    • ...linear(start, stop, duration).fn(f(t,...)): to append a waveform defined by a python function
  • Slice a portion of the waveform to be used:
    • ...linear(start, stop, duration).slice(start, stop, duration)
  • Save the ending value of your waveform to be reused elsewhere
    • ...linear(start, stop, duration).record("you_variable_here")
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...linear(start, stop, duration).uniform: To address all atoms in the field
    • ...linear(start, stop, duration).location(int): To address atoms at specific location with scaling
    • ...linear(start, stop, duration).scale(...)
      • To address atoms at specific location with scaling
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...linear(start, stop, duration).assign(variable_name = value): to assign a single value to a variable
    • ...linear(start, stop, duration) .batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...linear(start, stop, duration).args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...linear(start, stop, duration).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...linear(start, stop, duration).bloqade: to run on the Bloqade local emulator
    • ...linear(start, stop, duration).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...linear(start, stop, duration).parallelize(spacing)
  • Start targeting another level coupling
    • ...linear(start, stop, duration).rydberg: to target the Rydberg level coupling
    • ...linear(start, stop, duration).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...linear(start, stop, duration).amplitude: to target the real-valued Rabi Amplitude field
    • ...linear(start, stop, duration).phase: to target the real-valued Rabi Phase field
    • ...linear(start, stop, duration).detuning: to target the Detuning field
    • ...linear(start, stop, duration).rabi: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
@beartype
def linear(
    self, start: ScalarType, stop: ScalarType, duration: ScalarType
) -> "Linear":
    """

    Append or assign a linear waveform to the current location(s).

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.

    ### Usage Example:
    ```
    >>> prog = start.add_position((0,0)).rydberg.detuning.uniform
    # apply a linear waveform that goes from 0 to 1 radians/us in 0.5 us
    >>> prog.linear(start=0,stop=1,duration=0.5)
    ```

    - Your next steps include:
    - Continue building your waveform via:
        - `...linear(start, stop, duration).linear(start, stop, duration)`:
            to append another linear waveform
        - `...linear(start, stop, duration).constant(value, duration)`:
            to append a constant waveform
        - `...linear(start, stop, duration)
            .piecewise_linear([durations], [values])`:
            to append a piecewise linear waveform
        - `...linear(start, stop, duration)
            .piecewise_constant([durations], [values])`:
            to append a piecewise constant waveform
        - `...linear(start, stop, duration).poly([coefficients], duration)`:
            to append a polynomial waveform
        - `...linear(start, stop, duration).apply(wf:bloqade.ir.Waveform)`:
            to append a pre-defined waveform
        - `...linear(start, stop, duration).fn(f(t,...))`:
            to append a waveform defined by a python function
    - Slice a portion of the waveform to be used:
        - `...linear(start, stop, duration).slice(start, stop, duration)`
    - Save the ending value of your waveform to be reused elsewhere
        - `...linear(start, stop, duration).record("you_variable_here")`
    - Begin constructing another drive by starting a new spatial modulation
        (this drive will be summed to the one you just created):
        - `...linear(start, stop, duration).uniform`:
            To address all atoms in the field
        - `...linear(start, stop, duration).location(int)`:
            To address atoms at specific location with scaling
        - `...linear(start, stop, duration).scale(...)`
            - To address atoms at specific location with scaling
            - To address multiple atoms at specific locations by specifying
                a single variable and then assigning it a list of coordinates
    - Assign values to pre-existing variables via:
        - `...linear(start, stop, duration).assign(variable_name = value)`:
            to assign a single value to a variable
        - `...linear(start, stop, duration)
            .batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...linear(start, stop, duration).args(["previously_defined_var"])`:
            to defer assignment of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...linear(start, stop, duration).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...linear(start, stop, duration).bloqade`:
            to run on the Bloqade local emulator
        - `...linear(start, stop, duration).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...linear(start, stop, duration).parallelize(spacing)`
    - Start targeting another level coupling
        - `...linear(start, stop, duration).rydberg`:
            to target the Rydberg level coupling
        - `...linear(start, stop, duration).hyperfine`:
            to target the Hyperfine level coupling
    - Start targeting other fields within your current level coupling
      (previously selected as `rydberg` or `hyperfine`):
        - `...linear(start, stop, duration).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...linear(start, stop, duration).phase`:
            to target the real-valued Rabi Phase field
        - `...linear(start, stop, duration).detuning`:
            to target the Detuning field
        - `...linear(start, stop, duration).rabi`:
            to target the complex-valued Rabi field
    """

    return Linear(start, stop, duration, self)

piecewise_constant

piecewise_constant(
    durations: List[ScalarType], values: List[ScalarType]
) -> PiecewiseConstant

Append or assign a piecewise constant waveform to current location(s).

The durations argument should have number of elements = len(values). durations should be the duration PER section of the waveform, NON-CUMULATIVE.

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

Usage Example:
>>> prog = start.add_position((0,0)).rydberg.rabi.phase.uniform
# create a staircase, we hold 0.0 rad/us for 1.0 us, then
# to 1.0 rad/us for 0.5 us before stopping at 0.8 rad/us for 0.9 us.
>>> prog.piecewise_linear(durations=[0.3, 2.0, 0.3], values=[1.0, 0.5, 0.9])
  • Your next steps including:
  • Continue building your waveform via:
    • ...piecewise_constant([durations], [values]) .linear(start, stop, duration): to append another linear waveform
    • ...piecewise_constant([durations], [values]) .constant(value, duration): to append a constant waveform
    • ...piecewise_constant([durations], [values]) .piecewise_linear([durations], [values]): to append a piecewise linear waveform
    • ...piecewise_constant([durations], [values]) .piecewise_constant([durations], [values]): to append a piecewise constant waveform
    • ...piecewise_constant([durations], [values]) .poly([coefficients], duration): to append a polynomial waveform
    • ...piecewise_constant([durations], [values]) .apply(waveform): to append a pre-defined waveform
    • ...piecewise_constant([durations], [values]).fn(f(t,...)): to append a waveform defined by a python function
  • Slice a portion of the waveform to be used:
    • ...piecewise_constant([durations], [values]) .slice(start, stop, duration)
  • Save the ending value of your waveform to be reused elsewhere
    • ...piecewise_constant([durations], [values]) .record("you_variable_here")
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...piecewise_constant([durations], [values]).uniform: To address all atoms in the field
    • ...piecewise_constant([durations], [values]).location(int): To address an atom at a specific location via index
    • ...piecewise_constant([durations], [values]).scale(...)
      • To address an atom at a specific location via variable
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...piecewise_constant([durations], [values]) .assign(variable_name = value): to assign a single value to a variable
    • ...piecewise_constant([durations], [values]) .batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...piecewise_constant([durations], [values]) .args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...piecewise_constant([durations], [values]).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...piecewise_constant([durations], [values]).bloqade: to run on the Bloqade local emulator
    • ...piecewise_constant([durations], [values]).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...piecewise_constat([durations], [values]).parallelize(spacing)
  • Start targeting another level coupling
    • ...piecewise_constant([durations], [values]).rydberg: to target the Rydberg level coupling
    • ...piecewise_constant([durations], [values]).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...piecewise_constant(durations, values).amplitude: to target the real-valued Rabi Amplitude field
    • ...piecewise_constant([durations], [values]).phase: to target the real-valued Rabi Phase field
    • ...piecewise_constant([durations], [values]).detuning: to target the Detuning field
    • ...piecewise_constant([durations], [values]).rabi: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
@beartype
def piecewise_constant(
    self, durations: List[ScalarType], values: List[ScalarType]
) -> "PiecewiseConstant":
    """
    Append or assign a piecewise constant waveform to current location(s).

    The `durations` argument should have number of elements = len(values).
    `durations` should be the duration PER section of the waveform,
    NON-CUMULATIVE.

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.

    ### Usage Example:
    ```
    >>> prog = start.add_position((0,0)).rydberg.rabi.phase.uniform
    # create a staircase, we hold 0.0 rad/us for 1.0 us, then
    # to 1.0 rad/us for 0.5 us before stopping at 0.8 rad/us for 0.9 us.
    >>> prog.piecewise_linear(durations=[0.3, 2.0, 0.3], values=[1.0, 0.5, 0.9])
    ```

    - Your next steps including:
    - Continue building your waveform via:
        - `...piecewise_constant([durations], [values])
            .linear(start, stop, duration)`: to append another linear waveform
        - `...piecewise_constant([durations], [values])
            .constant(value, duration)`: to append a constant waveform
        - `...piecewise_constant([durations], [values])
            .piecewise_linear([durations], [values])`:
            to append a piecewise linear waveform
        - `...piecewise_constant([durations], [values])
            .piecewise_constant([durations], [values])`:
            to append a piecewise constant waveform
        - `...piecewise_constant([durations], [values])
            .poly([coefficients], duration)`: to append a polynomial waveform
        - `...piecewise_constant([durations], [values])
            .apply(waveform)`: to append a pre-defined waveform
        - `...piecewise_constant([durations], [values]).fn(f(t,...))`:
            to append a waveform defined by a python function
    - Slice a portion of the waveform to be used:
        - `...piecewise_constant([durations], [values])
            .slice(start, stop, duration)`
    - Save the ending value of your waveform to be reused elsewhere
        - `...piecewise_constant([durations], [values])
            .record("you_variable_here")`
    - Begin constructing another drive by starting a new spatial modulation
      (this drive will be summed to the one you just created):
        - `...piecewise_constant([durations], [values]).uniform`:
            To address all atoms in the field
        - `...piecewise_constant([durations], [values]).location(int)`:
            To address an atom at a specific location via index
        - `...piecewise_constant([durations], [values]).scale(...)`
            - To address an atom at a specific location via variable
            - To address multiple atoms at specific locations by
                specifying a single variable and then assigning it a
                list of coordinates
    - Assign values to pre-existing variables via:
        - `...piecewise_constant([durations], [values])
            .assign(variable_name = value)`: to assign a single value to a variable
        - `...piecewise_constant([durations], [values])
            .batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...piecewise_constant([durations], [values])
            .args(["previously_defined_var"])`: to defer assignment
            of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...piecewise_constant([durations], [values]).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...piecewise_constant([durations], [values]).bloqade`:
            to run on the Bloqade local emulator
        - `...piecewise_constant([durations], [values]).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...piecewise_constat([durations], [values]).parallelize(spacing)`
    - Start targeting another level coupling
        - `...piecewise_constant([durations], [values]).rydberg`:
            to target the Rydberg level coupling
        - `...piecewise_constant([durations], [values]).hyperfine`:
            to target the Hyperfine level coupling
    - Start targeting other fields within your current level coupling
      (previously selected as `rydberg` or `hyperfine`):
        - `...piecewise_constant(durations, values).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...piecewise_constant([durations], [values]).phase`:
            to target the real-valued Rabi Phase field
        - `...piecewise_constant([durations], [values]).detuning`:
            to target the Detuning field
        - `...piecewise_constant([durations], [values]).rabi`:
            to target the complex-valued Rabi field
    """
    return PiecewiseConstant(durations, values, self)

piecewise_linear

piecewise_linear(
    durations: List[ScalarType], values: List[ScalarType]
) -> PiecewiseLinear

Append or assign a piecewise linear waveform to current location(s), where the waveform is formed by connecting values[i], values[i+1] with linear segments.

The durations argument should have # of elements = len(values) - 1. durations should be the duration PER section of the waveform, NON-CUMULATIVE.

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# ramp our waveform up to a certain value, hold it
# then ramp down. In this case, we ramp up to 2.0 rad/us in 0.3 us,
# then hold it for 1.5 us before ramping down in 0.3 us back to 0.0 rad/us.
>>> prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
values=[0.0, 2.0, 2.0, 0.0])
  • Your next steps include:
  • Continue building your waveform via:
    • ...piecewise_linear([durations], [values]) .linear(start, stop, duration): to append another linear waveform
    • ...piecewise_linear([durations], [values]).constant(value, duration): to append a constant waveform
    • ...piecewise_linear([durations], [values]) .piecewise_linear(durations, values): to append a piecewise linear waveform
    • ...piecewise_linear([durations], [values]) .piecewise_constant([durations], [values]): to append a piecewise constant waveform
    • ...piecewise_linear([durations], [values]) .poly([coefficients], duration): to append a polynomial waveform
    • ...piecewise_linear([durations], [values]).apply(waveform): to append a pre-defined waveform
    • ...piecewise_linear([durations], [values]).fn(f(t,...)): to append a waveform defined by a python function
  • Slice a portion of the waveform to be used:
    • ...piecewise_linear([durations], [values]) .slice(start, stop, duration)
  • Save the ending value of your waveform to be reused elsewhere
    • ...piecewise_linear([durations], [values]) .record("you_variable_here")
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...piecewise_linear([durations], [values]).uniform: To address all atoms in the field
    • ...piecewise_linear([durations], [values]).scale(...): To address an atom at a specific location via index
    • ...piecewise_linear([durations], [values]).location(int)
      • To address an atom at a specific location via variable
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...piecewise_linear([durations], [values]) .assign(variable_name = value): to assign a single value to a variable
    • ...piecewise_linear([durations], [values]) .batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...piecewise_linear([durations], [values]) .args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...piecewise_linear([durations], [values]).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...piecewise_linear([durations], [values]).bloqade: to run on the Bloqade local emulator
    • ...piecewise_linear([durations], [values]).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...piecewise_linear([durations], [values]).parallelize(spacing)
  • Start targeting another level coupling
    • ...piecewise_linear([durations], [values]).rydberg: to target the Rydberg level coupling
    • ...piecewise_linear([durations], [values]).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...piecewise_linear([durations], [values]).amplitude: to target the real-valued Rabi Amplitude field
    • ...piecewise_linear([durations], [values]).phase: to target the real-valued Rabi Phase field
    • ...piecewise_linear([durations], [values]).detuning: to target the Detuning field
    • ....rabi: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
@beartype
def piecewise_linear(
    self, durations: List[ScalarType], values: List[ScalarType]
) -> "PiecewiseLinear":
    """
    Append or assign a piecewise linear waveform to current location(s),
    where the waveform is formed by connecting `values[i], values[i+1]`
    with linear segments.

    The `durations` argument should have # of elements = len(values) - 1.
    `durations` should be the duration PER section of the waveform, NON-CUMULATIVE.

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.

    ### Usage Example:
    ```
    >>> prog = start.add_position((0,0)).rydberg.detuning.uniform
    # ramp our waveform up to a certain value, hold it
    # then ramp down. In this case, we ramp up to 2.0 rad/us in 0.3 us,
    # then hold it for 1.5 us before ramping down in 0.3 us back to 0.0 rad/us.
    >>> prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
    values=[0.0, 2.0, 2.0, 0.0])
    ```

    - Your next steps include:
    - Continue building your waveform via:
        - `...piecewise_linear([durations], [values])
            .linear(start, stop, duration)`:
            to append another linear waveform
        - `...piecewise_linear([durations], [values]).constant(value, duration)`:
            to append a constant waveform
        - `...piecewise_linear([durations], [values])
            .piecewise_linear(durations, values)`:
            to append a piecewise linear waveform
        - `...piecewise_linear([durations], [values])
            .piecewise_constant([durations], [values])`:
            to append a piecewise constant waveform
        - `...piecewise_linear([durations], [values])
            .poly([coefficients], duration)`: to append a polynomial waveform
        - `...piecewise_linear([durations], [values]).apply(waveform)`:
            to append a pre-defined waveform
        - `...piecewise_linear([durations], [values]).fn(f(t,...))`:
            to append a waveform defined by a python function
    - Slice a portion of the waveform to be used:
        - `...piecewise_linear([durations], [values])
            .slice(start, stop, duration)`
    - Save the ending value of your waveform to be reused elsewhere
        - `...piecewise_linear([durations], [values])
            .record("you_variable_here")`
    - Begin constructing another drive by starting a new spatial modulation
      (this drive will be summed to the one you just created):
        - `...piecewise_linear([durations], [values]).uniform`:
            To address all atoms in the field
        - `...piecewise_linear([durations], [values]).scale(...)`:
            To address an atom at a specific location via index
        - `...piecewise_linear([durations], [values]).location(int)`
            - To address an atom at a specific location via variable
            - To address multiple atoms at specific locations by
                specifying a single variable and then assigning it a
                list of coordinates
    - Assign values to pre-existing variables via:
        - `...piecewise_linear([durations], [values])
            .assign(variable_name = value)`:
            to assign a single value to a variable
        - `...piecewise_linear([durations], [values])
            .batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...piecewise_linear([durations], [values])
            .args(["previously_defined_var"])`:
            to defer assignment of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...piecewise_linear([durations], [values]).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...piecewise_linear([durations], [values]).bloqade`:
            to run on the Bloqade local emulator
        - `...piecewise_linear([durations], [values]).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...piecewise_linear([durations], [values]).parallelize(spacing)`
    - Start targeting another level coupling
        - `...piecewise_linear([durations], [values]).rydberg`:
            to target the Rydberg level coupling
        - `...piecewise_linear([durations], [values]).hyperfine`:
            to target the Hyperfine level coupling
    - Start targeting other fields within your current level coupling
      (previously selected as `rydberg` or `hyperfine`):
        - `...piecewise_linear([durations], [values]).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...piecewise_linear([durations], [values]).phase`:
            to target the real-valued Rabi Phase field
        - `...piecewise_linear([durations], [values]).detuning`:
            to target the Detuning field
        - `....rabi`: to target the complex-valued Rabi field
    """
    return PiecewiseLinear(durations, values, self)

poly

poly(
    coeffs: List[ScalarType], duration: ScalarType
) -> Poly

Append or assign a waveform with a polynomial profile to current location(s).

You pass in a list of coefficients and a duration to this method which obeys the following expression:

wv(t) = coeffs[0] + coeffs[1]*t + coeffs[2]*t^2 + ... + coeffs[n]*t^n

If you specified a spatial modulation (e.g. uniform, location,scale) previously without a waveform you will now have completed the construction of a "drive", one or a sum of drives creating a "field" (e.g. Real-valued Rabi Amplitude/Phase).

If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.

Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
>>> coeffs = [-1, 0.5, 1.2]
# resulting polynomial is:
# f(t) = -1 + 0.5*t + 1.2*t^2 with duration of
# 0.5 us
>>> prog.poly(coeffs, duration=0.5)
  • Your next steps include:
  • Continue building your waveform via:
    • ...poly([coeffs], duration).linear(start, stop, duration): to append another linear waveform
    • ...poly([coeffs], duration).constant(value, duration): to append a constant waveform
    • ...poly([coeffs], duration) .piecewise_linear([durations], [values]): to append a piecewise linear waveform
    • ...poly([coeffs], duration) .piecewise_constant([durations],[values]): to append a piecewise constant waveform
    • ...poly([coeffs], duration).poly([coefficients], duration): to append a polynomial waveform
    • ...poly([coeffs], duration).apply(waveform): to append a pre-defined waveform
    • ...poly([coeffs], duration).fn(f(t,...)): to append a waveform defined by a python function
  • Slice a portion of the waveform to be used:
    • ...poly([coeffs], duration).slice(start, stop, duration)
  • Save the ending value of your waveform to be reused elsewhere
    • ...poly([coeffs], duration).record("you_variable_here")
  • Begin constructing another drive by starting a new spatial modulation (this drive will be summed to the one you just created):
    • ...poly([coeffs], duration).uniform: To address all atoms in the field
    • ...poly([coeffs], duration).location(int): To address an atom at a specific location via index
    • ...poly([coeffs], duration).scale(...)
      • To address an atom at a specific location via variable
      • To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
  • Assign values to pre-existing variables via:
    • ...poly([coeffs], duration).assign(variable_name = value): to assign a single value to a variable
    • ...poly([coeffs], duration) .batch_assign(variable_name = [value1, ...]): to assign multiple values to a variable
    • ...poly([coeffs], duration).args(["previously_defined_var"]): to defer assignment of a variable to execution time
  • Select the backend you want your program to run on via:
    • ...poly([coeffs], duration).braket: to run on Braket local emulator or QuEra hardware remotely
    • ...poly([coeffs], duration).bloqade: to run on the Bloqade local emulator
    • ...poly([coeffs], duration).device: to specify the backend via string
  • Choose to parallelize your atom geometry, duplicating it to fill the whole space:
    • ...poly([coeffs], duration).parallelize(spacing)
  • Start targeting another level coupling
    • ...poly([coeffs], duration).rydberg: to target the Rydberg level coupling
    • ...poly([coeffs], duration).hyperfine: to target the Hyperfine level coupling
  • Start targeting other fields within your current level coupling (previously selected as rydberg or hyperfine):
    • ...poly([coeffs], duration).amplitude: to target the real-valued Rabi Amplitude field
    • ...poly([coeffs], duration).phase: to target the real-valued Rabi Phase field
    • ...poly([coeffs], duration).detuning: to target the Detuning field
    • ...poly([coeffs], duration).rabi: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
@beartype
def poly(self, coeffs: List[ScalarType], duration: ScalarType) -> "Poly":
    """
    Append or assign a waveform with a polynomial profile to current location(s).

    You pass in a list of coefficients and a duration to this method which obeys
    the following expression:

    `
    wv(t) = coeffs[0] + coeffs[1]*t + coeffs[2]*t^2 + ... + coeffs[n]*t^n
    `

    If you specified a spatial modulation (e.g. `uniform`, `location`,`scale`)
    previously without a waveform you will now have completed the construction
    of a "drive", one or a sum of drives creating a "field"
    (e.g. Real-valued Rabi Amplitude/Phase).

    If you have already specified a waveform previously you will now be appending
    this waveform to that previous waveform.

    ### Usage Example:
    ```
    >>> prog = start.add_position((0,0)).rydberg.detuning.uniform
    >>> coeffs = [-1, 0.5, 1.2]
    # resulting polynomial is:
    # f(t) = -1 + 0.5*t + 1.2*t^2 with duration of
    # 0.5 us
    >>> prog.poly(coeffs, duration=0.5)
    ```

    - Your next steps include:
    - Continue building your waveform via:
        - `...poly([coeffs], duration).linear(start, stop, duration)`:
            to append another linear waveform
        - `...poly([coeffs], duration).constant(value, duration)`:
            to append a constant waveform
        - `...poly([coeffs], duration)
            .piecewise_linear([durations], [values])`:
            to append a piecewise linear waveform
        - `...poly([coeffs], duration)
            .piecewise_constant([durations],[values])`:
            to append a piecewise constant waveform
        - `...poly([coeffs], duration).poly([coefficients], duration)`:
            to append a polynomial waveform
        - `...poly([coeffs], duration).apply(waveform)`:
            to append a pre-defined waveform
        - `...poly([coeffs], duration).fn(f(t,...))`:
            to append a waveform defined by a python function
    - Slice a portion of the waveform to be used:
        - `...poly([coeffs], duration).slice(start, stop, duration)`
    - Save the ending value of your waveform to be reused elsewhere
        - `...poly([coeffs], duration).record("you_variable_here")`
    - Begin constructing another drive by starting a new spatial modulation
      (this drive will be summed to the one you just created):
        - `...poly([coeffs], duration).uniform`:
            To address all atoms in the field
        - `...poly([coeffs], duration).location(int)`:
            To address an atom at a specific location via index
        - `...poly([coeffs], duration).scale(...)`
            - To address an atom at a specific location via variable
            - To address multiple atoms at specific locations by
                specifying a single variable and then assigning
                it a list of coordinates
    - Assign values to pre-existing variables via:
        - `...poly([coeffs], duration).assign(variable_name = value)`:
            to assign a single value to a variable
        - `...poly([coeffs], duration)
            .batch_assign(variable_name = [value1, ...])`:
            to assign multiple values to a variable
        - `...poly([coeffs], duration).args(["previously_defined_var"])`:
            to defer assignment of a variable to execution time
    - Select the backend you want your program to run on via:
        - `...poly([coeffs], duration).braket`:
            to run on Braket local emulator or QuEra hardware remotely
        - `...poly([coeffs], duration).bloqade`:
            to run on the Bloqade local emulator
        - `...poly([coeffs], duration).device`:
            to specify the backend via string
    - Choose to parallelize your atom geometry,
      duplicating it to fill the whole space:
        - `...poly([coeffs], duration).parallelize(spacing)`
    - Start targeting another level coupling
        - `...poly([coeffs], duration).rydberg`:
            to target the Rydberg level coupling
        - `...poly([coeffs], duration).hyperfine`:
            to target the Hyperfine level coupling
    - Start targeting other fields within your current level
      coupling (previously selected as `rydberg` or `hyperfine`):
        - `...poly([coeffs], duration).amplitude`:
            to target the real-valued Rabi Amplitude field
        - `...poly([coeffs], duration).phase`:
            to target the real-valued Rabi Phase field
        - `...poly([coeffs], duration).detuning`:
            to target the Detuning field
        - `...poly([coeffs], duration).rabi`:
            to target the complex-valued Rabi field
    """
    return Poly(coeffs, duration, self)