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

dond to support time-dependence measurements (perhaps with ElapsedTimeParameter) #4695

Open
astafan8 opened this issue Oct 5, 2022 · 4 comments

Comments

@astafan8
Copy link
Contributor

astafan8 commented Oct 5, 2022

something like

etp = ElapsedTimeParameter()
dond(etp, stuff_to_sweep_and_measure_here, ...)

first of all, ElapsedTimeParameter does not have a set method, so it can't be used in dond as an independent parameter. Secondly, the ask is to run a measurement until elapsed time is more than a specified value (e.g. until elapsed time is more than 10 minutes).

One quick workaround would be to use a dummy parameter as the doNd set parameter and include the ElapsedTimeParameter in the list of meas_params.

Originally requested by @guenp @samantha-ho

@guenp
Copy link
Contributor

guenp commented Oct 5, 2022

Thanks @astafan8 for creating this issue!
The reason why I initially thought it would be great for dond to support time as a parameter is because in the users' mind, time is just another dimension along which we want to measure a set of parameters or rasters. I'm not fixated on using dond for this if it is not within the package's design principles, but the convenience of being able to set up a measurement with dond, then decide "What if I monitor this thing over time"? and only having to make a small change will be great to be able to cover somehow.

bors bot added a commit that referenced this issue Oct 31, 2022
4759: Add ability to get parameter after set to dond r=jenshnielsen a=jenshnielsen

For some instruments it may be a good idea to get the value after setting it and store that in the dataset rather than relying on the instrument being able to set the exact value. 

This implements that by extending the Sweeps classes with a boolean. This could be extended to read a flag from the parameter giving the parameter a trait to indicate if it has been set


This is also a small step towards fixing #4695 since it will become possible to get the value of a parameter that one sets

To make this easier to demonstrate ManualParameters have been improved to log using the instrument logger

TODO 
- [x] Documentation (examples + docstrings)
- [x] Tests
- [x] release notes

4770: Add text-wrapping for extra-long plot titles r=jenshnielsen a=samantha-ho

This PR text-wraps long plot titles.

4779: Keithley calibration: adjust calibration date before saving new calibration r=astafan8 a=michieldemoor

