-
Notifications
You must be signed in to change notification settings - Fork 2
Configuring Labrad Nodes
- Set environment variables for Labrad. Note: You may have to restart the computer for these changes to take effect.
LABRADNODE = yesr1 (for this example)
LABRADHOST = yecookiemonster.colorado.edu
LABRADPASSWORD = usual with ! at end
LABRAD_TLS = off
-
Install pylabrad on yesr1: pip install pylabrad
-
Clone the labrad_tools repo (on desktop of yesr1)
-
Add to python path: C:\users\Desktop\labrad_tools
-
For yesr1 we need the right version of pyserial (ver 2.7) for serial server: pip install pyserial==2.7
-
go to labrad_tools/batch -> start_servers.bat. This will start the labrad node on yesr1.
-
Configure Labrad node through pylabrad connection in ipython:
#Establish labrad connection
import labrad
cxn = labrad.connect()
#Go to yesr1 Node
r = cxn.registry
r.cd('Nodes')
r.cd('yesr1")
#Add labrad_tools to 'directories' so it can see the server code
r.set('directories', ['C:\Users\srgang\Desktop\labrad_tools'])
cxn.node_yesr1.refresh_servers()
#List available servers (to double-check that it worked)
cxn.node_yesr1.available_servers()
#Add any servers that we want to run automatically: In this case the SerialServer hardware interface server
cxn.node_yesr1.autostart_add('serial')
#Call the autostart function if you want to run the server right now
cxn.node_yesr1.autostart()
Now the serial server will start automatically in the future when we execute the batch file in step 6.
- Go to systemd folder in labrad_tools and copy to system file directory:
cp -r labrad-node.service* /etc/systemd/system/
- Edit the /etc/systemd/system/labrad-node.service.d/labrad-node.conf file to define environment variables
LABRADNODE = yeelmo (for this example)
LABRADHOST = yecookiemonster.colorado.edu
LABRADPASSWORD = usual with ! at end
LABRAD_TLS = off
-
If necessary edit /etc/systemd/system/labrad-node.service with the correct user, group name, and path to labrad-tools folder.
-
Start the labrad node: sudo systemctl start labrad-node
-
Enable automatic starting of labrad node: sudo systemctl enable labrad-node
-
Copy the labrad-node-journal script into labrad_tools/systemd/ folder (I will add this to the Sr1 Git Repo)
-
Launch the labrad-node-journal to print info from the labrad node.
-
add the following to ~/.bashrc
export LABRADNODE = yeelmo
export LABRADHOST = yecookiemonster.colorado.edu
export LABRADPASSWORD = usual with ! at end
export LABRAD_TLS = off
export PYTHONPATH=$PYTHONPATH:/path/to/labrad-tools/
-
Configure Node through pylabrad (see step 7 in windows example)
-
The commands at bootup will be executed as root, so the root account needs access to the environment variables we've defined. Add the following to /etc/sudoers:
Defaults env_reset
Defaults env_keep += "PYTHONPATH LABRADHOST LABRADNODE LABRADPASSWORD LABRAD_TLS$
You must use the visudo command to edit your sudoers file.