{ "cells": [ { "cell_type": "markdown", "id": "a657526c", "metadata": {}, "source": [ "# Example for Horiba FHR\n", "\n", "This driver has been tested with a FHR1000 spectrometer with one dual grating turret, an entrance slit, exit slit, and an exit slit selection mirror.\n", "\n", "The dll unfortunately does not have any version information. It was shipped with LabSpec 6.5.1. The supporting information is contained in a word document called `SpeControl_dll.docx`." ] }, { "cell_type": "code", "execution_count": 1, "id": "17976519-ee58-4afc-89ee-23d8475a3d14", "metadata": { "scrolled": true, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Logging hadn't been started.\n", "Activating auto-logging. Current session state plus future input saved.\n", "Filename : C:\\Users\\Flash\\.qcodes\\logs\\command_history.log\n", "Mode : append\n", "Output logging : True\n", "Raw input log : False\n", "Timestamping : True\n", "State : active\n", "Qcodes Logfile : C:\\Users\\Flash\\.qcodes\\logs\\231006-740-qcodes.log\n" ] } ], "source": [ "import pathlib\n", "import tempfile\n", "from qcodes_contrib_drivers.drivers.Horiba.Horiba_FHR import HoribaFHR" ] }, { "cell_type": "code", "execution_count": 2, "id": "4eaa3ffc-49e6-419d-a0e1-fc07d09b22b5", "metadata": { "jupyter": { "source_hidden": true }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "1326" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dll_dir = r'C:\\HORIBA\\Software\\SDK FHR Express'\n", "config_file = pathlib.Path(tempfile.mkdtemp(), 'config.ini')\n", "config_file.write_text(\n", "\"\"\"[Firmware]\n", "VersionNumber=123456\n", "SerialNumber=1234567890\n", "==================================================\n", "[Port]\n", "ComPort=13\n", "Baudrate=115200\n", "Timeout=60000\n", "==================================================\n", "[Spectrometer]\n", "Focal=1000\n", "CoefficientOfAngle=0.20071286\n", "Board=1\n", "SpeedMin=500\n", "SpeedMax=280000\n", "Acceleration=400\n", "Backlash=-12500\n", "MotorStepUnit=2\n", "Reverse=0\n", "GratingNumber=2\n", "SlitNumber=2\n", "==================================================\n", "[Grating1]\n", "Name=1800 gr/mm\n", "Value=1800\n", "AddrAxe=5\n", "Offset=54940\n", "Shift=0\n", "MinNm=50\n", "MaxNm=750\n", "CoefficientOfLinearity=1.000069196\n", "==================================================\n", "[Grating2]\n", "Name=600 gr/mm\n", "Value=600\n", "AddrAxe=9\n", "Offset=2554965\n", "Shift=0\n", "MinNm=50\n", "MaxNm=2000\n", "CoefficientOfLinearity=0.999935906\n", "==================================================\n", "[Slit1]\n", "Name=Front entrance slit\n", "AddrAxe=1\n", "Offset=450\n", "Minum=0\n", "Maxum=2000\n", "Coeffum=1\n", "SpeedMin=50\n", "SpeedMax=500\n", "Acceleration=150\n", "Backlash=100\n", "MotorStepUnit=1\n", "Reverse=1\n", "==================================================\n", "[Slit2]\n", "Name=Side exit slit\n", "AddrAxe=4\n", "Offset=450\n", "Minum=0\n", "Maxum=2000\n", "Coeffum=1\n", "SpeedMin=50\n", "SpeedMax=500\n", "Acceleration=150\n", "Backlash=100\n", "MotorStepUnit=1\n", "Reverse=1\n", "==================================================\n", "[Mirror2]\n", "Name=Exit mirror\n", "AddrAxe=7\n", "Delayms=100\n", "DutyCycle%=30\n", "==================================================\n", "\"\"\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "778427c9-5732-4b04-bc14-6205f2314e04", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Connected to: Horiba FHR1000 (serial:1234567890, firmware:123456) in 1.48s\n" ] } ], "source": [ "spe = HoribaFHR('spe', dll_dir, config_file,\n", " dc_val_mappings={2: {'front': 0, 'side': 1}})" ] }, { "cell_type": "markdown", "id": "6b93170e-1805-48cf-b87a-af40c863ee5e", "metadata": {}, "source": [ "The `dc_val_mappings` parameter allows to map the binary positions of the DC motors to a more inuititive string.\n", "\n", "The various controllers are stored as `ChannelList`s:" ] }, { "cell_type": "code", "execution_count": 4, "id": "b3293c81-6ab9-4799-ac94-3bdd2bc49e6b", "metadata": { "tags": [] }, "outputs": [], "source": [ "grating_1800, grating_600 = spe.gratings\n", "slit_entrance, slit_exit = spe.slits\n", "mirror, = spe.mirrors" ] }, { "cell_type": "markdown", "id": "a71d6ef2-8f11-40bb-8e47-e2abfa3972e1", "metadata": { "tags": [] }, "source": [ "The main parameter each channel has is `position`. For `SlitChannel`s, there is also `width`, which should be preferred since it represents the actual opening width of the slit instead of the position of the stepper motor. To initialize the motors, meaning\n", "\n", "- move to zero order for gratings\n", "- completely close for slits\n", "\n", "call `init()`. Setting the position of a grating will turn the turret if the other grating was selected before:" ] }, { "cell_type": "code", "execution_count": null, "id": "f65466e7-869c-4ffc-9650-f43bd747cb1e", "metadata": {}, "outputs": [], "source": [ "grating_1800.position(600e3) # pm!\n", "grating_600.position(600e3) # will turn the turret by 180 degrees + X." ] }, { "cell_type": "code", "execution_count": 5, "id": "0798cf6b", "metadata": { "tags": [] }, "outputs": [], "source": [ "spe.close()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.13" }, "nbsphinx": { "execute": "never" }, "toc-autonumbering": true, "toc-showcode": false, "toc-showmarkdowntxt": true, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }