.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/e00_instrument_interfaces.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_e00_instrument_interfaces.py: Instrument Interfaces ===================== Every instrument interfaces inherits a common state model, and an interface abstraction for a kind of service that instrument may provide. Every instrument has it's own submodule by its make and model, and interfaces for that instrument art imported through that submodule. Different instruments can be used for the same measurement by swapping import statements. .. GENERATED FROM PYTHON SOURCE LINES 16-19 .. code-block:: Python from rminstr.instruments.HP3458A import Voltmeter .. GENERATED FROM PYTHON SOURCE LINES 20-31 Every interface in this package adheres to a common state model. Flow control often looks like this: 1. Connect to instrument with the class and a VISA address. 2. Bring to a safe initial state ``initial_setup()``. 3. Adjust settings with ``setup``. 4. Arm the instrument with ``arm``. 5. Trigger the instrument with ``trigger``. 6. Wait for data to be ready with ``wait_until_data_available``. 7. Fetch data with ``fetch_data``. 8. Back to step 3. .. GENERATED FROM PYTHON SOURCE LINES 31-42 .. code-block:: Python vm = Voltmeter('GPIB0::16::INSTR') vm.initial_setup() vm.setup(v_range=1) vm.arm() vm.trigger() vm.wait_until_data_available(timeout=10) # Return a dictionary of numpy arrays. data = vm.fetch_data() .. GENERATED FROM PYTHON SOURCE LINES 43-45 Query an instruments state as needed .. GENERATED FROM PYTHON SOURCE LINES 45-47 .. code-block:: Python vm.query_state() .. GENERATED FROM PYTHON SOURCE LINES 48-49 Close out the connection when you are done. .. GENERATED FROM PYTHON SOURCE LINES 49-50 .. code-block:: Python vm.close() .. _sphx_glr_download_auto_examples_e00_instrument_interfaces.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: e00_instrument_interfaces.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: e00_instrument_interfaces.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: e00_instrument_interfaces.zip ` .. include:: e00_instrument_interfaces.recommendations .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_