Skip to content

Added pixel_size and magnification attributes to imaqdxcamera #96

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

Merged
merged 3 commits into from
Apr 28, 2022

Conversation

ispielma
Copy link
Contributor

@ispielma ispielma commented Feb 9, 2022

We are in the process of setting up a new system and in the process of calibrating the camera it became clear that the best place to store information about the pixel size and magnification are as device attributes. So this pull request adds pixel_size and magnification as attributes to IMAQdxCamera.

A follow up on this would be to have the real-time display in blacs use these to compute the axes in real units.

@dihm
Copy link
Contributor

dihm commented Feb 16, 2022

This is a pretty simple change, so I'm happy to merge as is.

A follow up on this would be to have the real-time display in blacs use these to compute the axes in real units.

If you are serious about this in the near-ish future, we may actually want to put these attributes as connection_table_properties instead. Let me see if I can clearly explain why (mostly for posterity since a lot of this detail isn't really documented anywhere).

To begin, despite the names, both device_properties and connection_table_properties are properties of the specific device (another way I might put it, connection_table_properties refers to where the device property is stored, not what it is a property of). The differences between them come down to where they are stored in the h5 file and how they are accessed.

  • connection_table_properties are stored in the connection table, and therefore are compared against when comparing the connection table of a shot with the connection table of BLACS. This also means that changes to them require re-compiling the connection-table.
    • You access these values (from the BLACS connection_table) using a labscript_utils.connections.ConnectionTable object, which is provided as an instantiation argument to the BLACSTab. The Tab can be written to pass these values to the BLACSWorker as arguments when the tab starts the worker process(es).
  • device_properties are stored as attributes of the device in a shot file. These can change from shot to shot without recompiling the connection table.
    • These are accessed (from each shot) by using labscript_utils.properties which takes the shot h5 file path as an argument. As such, it's really only practical to access these values in the worker transition_to_buffered or transition_to_manual where that path is provided.

So, in short, the general intended design of these is for connection_table_properties to be used for things that don't/shouldn't change from shot to shot, and can be used as arguments to instantiate the BLACSTab and/or BLACSWorker dynamically at runtime. device_properties is for things that can change from shot-to-shot and only need to be accessed when transitioning in and out of buffered.

For this PR, I think a case could be made that these properties really shouldn't change from shot to shot. And it could be nice to use them when defining the Tab so the axis transform could be applied to raw data as already sent from the Worker. Of course, if this is just book-keeping or you would rather the axis transforms happen in the Worker and have the axis ranges communicated to the Tab with the raw data, that's fine too.

Ultimately, just wanted to make sure the choice was made now such that it didn't need to be changed in the near future, and also take advantage of the opportunity to document a more subtle feature somewhere online so I can find it next time I need to remind myself of how all this works.

@ispielma
Copy link
Contributor Author

ispielma commented Feb 16, 2022 via email

@dihm
Copy link
Contributor

dihm commented Mar 29, 2022

Ian, sorry I let this fall off my radar. Do you want to send a commit to move the new properties to connection_table_properties? If not, I'm pretty sure I can do it (depending on your github settings) though I'm pretty sure that involves me sending commits to your fork directly which I'm not a super fan of.

I'm happy to merge when that's done.

@ispielma
Copy link
Contributor Author

David,

I finally updated this pull request to store the information as connection table properties.

-- Ian

@dihm
Copy link
Contributor

dihm commented Apr 28, 2022

Thanks! Merging.

@dihm dihm merged commit 137a057 into labscript-suite:master Apr 28, 2022
@ispielma ispielma deleted the CameraAttributes branch May 2, 2022 15:12
@ispielma ispielma restored the CameraAttributes branch May 2, 2022 15:12
@ispielma ispielma deleted the CameraAttributes branch May 24, 2022 16:18
dihm added a commit that referenced this pull request Apr 13, 2023
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.
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

Successfully merging this pull request may close these issues.

2 participants