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

Sample a non constant waveform at reduced sample rate #824

Open
terrorfisch opened this issue May 13, 2024 · 6 comments
Open

Sample a non constant waveform at reduced sample rate #824

terrorfisch opened this issue May 13, 2024 · 6 comments

Comments

@terrorfisch
Copy link
Member

terrorfisch commented May 13, 2024

We need to insert the information that specific pulse templates can be sampled with a reduced rate into the build process at some point. The program builder needs to recognize these. These can be done in three ways.

  1. Tell the program builder which PTs are special before create_program is calle
  2. Tell create_program which PTs are special (like the current to_single_waveform kwarg)
  3. Mark the PTs themselves

IMO point 2 is the one that fits best into qupulse design philosophy because we do not attach any metadata to the PTs right now. However, this leads to a rather unintuitive interface in practice as the to_single_waveform case demonstrated (anecdotal evidence).

My current preferred idea would be the following:

  • Add a PulseMetaData class with the fields to_single_waveform: bool and minimal_sample_rate: float
  • Add a metadata kwarg to create_program which is a map of PulseTemplate | PulseTemplateIdentifier -> PTMetaData
  • Propagate the minimal sample rate through the linspace program to the seqc builder which then can use the largest sample rate divider that is above the minimal sample rate.

@Nomos11 Does this sound reasonable?

Example for 2.:

fast_pt = ...
slow_pt = ...

final_pt =  fast_pt @ slow_pt

program = final_pt.create_program(metadata: {slow_pt: dict(minimal_sample_rate=10**3)})

Example for 3.:

slow_pt = SequencePT(..., minimal_sample_rate='f_shuttle * 100')
@Nomos11
Copy link
Collaborator

Nomos11 commented May 27, 2024

yes, that sounds reasonable to me.
However, would the user then explicitly have to take care of the changed requirements for pulse granularity? That might run into some not so user friendly handling issues again if the time is not by chance compatible with all relevant powers of 2 (but maybe the pad_to_next_multiple or how it was called can help in some form)

@terrorfisch
Copy link
Member Author

Yes this is also somewhing that bothers me.

The best I can come up with is

shuttle = FunctionPT('sin(t / t_dur)', duration='t_dur')
s1 = shuttle.with_mapping({'t_dur': '192 * 2**i'})
s2 = shuttle.with_mapping({'t_dur': '256 * 2**i'})
s3 = shuttle.with_mapping({'t_dur': '320 * 2**i'})

sweep = (s1 @ s2 @ s3).with_iteration(i, 10, 1000)
```

@Nomos11
Copy link
Collaborator

Nomos11 commented May 27, 2024

In the end I think this is sufficient though. qupulse should probably enforce strict regulations and throw errors otherwise, and another layer on top [c/sh]ould allow potential inacurracies be handled.
maybe some convenience functions can be drafted to assist this.

@terrorfisch
Copy link
Member Author

In principle we can add timing requirements to PulseMetaData as well in the future to allow imprecise timing.

@Nomos11
Copy link
Collaborator

Nomos11 commented Jun 9, 2024

additionally, something with rolling out loops that would not natively be supported by the linspacebuilder/the hardware could potentially be included.

@terrorfisch
Copy link
Member Author

terrorfisch commented Jun 10, 2024

minimal_sample_rate mixes physical information and setup information (depends on hardware filtering and interpolation)

Option 3 is the best bet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants