bloqade-python icon indicating copy to clipboard operation
bloqade-python copied to clipboard

Use case: selecting individual tasks in a batch with square brackets

Open jon-wurtz opened this issue 2 years ago • 3 comments

Get an individual task from a batch assigned task. For example,

rabi_oscillation_job = rabi_oscillations_program.assign(
    ramp_time=0.06, rabi_value=15, detuning_value=0.0
).batch_assign(run_time=np.around(np.arange(0, 21, 1) * 0.05, 13))

single_job = rabi_oscillation_job[5]

Or alternatively

rabi_oscillation_job = rabi_oscillations_program.assign(
    ramp_time=0.06, rabi_value=15, detuning_value=0.0
).batch_assign(run_time={"time 1":1.05, "time 2": 2.24, "endtime":4.45))

single_job = rabi_oscillation_job["time 1"] # Returns the one with run time 1.05

Is there another way to select single jobs that I'm missing?

jon-wurtz avatar Jun 30 '23 13:06 jon-wurtz

This is a nice feature to have. I think the getindex syntax is a good idea, and implementation is trivial, all we need is to support __getitem__ for the assign builder, but perhaps we can support this after beta due to bandwidth, I'll mark this as a blocking issue for 1.0 for now.

Roger-luo avatar Jul 03 '23 23:07 Roger-luo

This doesn't belong in the builder because the builder contains the bloqade-IR

weinbe58 avatar Jul 14 '23 14:07 weinbe58

This doesn't belong in the builder because the builder contains the bloqade-IR

It can just return the corresponding lazy object of builder

Roger-luo avatar Jul 16 '23 17:07 Roger-luo