-
Notifications
You must be signed in to change notification settings - Fork 55
Introduce a new attribute for IntermediateDevice
defining the minimum clock high time
#88
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
Introduce a new attribute for IntermediateDevice
defining the minimum clock high time
#88
Conversation
…to specify a minimum clock high time in order to allow asymmetric clock ticks when combined with gated clocks on a pseudoclock. `minimum_clock_high_time` defaults to half of the minimum time between `IntermediateDevice` instructions. It be backwards compatible with previous versions of labscript devices. Fixes labscript-suite#51. I also discovered a bug where the check against the next all change time did not capture the last change time on the clock line because the stop time had not yet been added. This is now fixed. There were also some issues with various error messages. I've fixed those too and moved to use f strings so they're more readable. The whole `Pseudoclock.collect_change_times` method has also been reformatted in line with how `black` would format it (since I was working on it anyway). Some commented out code was also removed here too.
…ript device class. This is the corresponding change for labscript-suite/labscript#88 Technically I think this can be as low as 100ns but I'm concerned that some of the tri-state buffer hardware (or similar) that some labs have in front of their NovaTechs might mean this is actually slower. 1us seems like a safe bet while allowing people to command output on other clocklines within a reasonable time frame.
It will be a bit before I can actually test this on hardware. In the meantime, I want to make sure I know how to actually build a test that fails under current code but succeeds here. I don't think any of our current experiments are butting into this problem anymore by design so I'll need to craft something from scratch. Is the basic test to use a PB to clock a Novatech and a DAQ, command a novatech update at time t, the command an update do a DAQ output at time t+tau, with tau varying from say 120us down to 1us? Are there any special edge cases that I should be looking out for? I've looked through the linked issues, but I suspect reproducing any of those specific situations may get rather tricky since most don't actually include scripts or shot files that produce the error. |
Yep, that's all that you should need to do. Should currently fail when tau is less than 100us, but not with these PRs. There really shouldn't be any bugs, I've only changed error messages and where the stop time is inserted into the change time array. But it's possible there is a bug in how I calculate the default min high time for devices other than the NovaTech or something else like that 🤷 #53 was your issue report originally so if you don't have something current to reproduce that I think I'd like to just say it was a duplicate of #51 (maybe it was a shutter offset or something that made it seem like it was different). |
This appears to be working for the standard case. Here is my test script: start()
t = 0
ao0.constant(t,0)
dds.setfreq(t, 10*MHz)
dds.setamp(t, 0.1)
dds.setphase(t, 0)
t += start_delay
pb_2.go_high(t)
dds.setamp(t, 0.3)
t += tau
ao0.constant(t, 0.5)
t += hold_time
pb_2.go_low(t)
stop(t+1e-3) I'm checking outputs on a scope, so I'm changing the DDS amplitude as it is easier to see. I then set a constant AnalogOut (on another clockline from the same pulseblaster pseudoclock) to change a time I haven't tried to recreate any of the specific scenarios mentioned above. If I can find time I'll try, but I think this can be merged now (assuming logic is right) and fixed later if I find anything in further testing. |
@philipstarkey Browsing old PRs and found this. Are you OK to merge? |
I think so 🤷 |
Cool. Let's do it! |
commit 82f2b7e Merge: 43d9901 727caf1 Author: David Meyer <dihm@users.noreply.github.com> Date: Fri Aug 5 16:14:04 2022 -0400 Merge pull request #94 from dihm/update-workflow Bring workflow up to date with sandbox commit 727caf1 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Aug 3 13:22:55 2022 -0400 Bring workflow up to date with sandbox commit 43d9901 Merge: b67bc30 c48a1f2 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Jun 2 10:36:50 2022 -0400 Merge pull request #92 from dihm/fix_docs_build Bump sphinx pin and update intersphinx links commit c48a1f2 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Jun 2 10:33:45 2022 -0400 Bump sphinx pin and update intersphinx links commit b67bc30 Merge: efa479a d554160 Author: Chris Billington <chrisjbillington@gmail.com> Date: Wed Jun 1 09:38:08 2022 +1000 Merge pull request #90 from ispielma/NoHG Change default of save_hg_info to commit d554160 Author: Ian Spielman <spielman@umd.edu> Date: Tue May 31 13:45:02 2022 -0400 Change default of save_hg_info to commit efa479a Merge: de6fb95 a9888d5 Author: David Meyer <dihm@users.noreply.github.com> Date: Mon May 30 07:29:54 2022 -0400 Merge pull request #88 from philipstarkey/philipstarkey/issue51 Introduce a new attribute for `IntermediateDevice` defining the minimum clock high time commit de6fb95 Merge: 763a0f1 aadd476 Author: David Meyer <dihm@users.noreply.github.com> Date: Sat Feb 5 06:01:08 2022 -0500 Merge pull request #87 from dihm/docs_mock_imports Mock `labscript_utils` to prevent RTD from trying to launch zprocess. commit a9888d5 Author: Phil Starkey <philipstarkey@users.noreply.github.com> Date: Sat Feb 5 20:31:56 2022 +1100 Introduce a new attribute for `IntermediateDevice`s that allows them to specify a minimum clock high time in order to allow asymmetric clock ticks when combined with gated clocks on a pseudoclock. `minimum_clock_high_time` defaults to half of the minimum time between `IntermediateDevice` instructions. It be backwards compatible with previous versions of labscript devices. Fixes #51. I also discovered a bug where the check against the next all change time did not capture the last change time on the clock line because the stop time had not yet been added. This is now fixed. There were also some issues with various error messages. I've fixed those too and moved to use f strings so they're more readable. The whole `Pseudoclock.collect_change_times` method has also been reformatted in line with how `black` would format it (since I was working on it anyway). Some commented out code was also removed here too. commit aadd476 Author: David Meyer <dihm@users.noreply.github.com> Date: Fri Feb 4 08:51:54 2022 -0500 Re-attempt to mock `labscript_utils` import so autosummary can work. commit 755e562 Author: David Meyer <dihm@users.noreply.github.com> Date: Fri Feb 4 08:40:06 2022 -0500 Reset pins, use importlib_metadata to get version in `conf.py`. commit d5750bb Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Feb 3 14:36:46 2022 -0500 Remove zprocess pins and pin labscript-utils to last known working version. commit a5b195d Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Feb 3 14:29:19 2022 -0500 Back to last known working zprocess version. commit 9294f98 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Feb 3 14:27:16 2022 -0500 Change pin back on more. commit d9b0cd0 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Feb 3 14:24:39 2022 -0500 Remove mock, test which version of zprocess is causing change by temporarily pinning it. commit 60d21fa Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Feb 3 14:03:01 2022 -0500 Mock `labscript_utils` to prevent RTD from trying to launch zprocess.
commit e1f3d32 Merge: 9fca33b 3562012 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Apr 12 15:28:13 2023 -0400 Merge pull request #105 from labscript-suite/workflow-sync Sync workflow with the current state of the art commit 3562012 Author: chrisjbillington <chrisjbillington@gmail.com> Date: Fri Apr 7 20:26:14 2023 +1000 Sync workflow with the current state of the art And add Python 3.10 and 3.11 to the list of supported versions commit 9fca33b Merge: 337f010 a3e52b8 Author: David Meyer <dihm@users.noreply.github.com> Date: Tue Feb 7 13:04:00 2023 -0500 Merge pull request #102 from dihm/NIDAQ_AI_ext_timebase Externally clocked analog inputs on NI-DAQmx commit a3e52b8 Author: David Meyer <dihm@users.noreply.github.com> Date: Fri Dec 9 13:19:48 2022 -0500 Implement ability to specify an external sample clock timebase signal for analog inputs on an NI-DAQ. This mitigates issues where the AI clock and the timing pseudoclock can get out of sync with each other, particularly for long shots. commit 337f010 Merge: f23aca2 59fdf27 Author: David Meyer <dihm@users.noreply.github.com> Date: Tue Feb 7 09:43:29 2023 -0500 Merge pull request #103 from carterturn/NIDAQmx-terminal-connecting Allow arbitrary terminal connections for NI DAQmx devices commit 59fdf27 Author: Carter Turn <carterturn@tutanota.de> Date: Mon Jan 30 19:33:20 2023 -0500 Clarified definition of terminals commit 06fa078 Author: Carter Turn <carterturn@tutanota.de> Date: Mon Jan 30 10:18:51 2023 -0500 Avoid error messages when connection tables compiled before connected terminals feature added are used. commit 6503e9b Author: Carter Turn <carterturn@tutanota.de> Date: Sun Jan 29 14:23:07 2023 -0500 Added documentation on terminal connections (especially for clocking) commit e682e80 Author: Carter Turn <carterturn@tutanota.de> Date: Tue Jan 10 16:02:13 2023 -0500 Don't specify polarity when disconnecting commit b5e19a9 Author: Carter Turn <carterturn@tutanota.de> Date: Tue Jan 10 15:58:47 2023 -0500 Removed improper self commit 6ca71e1 Author: Carter Turn <carterturn@tutanota.de> Date: Tue Jan 10 15:32:20 2023 -0500 Initial implementation of arbitrary terminal mirroring (untested) commit f23aca2 Merge: 5ec255a 5c6a4a7 Author: David Meyer <dihm@users.noreply.github.com> Date: Fri Aug 5 15:49:17 2022 -0400 Merge pull request #101 from dihm/update-workflow Bring workflow up to date with the sandbox commit 5c6a4a7 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Aug 3 13:08:12 2022 -0400 Bring workflow up to date with the sandbox commit 5ec255a Merge: f389240 5602e47 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Jun 2 10:04:03 2022 -0400 Merge pull request #97 from dihm/docs_build Fix docs build commit f389240 Merge: f4ecfdf 2930110 Author: David Meyer <dihm@users.noreply.github.com> Date: Mon May 30 07:34:23 2022 -0400 Merge pull request #94 from philipstarkey/philipstarkey/labscript-issue51 Added a minimum_clock_high_time attribute the the NovaTechDDS9M labscript device class. commit f4ecfdf Merge: 137a057 404074d Author: David Meyer <dihm@users.noreply.github.com> Date: Mon May 30 07:27:31 2022 -0400 Merge pull request #99 from ispielma/CameraErrorControl Camera error control commit 404074d Author: spielman <spielman@umd.edu> Date: Sun May 29 16:48:23 2022 -0400 Added exception_on_failed_shot to MockCamera since it too might be called. commit 7c463c8 Author: spielman <spielman@umd.edu> Date: Tue May 24 16:16:53 2022 -0400 Added exception_on_failed_shot attribute to all devices that subclass IMAQdx imaging, but did not actually implement code to catch their internal errors. commit ba4c4dd Author: MiniLab <ian.spielman@nist.gov> Date: Tue May 24 15:53:18 2022 -0400 Try resetting the camera class each shot instead. commit ea54aa8 Author: MiniLab <ian.spielman@nist.gov> Date: Tue May 24 15:47:41 2022 -0400 Had to move exception_on_failed_shot to be a connection table item (so that it is used in the initialization of the camera subclass) commit bdf6e84 Author: spielman <spielman@umd.edu> Date: Tue May 24 13:12:27 2022 -0400 Stop acquisition on error. commit 33a09e2 Author: spielman <spielman@umd.edu> Date: Tue May 24 13:08:39 2022 -0400 So not sort attributes because they need to be commanded in a specific order. commit 7aed6d9 Author: spielman <spielman@umd.edu> Date: Tue May 24 13:08:07 2022 -0400 Check for exception_on_failed_shots in acquisition loop not just afterwards. commit 5602e47 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Apr 28 13:28:50 2022 -0400 Update sphinx pin to avoid deprecated jinja2 import. commit db0acd5 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Apr 28 13:23:59 2022 -0400 Update intersphinx links. commit 137a057 Merge: 8de7a40 410a671 Author: David Meyer <dihm@users.noreply.github.com> Date: Thu Apr 28 10:04:14 2022 -0400 Merge pull request #96 from ispielma/CameraAttributes Added pixel_size and magnification attributes to imaqdxcamera commit 410a671 Author: spielman <spielman@umd.edu> Date: Fri Apr 22 12:41:50 2022 -0400 Updated to connection table properties. commit 39eb80b Merge: 6b33558 8de7a40 Author: spielman <spielman@umd.edu> Date: Fri Apr 22 12:39:13 2022 -0400 Merge remote-tracking branch 'origin/master' into CameraAttributes commit 8de7a40 Merge: c710b07 936e3ee Author: David Meyer <dihm@users.noreply.github.com> Date: Tue Mar 29 17:47:40 2022 -0400 Merge pull request #93 from labscript-suite/qapplication-fix Replace QtGui.QApplication → QtWidgets.QApplication commit 6b33558 Author: spielman <spielman@umd.edu> Date: Wed Feb 9 11:56:58 2022 -0500 Added pixel_size and magnification attributes to imaqdxcamera commit c710b07 Merge: 999107d 3b49192 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Feb 9 10:48:06 2022 -0500 Merge pull request #95 from dihm/fix_doc_build Fix doc builds commit 3b49192 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Feb 9 10:16:46 2022 -0500 Couple minor typo fixes. commit c144cb0 Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Feb 9 09:00:14 2022 -0500 Mock `labscript_utils` to prevent h5_lock imports from preventing autodoc importing things on RTD. commit 2930110 Author: Phil Starkey <philipstarkey@users.noreply.github.com> Date: Sat Feb 5 20:47:16 2022 +1100 Added a minimum_clock_high_time attribute the the NovaTechDDS9M labscript device class. This is the corresponding change for labscript-suite/labscript#88 Technically I think this can be as low as 100ns but I'm concerned that some of the tri-state buffer hardware (or similar) that some labs have in front of their NovaTechs might mean this is actually slower. 1us seems like a safe bet while allowing people to command output on other clocklines within a reasonable time frame. commit 999107d Author: David Meyer <dihm@users.noreply.github.com> Date: Wed Feb 2 17:16:29 2022 -0500 Pin `mistune` to fix doc builds on RTD. commit 936e3ee Author: chrisjbillington <chrisjbillington@gmail.com> Date: Sat Jan 29 11:26:58 2022 +1100 Replace QtGui.QApplication → QtWidgets.QApplication Similar to #92, it looks like the former was an alias provided by pyqtgraph for backwards compatibility with code written for PyQt4. pyqtgraph no longer provides this alias.
Introduce a new attribute for
IntermediateDevice
s that allows them to specify a minimum clock high time in order to allow asymmetric clock ticks when combined with gated clocks on a pseudoclock.minimum_clock_high_time
defaults to half of the minimum time betweenIntermediateDevice
instructions. It be backwards compatible with previous versions of labscript devices.Fixes #51.
Fixes #85.
I also discovered a bug where the check against the next all change time did not capture the last change time on the clock line because the stop time had not yet been added. This is now fixed.
There were also some issues with various error messages. I've fixed those too and moved to use f strings so they're more readable.
The whole
Pseudoclock.collect_change_times
method has also been reformatted in line with howblack
would format it (since I was working on it anyway). Some commented out code was also removed here too.It might also solves #53 but I would appreciate @dihm to verify that as it seemed like it might have been slightly different.
I don't have an apparatus to test on so would appreciate wide testing if possible. Should be tested in conjunction with a forthcoming patch to labscript_devices.