LCRControllerCode/README.md
2024-11-13 12:52:00 +01:00

34 lines
2.7 KiB
Markdown

# Thorlabs K-Cube Liquid Crystal Controller (KLC101) Code
This code is implemented to rotate the Liquid Crystal Retarder.
## How to use the script
The user of the script must enter the given start- and end voltages, as well as the voltage resolution (controller voltage resolution is 1 mV!), which are located at the bottom of the script. The variable names are:
- `start_voltage`
- `end_voltage`
- `voltage_stepsize`
In the next step, enter the name of the file, under the variable `experiment_settings`. The main functionality to perform the rotation script is located in the `LCR_scan_func`, for which there are additional input parameters to modify measurement: `reversescan_bool` allows the user to perform the rotation in the opposite direction, and is set to `False` on default. `zerowhenfin_bool` sets the voltage of preset 1 (V1, as called in the SDK from Thorlabs) to 0 V **and** disables the output of the device, and is set to `True` per defaut. `loopscan_bool` allows for a measurement series starting voltage -> final voltage -> starting voltage loop, and is set to `False` per default. These parameters and editable in the function head, right at th bottom of the script.
**IMPORTANT:** Ensure that the saved data path in the LightField experiment settings (the pop-up GUI from LightField) is the path to the **temporary dump folder in the code**!
## Notes/ Possible Issues
1. For the code to work, change the directory to load the KLCCommandLib_x64.dll file, located in 'KLCCommandLib64.py', line 5, to your specific directory, in which the .dll file is stored.
The line of code is as follows:
`klcLib=cdll.LoadLibrary(r"C:\Users\rtan\Documents\RyanWork2024\Dasha-LCR_Code\Thorlabs_KLC_PythonSDK\"KLCCommandLib_x64.dll")`
2. Another issue is then importing the other needed folders, probably have to have all the required files in the same scan
script folder on the offline computer. (This is probably resolved in the newer version of the code.)
3. Input of negative voltage values could cause a problem => TODO: Test with Dasha!!!
## Standing Issues/Planned Updates
- Possibly will change the file path for `KLCCommandLib_x64.dll` in `KLCCommandLib64.py` to that of the file in the programm files, under the C++ SDK folder.
- Older version of code saved the files the name `VOLTAGE_VALUE + T`, changed T -> V for voltage.
- (Optional) might modify the folder path argument of `LCR_scan_func` to include the absolute path of the saving folder directory **and** temporary dump folder path, this is to be discussed with Dasha later on.
- Further modification/ implementation with the Ophir powermeter, TBD.
- Added functionality: saved list of voltages to a separate `.txt` data in the same folder directory. TODO: TEST IF IT WORKS AS INTENDED