How to set up NDS2
First, go [https://www.lsc-group.phys.uwm.edu/daswg/wiki/NetworkDataServer2 here] and download the latest source tarball (nds2-client-x.x.x.tar). Then, open terminal, go to the directory where you downloaded it and type:
tar -xvf nds2-client-0.6.6 cd nds2-client-0.6.6 ./configure --prefix=<directory where you want NDS2 installed> (you may need to chmod to run this) make make install
NOTE: if you have macports, then you can have it do all the compiling and installation for you, (i.e. port install nds2-client-x.x.x.tar). I have not tried this, but it should work. If it fails, the above method is still very fast.
You will need to authenticate yourself with kerberos. Unless you already use this for something else, place [https://wiki.ligo.org/foswiki/pub/AuthProject/LIGOKerberos5Configuration/krb5.conf this file] in your /etc directory. Then go back to the terminal and type:
kinit albert.einstein (but use your own name, you hack)
It should prompt you for your LIGO.ORG password. If you are doing this on a GC machine, it should have kerberos configured already, so just type the kinit command and enter your password.
Now, open MATLAB, got to File -> Set Path... and "Add with subfolders..." <directory where you want NDS2 installed>. You actually only need <dir...>/lib, <dir...>/lib/matlab[your-version], and <dir...>/share/matlab, but it's easier just to add the whole thing.
The useful function is NDS2_GetData (note that this isn't a link; moinmoin just goes crazy for camelcase). Its syntax is
out = NDS2_GetData( {'CHANNEL_NAME'} , start_time , duration , 'SERVER_NAME:PORT' )
Note that the channel name has to be a cell (i.e. use {' '}). If you have ligotools, run mdv_config so that gps() works and you can use it for the start_time argument. Duration is in seconds as usual. Use this server: ldas-pcdev1.ligo.caltech.edu:31200. You should be all set. Note that the generated out.data will be single precision, whereas most of the stuff you want to put it through will want double, so just
out.data = double(out.data);
and you can do what you like.
