-
Notifications
You must be signed in to change notification settings - Fork 37
Add function to generate modulated Gaussian control #110
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
Conversation
|
I think I might be missing some context here about why we're transferring this to Open Controls? |
User guide is using old API to generate noise characterization pulses, which we want to get rid of. |
| }, | ||
| ) | ||
|
|
||
| segment_start_times = np.arange(0, duration, minimum_segment_duration) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that it's a specified duration but only a minimum segment duration, I think instead we should use slightly longer segment lengths so that we get a pulse of duration duration exactly:
segment_count = int(np.ceil(duration / minimum_segment_duration))
segment_start_times = np.arange(segment_count) * duration / segment_count # or similar
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, sorry I missed that point. Fixed.
| base_gaussian_segments | ||
| ) | ||
| maximum_rotation_angle = ( | ||
| minimum_segment_duration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make the suggested change above, this would become segment_duration
leoadec
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, I just have two suggestions.
I don't think I have the authority to oversee the transfer of code from a private repo to an open source project, so I'll let @charmasaur give the final thumbs up here
| ) | ||
|
|
||
| # work out exact segment duration | ||
| segment_num = int(np.ceil(duration / minimum_segment_duration)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe segment_count?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, somehow I always pick segment_num
| base_gaussian_segments = (1.0 / gaussian_width / np.sqrt(2 * np.pi)) * np.exp( | ||
| -0.5 * ((segment_midpoints - gaussian_mean) / gaussian_width) ** 2 | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My opinion of this back when it was part of Core is that the normalization constant 1.0 / gaussian_width / np.sqrt(2 * np.pi) isn't necessary because the pulse gets normalized again anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG, removed.
This function should be the same as the one in core with some tweaks. We expect users to use it to generate amplitude noise characterization pulses.
Tests are migrated and modified a bit.