diff --git a/source/Contribute.rst b/source/Contribute.rst
index 3666688..62facfd 100644
--- a/source/Contribute.rst
+++ b/source/Contribute.rst
@@ -23,6 +23,13 @@ We look forward to seeing your contributions and helping to improve **PhysioLab\
Run from source
*********************
+.. raw :: html
+
+
+
+
+
+
To get started with PhysioLab\ :sup:`XR` development, you will want to run the app from source. The following section will
guide you through the process of running the app from source.
diff --git a/source/WearableSensingDSI24.rst b/source/WearableSensingDSI24.rst
index 304e365..1909f89 100644
--- a/source/WearableSensingDSI24.rst
+++ b/source/WearableSensingDSI24.rst
@@ -1,228 +1,84 @@
.. _Wearable Sensing Stream:
-##################################################
+############################################
Stream data from Wearable Sensing's DSI-24
-##################################################
+############################################
This tutorial will demonstrate how to connect the DSI-24 to your computer and PhysioLab\ :sup:`XR`.
The `DSI-24 `_ is `Wearable Sensing's `_ dry electrode EEG system.
-This tutorial will be primarily focused on the Windows platform
+This tutorial will be primarily focused on the Windows platform.
+This tutorial currently only works with the latest stable developmental version of PhysioLabXR. If you would like to know how to download the latest stable version of PhysioLabXR, you can check that out
+`Here `_.
-1. Turn on the `DSI-24 `_.
-2. Go to Device Manager.
+.. raw :: html
-3. Expand the Bluetooth section.
+
+
+
-4. Disable Intel(R) Wireless Bluetooth(R) or whatever is your default Bluetooth driver.
+If you would like to be more hands on and work with the data from DSI-24 as well as implement other functions from the DSI-24 you can check out `this `_.
-.. figure:: media/WearableSensing_BluetoothDisable.gif
- :width: 800
- :align: center
- :alt: Turning off native Bluetooth
+1. Ensure you have the batteries installed the DIS-24.
-5. Plug in the Bluetooth adapter provided by `Wearable Sensing's `_.
+2. Turn on the `DSI-24 `_ by double clicking on the power button.
-6. Go to Bluetooth settings.
+3. Go to Device Manager on your computer.
-7. Scroll down to device settings.
+4. Expand the Bluetooth section.
-8. Turn the Bluetooth devices discovery setting from Default to Advanced. (If you are on Windows 10, this step can be ignored).
+5. Disable Intel(R) Wireless Bluetooth(R) or your default Bluetooth driver (You can reenable at anytime, however if left enabled the DSI-24 will not work correctly).
-5. Plug in the Bluetooth adapter provided by Wearable Sensing
+6. Plug in the Bluetooth adapter provided by `Wearable Sensing's `_ to any USB port.
-6. Go to Bluetooth settings
+7. Go to Bluetooth settings.
-7. Scroll down to device settings
+8. Scroll down to device settings.
-8. Turn the Bluetooth devices discovery setting from Default to Advanced. (If you are on Windows 10, this step can be ignored)
+9. Turn the Bluetooth devices discovery setting from Default to Advanced. (If you are on Windows 10, this step can be ignored).
-.. figure:: media/WearableSensing_BluetoothDeviceDiscovery.gif
- :width: 800
- :align: center
- :alt: Turning on Bluetooth Device Discovery
+10. Plug in the Bluetooth adapter provided by Wearable Sensing.
+11. Go to Bluetooth settings.
-9. Connect the `DSI-24 `_ to your device as if you would connect a mouse or headphones. (Should be named DSI24-{*serial number*}).
+12. Scroll down to device settings.
-10. Go back to Bluetooth Settings.
+13. Turn the Bluetooth devices discovery setting from Default to Advanced. (If you are on Windows 10, this step can be ignored).z
-11. Scroll down to more Related Settings.
+14. Connect the `DSI-24 `_ to your device as if you would connect a mouse or headphones. (Should be named DSI24-{*serial number*}).
-12. Click on more Bluetooth Settings.
+15. Go back to Bluetooth Settings.
-13. Click on COM Ports and make note of the COM port number that has the name: DSI24-{*serial number*} "Bluetooth Serial Port".
+16. Scroll down to more Related Settings.
-14. Connect the DSI-24 to your device as if you would connect a mouse or headphones. (Should be named DSI24-{*serial number*})
+17. Click on more Bluetooth Settings.
-15. Go back to Bluetooth Settings
+18. Click on COM Ports and make note of the COM port number that has the name: DSI24-{*serial number*} "Bluetooth Serial Port".
-16. Scroll down to more Related Settings
+19. Connect the DSI-24 to your device as if you would connect a mouse or headphones. (Should be named DSI24-{*serial number*}). It may state that the device isn't connected, this is *normal*.
-17. Click on more Bluetooth Settings
+20. Go back to Bluetooth Settings.
-18. Click on COM Ports and make note of the COM port number that has the name: DSI24-{*serial number*} "Bluetooth Serial Port"
+21. Scroll down to more Related Settings.
-.. figure:: media/WearableSensing_BluetoothCOMPort.gif
- :width: 800
- :align: center
- :alt: Finding the COM Port
+22. Click on more Bluetooth Settings.
-19. Open PhysioLab\ :sup:`XR`.
+23. Click on COM Ports and make note of the COM port number that has the name: DSI24-{*serial number*} "Bluetooth Serial Port".
-20. Go to `Script Tab `_.
+24. Now we can open PhysioLabXR.
-21. Click *Locate* and find the WearableSensingScript.py.
-
-The script can be downloaded from `WearableSensingScript.py `_.
-
-.. code-block:: python
-
- from pylsl import local_clock
- from physiolabxr.scripting.RenaScript import RenaScript
- from physiolabxr.thirdparty.WearableSensing.DSI_py3 import *
- import numpy as np
- import sys
- from physiolabxr.utils.buffers import DataBuffer
+25. In the Stream input line, you can type out "DSI24". This should open up the DSI-24 interface where the EEG data will be displayed as well an options window
+where you can input the COM Port as well as whether or not you would like to test the impedance of the electrodes to make sure they are the correct fit. If the options window
+does not show you can click on the far right button to open it.
- #Creating a data buffer with the DataBuffer class
- data_buffer = DataBuffer()
+26. Once you have configured your options all you have to do is press the green play button on the bottom of the main window. By right clicking on the graph in the main window you can decide on how you want the data to be displayed.
+There are also filters you can choose to add to the data by clicking on the blue button that is the second button from the bottom.
- is_first_time = True
- time_offset = 0 # time offset for the first packet to the local_clock()
- @SampleCallback
- def ExampleSampleCallback_Signals(headsetPtr, packetTime, userData):
- #This is the function that will be called every time a new packet is received
- global data_buffer
- global is_first_time
- global time_offset
-
- #Grab the headset by using a pointer
- h = Headset(headsetPtr)
- #Get the signal from each channel and format it so that it can be created into an array
- new_data = np.array(['%+08.2f' % (ch.GetSignal()) for ch in h.Channels()])
- #Reshapes the array into a 24x1 array so that it can be inputted into the data_buffer
- new_data = new_data.reshape(24,1)
- #Rearrange new_data to fit with desired output format
- new_data = new_data[[9, 10, 3, 2, 4, 17, 18, 7, 1, 5, 11, 22, 12, 21, 8, 0, 6, 13, 14, 20, 23, 19, 15, 16], :]
- #Get the time of the packet as a temporary solution to timestamps
- if is_first_time:
- time_offset = local_clock() - float(packetTime)
- is_first_time = False
-
- t = [float(packetTime) + time_offset]
- if new_data.shape[1] != len(t):
- print('Data and timestamp mismatch')
- print(new_data.shape)
- print(len(t))
-
- #Create a dictionary with the stream name, data, and timestamps
- new_data_dict = {
- 'stream_name': 'DSI-24',
- 'frames': new_data,
- 'timestamps': t
- }
- #Update the data buffer with the new data
- data_buffer.update_buffer(new_data_dict)
- class DSI24(RenaScript):
- def __init__(self, *args, **kwargs):
- """
- Please do not edit this function
- """
- super().__init__(*args, **kwargs)
-
- def init(self, arg = ''):
- #Create a headset object
- self.headset = Headset()
- #Set the message callback to ExampleMessageCallback
- self.headset.SetMessageCallback(ExampleMessageCallback)
- #Retrieves the command line arguments
- args = getattr(sys, 'argv', [''])
- #Set the default port to the first command line argument based on the parameter provided by user
- default_port = self.params['COM Port']
- #Connect the headset
- self.headset.Connect(default_port)
- #Start the data acquisition based on the parameter provided by user
- if arg.lower().startswith('imp'):
- #Currently not used
- self.headset.SetSampleCallback(ExampleSampleCallback_Impedances, 0)
- self.headset.StartImpedanceDriver()
- else:
- #Set the sample callback to ExampleSampleCallback_Signals
- self.headset.SetSampleCallback(ExampleSampleCallback_Signals, 0)
- if len(arg.strip()): self.headset.SetDefaultReference(arg, True)
- #Start the data acquisition
- self.headset.StartBackgroundAcquisition()
-
-
- def loop(self):
- #Called every loop based on the user's chosen frequency
- global data_buffer
- #If the data buffer has data, then set the output to the data buffer
- if len(data_buffer.keys()) > 0:
- self.set_output(stream_name = 'DSI-24', data = data_buffer.get_data('DSI-24'), timestamp = data_buffer.get_timestamps('DSI-24'))
- #Clear the data buffer
- data_buffer.clear_stream_buffer_data('DSI-24')
-
- def cleanup(self):
- #Called when the script is stopped
- global data_buffer
- global is_first_time
- global time_offset
- #Stop the data acquisition
- self.headset.StopBackgroundAcquisition()
- #Disconnect the headset
- time_offset = 0
- is_first_time = True
- self.headset.Disconnect()
- data_buffer.clear_buffer()
-
-22. *Add* an output and name it "DSI-24".
-
-23. Change the number of channels to 24.
-
-24. *Add* a **Parameter Widget** to the script by clicking on the + sign.
-
-25. Change the name of the parameter to *COM Port* and switch the type of input to "str" so that we can input the COM port.
-
-26. Input the name of the COM port that you noted earlier. This will allow for PhysioLabXR to connect to the DSI-24.
-
-27. Press *Run*.
-
-.. figure:: media/WearableSensing_Scripting.gif
- :width: 800
- :align: center
- :alt: Running in PhysioLabXR
-
-Now the data stream is available as an LSL stream named DSI-24.
-
-28. To view the data stream, go to the **Stream Tab**.
-
-29. Input *DSI-24* in the Add Stream box and press the *Add Widget* button.
-
-30. Click the *Start Button* to start data stream.
-
-It is recommended that you change some of the settings for your stream. You can follow the steps `here `_ to change the settings.
-For this tutorial, we added a Butterworth High Pass Filter with a cutoff frequency of 0.01 Hz, Nominal Sampling Rate of 250 and Group Channels Constant Offset to 50 by first pressing on the Gear icon and then on the top Default Group name.
-
-.. figure:: media/WearableSensing_Stream.gif
- :width: 800
- :align: center
- :alt: Viewing the stream on the Stream Tab
-
-31. To see the FFT of the signals from the `DSI-24 `_ right-click on the stream and select *FFT*.
-
-.. figure:: media/WearableSensing_FFT.gif
- :width: 800
- :align: center
- :alt: Showing FFT of data stream
+**Note** Occasionally it may say that it cannot connect to the port, you should retry to connect by stopping the program with the red button on the bottom and rerunning it. If that does not work,
+we recommend you reconnect the device by disconnecting it in the settings and reconnecting.
Now that you have the data streaming: check out these docs:
- :ref: `How to save the data `_
- :ref: `How to run a classification model on the data `_
- :ref: `Need help connecting the DSI-24 with Varjo's XR-3? `_
-
-
-
-
diff --git a/source/WearableSensingDSI24Script.rst b/source/WearableSensingDSI24Script.rst
new file mode 100644
index 0000000..564ce7f
--- /dev/null
+++ b/source/WearableSensingDSI24Script.rst
@@ -0,0 +1,165 @@
+.. _Wearable Sensing Stream Old:
+
+######################################################
+Stream data from Wearable Sensing's DSI-24 Via Script
+######################################################
+
+1. Open PhysioLab\ :sup:`XR`.
+
+2. Go to `Script Tab `_.
+
+3. Click *Locate* and find the WearableSensingScript.py.
+
+The script can be downloaded from `WearableSensingScript.py `_.
+
+.. code-block:: python
+
+ from pylsl import local_clock
+ from physiolabxr.scripting.RenaScript import RenaScript
+ from physiolabxr.thirdparty.WearableSensing.DSI_py3 import *
+ import numpy as np
+ import sys
+ from physiolabxr.utils.buffers import DataBuffer
+
+ #Creating a data buffer with the DataBuffer class
+ data_buffer = DataBuffer()
+
+ is_first_time = True
+ time_offset = 0 # time offset for the first packet to the local_clock()
+ @SampleCallback
+ def example_sample_callback_signals(headsetPtr, packetTime, userData):
+ global is_first_time
+ global time_offset
+ global dsi24_data_socket
+
+ # This function is called when a new packet is received
+ h = Headset(headsetPtr)
+ new_data = np.array(['%+08.2f' % (ch.GetSignal()) for ch in h.Channels()])
+ new_data = new_data.reshape(24, 1)
+ new_data = new_data[[9, 10, 3, 2, 4, 17, 18, 7, 1, 5, 11, 22, 12, 21, 8, 0, 6, 13, 14, 20, 23, 19, 16, 15], :]
+
+ # Calculate the time offset on the first packet
+ if is_first_time:
+ time_offset = local_clock() - float(packetTime)
+ is_first_time = False
+
+ t = [float(packetTime) + time_offset]
+ if new_data.shape[1] != len(t):
+ print('Data and timestamp mismatch')
+ print(new_data.shape)
+ print(len(t))
+
+ #Create a dictionary with the stream name, data, and timestamps
+ new_data_dict = {
+ 'stream_name': 'DSI-24',
+ 'frames': new_data,
+ 'timestamps': t
+ }
+ #Update the data buffer with the new data
+ data_buffer.update_buffer(new_data_dict)
+ class DSI24(RenaScript):
+ def __init__(self, *args, **kwargs):
+ """
+ Please do not edit this function
+ """
+ super().__init__(*args, **kwargs)
+
+ def init(self, arg = ''):
+ #Create a headset object
+ self.headset = Headset()
+ #Set the message callback to ExampleMessageCallback
+ self.headset.SetMessageCallback(ExampleMessageCallback)
+ #Retrieves the command line arguments
+ args = getattr(sys, 'argv', [''])
+ #Set the default port to the first command line argument based on the parameter provided by user
+ default_port = self.params['COM Port']
+ #Connect the headset
+ self.headset.Connect(default_port)
+ #Start the data acquisition based on the parameter provided by user
+ if arg.lower().startswith('imp'):
+ #Currently not used
+ self.headset.SetSampleCallback(ExampleSampleCallback_Impedances, 0)
+ self.headset.StartImpedanceDriver()
+ else:
+ #Set the sample callback to ExampleSampleCallback_Signals
+ self.headset.SetSampleCallback(ExampleSampleCallback_Signals, 0)
+ if len(arg.strip()): self.headset.SetDefaultReference(arg, True)
+ #Start the data acquisition
+ self.headset.StartBackgroundAcquisition()
+
+
+ def loop(self):
+ #Called every loop based on the user's chosen frequency
+ global data_buffer
+ #If the data buffer has data, then set the output to the data buffer
+ if len(data_buffer.keys()) > 0:
+ self.set_output(stream_name = 'DSI-24', data = data_buffer.get_data('DSI-24'), timestamp = data_buffer.get_timestamps('DSI-24'))
+ #Clear the data buffer
+ data_buffer.clear_stream_buffer_data('DSI-24')
+
+ def cleanup(self):
+ #Called when the script is stopped
+ global data_buffer
+ global is_first_time
+ global time_offset
+ #Stop the data acquisition
+ self.headset.StopBackgroundAcquisition()
+ #Disconnect the headset
+ time_offset = 0
+ is_first_time = True
+ self.headset.Disconnect()
+ data_buffer.clear_buffer()
+
+4. *Add* an output and name it "DSI-24".
+
+5. Change the number of channels to 24.
+
+6. *Add* a **Parameter Widget** to the script by clicking on the + sign.
+
+7. Change the name of the parameter to *COM Port* and switch the type of input to "str" so that we can input the COM port.
+
+8. Input the name of the COM port that you noted earlier. This will allow for PhysioLabXR to connect to the DSI-24.
+
+9. Press *Run*.
+
+.. figure:: media/WearableSensing_Scripting.gif
+ :width: 800
+ :align: center
+ :alt: Running in PhysioLabXR
+
+Now the data stream is available as an LSL stream named DSI-24.
+
+10. To view the data stream, go to the **Stream Tab**.
+
+11. Input *DSI-24* in the Add Stream box and press the *Add Widget* button.
+
+12. Click the *Start Button* to start data stream.
+
+It is recommended that you change some of the settings for your stream. You can follow the steps `here `_ to change the settings.
+For this tutorial, we added a Butterworth High Pass Filter with a cutoff frequency of 0.01 Hz, Nominal Sampling Rate of 250 and Group Channels Constant Offset to 50 by first pressing on the Gear icon and then on the top Default Group name.
+
+.. figure:: media/WearableSensing_Stream.gif
+ :width: 800
+ :align: center
+ :alt: Viewing the stream on the Stream Tab
+
+13. To see the FFT of the signals from the `DSI-24 `_ right-click on the stream and select *FFT*.
+
+.. figure:: media/WearableSensing_FFT.gif
+ :width: 800
+ :align: center
+ :alt: Showing FFT of data stream
+
+**Note** A more updated/indepth version of this script can be found in this path:
+physiolabxr\interfaces\DeviceInterface\DSI24 which has 3 files to integrate the device to PhysioLabXR.
+
+
+Now that you have the data streaming: check out these docs:
+
+- :ref: `How to save the data `_
+- :ref: `How to run a classification model on the data `_
+- :ref: `Need help connecting the DSI-24 with Varjo's XR-3? `_
+
+
+
+
diff --git a/source/archive/DataStreamAPIArchive.rst b/source/archive/DataStreamAPIArchive.rst
index b40f107..de58053 100644
--- a/source/archive/DataStreamAPIArchive.rst
+++ b/source/archive/DataStreamAPIArchive.rst
@@ -178,7 +178,7 @@ Visualize LSL Data
Using LSL
-***********************
+*********
`LabStreamingLayer (LSL) `_
is a network protocol for streaming time series data, mostly used for physiological experiments.
@@ -299,7 +299,7 @@ You will see the data being plotted in line chart (:ref:`explore other visualiza
Using ZMQ
-***********************
+*********
`ZMQ `_ is a messaging library for exchanging data between applications. ZMQ has the following characteristics:
@@ -551,7 +551,7 @@ move your cursor to the lower left of the plot, click the *[A]* button that show
Write your data source using :ref:`Scripting Interface `
-********************************
+***************************************************************************
You can create your own data source using the :ref:`Scripting Interface ` in Physiolab\ :sup:`XR`.
:ref:`This section ` in Scripting gives detailed examples on how to write your own data source using the third party device driver API and the Physiolab\ :sup:`XR` scripting interface.
diff --git a/source/index.rst b/source/index.rst
index 500bace..9e23f12 100644
--- a/source/index.rst
+++ b/source/index.rst
@@ -1,4 +1,4 @@
-.. include:: .special.rst
+
PhysioLab\ :sup:`XR`
#####################################################
@@ -63,11 +63,25 @@ Download
Run the executable
------------------
+.. raw :: html
+
+
+
+
+
+
Get the latest executable of PhysioLab\ :sup:`XR` from the `release page `_, that supports **Windows**, **MacOS**, and **Linux**.
Install with pip
----------------
+.. raw :: html
+
+
+
+
+
+
You can also install PhysioLab\ :sup:`XR` with pip, which will install the latest release version of PhysioLab\ :sup:`XR` and all its dependencies.
This is platform-independent and works on Windows, MacOS, and Linux.
@@ -79,12 +93,18 @@ If you are using pip, we recommend installing PhysioLab\ :sup:`XR` in a virtual
python -m venv physiolabxr-env
-Then activate the virtual environment:
+Then activate the virtual environment: (If your OS is Linux or OSX (Apple))
.. code-block:: bash
source physiolabxr-env/bin/activate
+(If your OS is Windows)
+
+.. code-block:: bash
+
+ physiolabxr-env/Scripts/activate
+
Install PhysioLab\ :sup:`XR` with:
.. code-block:: bash