When running the calibrate_keithley_smu_v method to calibrate a Keithley SMU, as documented [here](https://qcodes.github.io/Qcodes/examples/driver_examples/Qcodes%20example%20with%20Keithley%202600.html#Recalibration), the calibration gives the following error:

ERROR CODE: 5029

SMU A: Cannot save without changing cal adjustment date

SMU B: Cannot save without changing cal adjustment date

This PR addresses this error by changing the calibration adjustment date before saving the new calibration.

Co-authored-by: Jens H. Nielsen <Jens.Nielsen@microsoft.com>
Co-authored-by: Samantha Ho <samanthaho@microsoft.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: mdemoor <mdemoor@microsoft.com>
Co-authored-by: Mikhail Astafev <astafan8@gmail.com>
bors bot added a commit that referenced this issue Oct 31, 2022
4759: Add ability to get parameter after set to dond r=jenshnielsen a=jenshnielsen

For some instruments it may be a good idea to get the value after setting it and store that in the dataset rather than relying on the instrument being able to set the exact value. 

This implements that by extending the Sweeps classes with a boolean. This could be extended to read a flag from the parameter giving the parameter a trait to indicate if it has been set


This is also a small step towards fixing #4695 since it will become possible to get the value of a parameter that one sets

To make this easier to demonstrate ManualParameters have been improved to log using the instrument logger

TODO 
- [x] Documentation (examples + docstrings)
- [x] Tests
- [x] release notes

4773: Update pillow requirement from ~=9.2.0 to ~=9.3.0 r=jenshnielsen a=dependabot[bot]

Updates the requirements on [pillow](https://github.com/python-pillow/Pillow) to permit the latest version.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/python-pillow/Pillow/releases">pillow's releases</a>.</em></p>
<blockquote>
<h2>9.3.0</h2>
<p><a href="https://pillow.readthedocs.io/en/stable/releasenotes/9.3.0.html">https://pillow.readthedocs.io/en/stable/releasenotes/9.3.0.html</a></p>
<h2>Changes</h2>
<ul>
<li>Initialize libtiff buffer when saving <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6699">#6699</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Limit SAMPLESPERPIXEL to avoid runtime DOS <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6700">#6700</a> [<a href="https://github.com/wiredfool"><code>`@​wiredfool</code></a>]</li>`
<li>Inline fname2char to fix memory leak <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6329">#6329</a> [<a href="https://github.com/nulano"><code>`@​nulano</code></a>]</li>`
<li>Fix memory leaks related to text features <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6330">#6330</a> [<a href="https://github.com/nulano"><code>`@​nulano</code></a>]</li>`
<li>Use double quotes for version check on old CPython on Windows <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6695">#6695</a> [<a href="https://github.com/hugovk"><code>`@​hugovk</code></a>]</li>`
<li>GHA: replace deprecated set-output command with GITHUB_OUTPUT file <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6697">#6697</a> [<a href="https://github.com/nulano"><code>`@​nulano</code></a>]</li>`
<li>Remove backup implementation of Round for Windows platforms <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6693">#6693</a> [<a href="https://github.com/cgohlke"><code>`@​cgohlke</code></a>]</li>`
<li>Upload fribidi.dll to GitHub Actions <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6532">#6532</a> [<a href="https://github.com/nulano"><code>`@​nulano</code></a>]</li>`
<li>Fixed set_variation_by_name offset <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6445">#6445</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Windows build improvements <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6562">#6562</a> [<a href="https://github.com/nulano"><code>`@​nulano</code></a>]</li>`
<li>Fix malloc in _imagingft.c:font_setvaraxes <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6690">#6690</a> [<a href="https://github.com/cgohlke"><code>`@​cgohlke</code></a>]</li>`
<li>Only use ASCII characters in C source file <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6691">#6691</a> [<a href="https://github.com/cgohlke"><code>`@​cgohlke</code></a>]</li>`
<li>Release Python GIL when converting images using matrix operations <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6418">#6418</a> [<a href="https://github.com/hmaarrfk"><code>`@​hmaarrfk</code></a>]</li>`
<li>Added ExifTags enums <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6630">#6630</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Do not modify previous frame when calculating delta in PNG <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6683">#6683</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Added support for reading BMP images with RLE4 compression <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6674">#6674</a> [<a href="https://github.com/npjg"><code>`@​npjg</code></a>]</li>`
<li>Decode JPEG compressed BLP1 data in original mode <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6678">#6678</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>pylint warnings <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6659">#6659</a> [<a href="https://github.com/marksmayo"><code>`@​marksmayo</code></a>]</li>`
<li>Added GPS TIFF tag info <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6661">#6661</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Added conversion between RGB/RGBA/RGBX and LAB <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6647">#6647</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Do not attempt normalization if mode is already normal <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6644">#6644</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Fixed seeking to an L frame in a GIF <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6576">#6576</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Consider all frames when selecting mode for PNG save_all <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6610">#6610</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Don't reassign crc on ChunkStream close <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6627">#6627</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Raise a warning if NumPy failed to raise an error during conversion <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6594">#6594</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Only read a maximum of 100 bytes at a time in IMT header <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6623">#6623</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Show all frames in ImageShow <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6611">#6611</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Allow FLI palette chunk to not be first <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6626">#6626</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>If first GIF frame has transparency for RGB_ALWAYS loading strategy, use RGBA mode <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6592">#6592</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Round box position to integer when pasting embedded color <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6517">#6517</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Removed EXIF prefix when saving WebP <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6582">#6582</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Pad IM palette to 768 bytes when saving <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6579">#6579</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Added DDS BC6H reading <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6449">#6449</a> [<a href="https://github.com/ShadelessFox"><code>`@​ShadelessFox</code></a>]</li>`
<li>Added support for opening WhiteIsZero 16-bit integer TIFF images <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6642">#6642</a> [<a href="https://github.com/JayWiz"><code>`@​JayWiz</code></a>]</li>`
<li>Raise an error when allocating translucent color to RGB palette <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6654">#6654</a> [<a href="https://github.com/jsbueno"><code>`@​jsbueno</code></a>]</li>`
<li>Moved mode check outside of loops <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6650">#6650</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Added reading of TIFF child images <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6569">#6569</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Improved ImageOps palette handling <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6596">#6596</a> [<a href="https://github.com/PososikTeam"><code>`@​PososikTeam</code></a>]</li>`
<li>Defer parsing of palette into colors <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6567">#6567</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Apply transparency to P images in ImageTk.PhotoImage <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6559">#6559</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Use rounding in ImageOps contain() and pad() <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6522">#6522</a> [<a href="https://github.com/bibinhashley"><code>`@​bibinhashley</code></a>]</li>`
<li>Fixed GIF remapping to palette with duplicate entries <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6548">#6548</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Allow remap_palette() to return an image with less than 256 palette entries <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6543">#6543</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
<li>Corrected BMP and TGA palette size when saving <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6500">#6500</a> [<a href="https://github.com/radarhere"><code>`@​radarhere</code></a>]</li>`
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst">pillow's changelog</a>.</em></p>
<blockquote>
<h2>9.3.0 (2022-10-29)</h2>
<ul>
<li>
<p>Limit SAMPLESPERPIXEL to avoid runtime DOS <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6700">#6700</a>
[wiredfool]</p>
</li>
<li>
<p>Initialize libtiff buffer when saving <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6699">#6699</a>
[radarhere]</p>
</li>
<li>
<p>Inline fname2char to fix memory leak <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6329">#6329</a>
[nulano]</p>
</li>
<li>
<p>Fix memory leaks related to text features <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6330">#6330</a>
[nulano]</p>
</li>
<li>
<p>Use double quotes for version check on old CPython on Windows <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6695">#6695</a>
[hugovk]</p>
</li>
<li>
<p>Remove backup implementation of Round for Windows platforms <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6693">#6693</a>
[cgohlke]</p>
</li>
<li>
<p>Fixed set_variation_by_name offset <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6445">#6445</a>
[radarhere]</p>
</li>
<li>
<p>Fix malloc in _imagingft.c:font_setvaraxes <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6690">#6690</a>
[cgohlke]</p>
</li>
<li>
<p>Release Python GIL when converting images using matrix operations <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6418">#6418</a>
[hmaarrfk]</p>
</li>
<li>
<p>Added ExifTags enums <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6630">#6630</a>
[radarhere]</p>
</li>
<li>
<p>Do not modify previous frame when calculating delta in PNG <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6683">#6683</a>
[radarhere]</p>
</li>
<li>
<p>Added support for reading BMP images with RLE4 compression <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6674">#6674</a>
[npjg, radarhere]</p>
</li>
<li>
<p>Decode JPEG compressed BLP1 data in original mode <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6678">#6678</a>
[radarhere]</p>
</li>
<li>
<p>Added GPS TIFF tag info <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6661">#6661</a>
[radarhere]</p>
</li>
<li>
<p>Added conversion between RGB/RGBA/RGBX and LAB <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6647">#6647</a>
[radarhere]</p>
</li>
<li>
<p>Do not attempt normalization if mode is already normal <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6644">#6644</a>
[radarhere]</p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/python-pillow/Pillow/commit/d594f4cb8dc47fb0c69ae58d9fff86faae4515bd"><code>d594f4c</code></a> Update CHANGES.rst [ci skip]</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/909dc64ed5f676169aa3d9b0c26f132a06321b83"><code>909dc64</code></a> 9.3.0 version bump</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/1a51ce7b955c65c8f2c6bc7772735b197b8a6aa3"><code>1a51ce7</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6699">#6699</a> from hugovk/security-libtiff_buffer</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/2444cddab2f83f28687c7c20871574acbb6dbcf3"><code>2444cdd</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/python-pillow/Pillow/issues/6700">#6700</a> from hugovk/security-samples_per_pixel-sec</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/744f455830871d61a8de0a5e629d4c2e33817cbb"><code>744f455</code></a> Added release notes</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/0846bfae48513f2f51ca8547ed3b8954fa501fda"><code>0846bfa</code></a> Add to release notes</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/799a6a01052cea3f417a571d7c64cd14acc18c64"><code>799a6a0</code></a> Fix linting</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/00b25fd3ac3648bc28eff5d4c4d816e605e3f05f"><code>00b25fd</code></a> Hide UserWarning in logs</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/05b175ef88c22f5c416bc9b8d5b897dea1abbf2c"><code>05b175e</code></a> Tighter test case</li>
<li><a href="https://github.com/python-pillow/Pillow/commit/13f2c5ae14901c89c38f898496102afd9daeaf6d"><code>13f2c5a</code></a> Prevent DOS with large SAMPLESPERPIXEL in Tiff IFD</li>
<li>Additional commits viewable in <a href="https://github.com/python-pillow/Pillow/compare/9.2.0...9.3.0">compare view</a></li>
</ul>
</details>
<br />


You can trigger a rebase of this PR by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

4779: Keithley calibration: adjust calibration date before saving new calibration r=jenshnielsen a=michieldemoor

When running the calibrate_keithley_smu_v method to calibrate a Keithley SMU, as documented [here](https://qcodes.github.io/Qcodes/examples/driver_examples/Qcodes%20example%20with%20Keithley%202600.html#Recalibration), the calibration gives the following error:

ERROR CODE: 5029

SMU A: Cannot save without changing cal adjustment date

SMU B: Cannot save without changing cal adjustment date

This PR addresses this error by changing the calibration adjustment date before saving the new calibration.

Co-authored-by: Jens H. Nielsen <Jens.Nielsen@microsoft.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mdemoor <mdemoor@microsoft.com>
Co-authored-by: Mikhail Astafev <astafan8@gmail.com>
bors bot added a commit that referenced this issue Oct 31, 2022
4759: Add ability to get parameter after set to dond r=jenshnielsen a=jenshnielsen

For some instruments it may be a good idea to get the value after setting it and store that in the dataset rather than relying on the instrument being able to set the exact value. 

This implements that by extending the Sweeps classes with a boolean. This could be extended to read a flag from the parameter giving the parameter a trait to indicate if it has been set


This is also a small step towards fixing #4695 since it will become possible to get the value of a parameter that one sets

To make this easier to demonstrate ManualParameters have been improved to log using the instrument logger

TODO 
- [x] Documentation (examples + docstrings)
- [x] Tests
- [x] release notes

4779: Keithley calibration: adjust calibration date before saving new calibration r=jenshnielsen a=michieldemoor

When running the calibrate_keithley_smu_v method to calibrate a Keithley SMU, as documented [here](https://qcodes.github.io/Qcodes/examples/driver_examples/Qcodes%20example%20with%20Keithley%202600.html#Recalibration), the calibration gives the following error:

ERROR CODE: 5029

SMU A: Cannot save without changing cal adjustment date

SMU B: Cannot save without changing cal adjustment date

This PR addresses this error by changing the calibration adjustment date before saving the new calibration.

Co-authored-by: Jens H. Nielsen <Jens.Nielsen@microsoft.com>
Co-authored-by: mdemoor <mdemoor@microsoft.com>
Co-authored-by: Mikhail Astafev <astafan8@gmail.com>
@astafan8
Copy link
Contributor Author

astafan8 commented Jan 3, 2023

Another request for this just came in: for every value of an outer parameter, measure some other parameter as a function of time by acquiring a value every 10 seconds for 5 minutes. I suggested the following solution:

from qcodes.dataset import dond, LinSweep
from qcodes.parameters import ElapsedTimeParameter, Parameter
from qcodes.dataset import new_experiment

new_experiment("some_experiment", "some_sample")

outer_p = Parameter("outer", set_cmd=None, get_cmd=None)

time_p = ElapsedTimeParameter("time_p")

outer_sweep = LinSweep(
    outer_p,
    0,
    2,
    10,
    # reset the elapsed time parameter
    # for every new value of this sweep
    post_actions=(time_p.reset_clock,)
)

# For use with LinSweep we need to make another parameter
# that can be `set` that will wrap the time parameter because
# the ElapsedTimeParameter does not have a `set` and `dond` call
# would break if we use ElapsedTimeParameter directly
time_p_with_set = Parameter(
    "time",
    get_cmd=time_p.get,  # returns the value of the time parameter
    set_cmd=None  # can be set, but we will ignore this value in the dond
)

time_sweep = LinSweep(
    time_p_with_set,  # we use the wrapping time parameter
    start=0,  # this value does not matter
    stop=5,  # this value does not matter
    num_points=5*60/10,  # 5 mins / 10 seconds, this is the number of times the measurement will be done
    delay=10,  # seconds, the delay between the time measurements
    get_after_set=True,  # thanks to #4759 
)

# Let's create a fake measurement parameter to use in this example:
meas_p = Parameter("meas", set_cmd=False, get_cmd=lambda: outer_p.get()+time_p.get()*2)

# And this is the measurement!
dond(outer_sweep, time_sweep, meas_p)

my personal opinion is that this snippet is not graceful at all. so i'd welcome a more readable solution.

@guenp
Copy link
Contributor

guenp commented Sep 15, 2023

@astafan8, this issue just came up again. This is the workaround that @ThorvaldLarsen came up with:

time_param = ElapsedTimeParameter('time')
time_param._settable = True
time_param.set = lambda x: None
time_sweep = LinSweep(time_param, 1, 1000, 1000, 0, get_after_set=True)

time_param.reset_clock()
ds, _, _ = dond(time_sweep, *params_to_measure)

This solution is not ideal because we have to pick the number of repetitions based on how long we want the measurement to run, instead of just specifying "please measure for 10 minutes".

We were wondering if it might make sense to implement something like this that behaves more like a while loop:

time_param = ElapsedTimeParameter('time')
time_sweep = TimeSweep(time_param, start=0, stop=10*60, delay=0)
ds, _, _ = dond(time_sweep , *params_to_measure)

@samantha-ho
Copy link
Contributor

samantha-ho commented Sep 22, 2023

Now that they're released, it makes more sense to use the datasaver_builder and dond_into extension than try to make this work in the base dond method.

In rough pseudocode, it would look like this:

time_param = ElapsedTimeParameter('time')
start_time = time.now()
with datasaver_builder(dataset_definition) as datasavers:
  while time_param < start_time + duration:
    dond_into(datasavers[0], *params_to_measure, additional_setpoints=(time_param,))
    time.sleep(delay)
  ds = datasavers[0].dataset

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

3 participants