Skip to content

Commit

Permalink
single line paragraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronearlerichardson committed Feb 12, 2024
1 parent 4963a13 commit 327ef7d
Showing 1 changed file with 94 additions and 111 deletions.
205 changes: 94 additions & 111 deletions docs/GlobalLocal/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,111 +6,106 @@ ecog_preprocessing (Mat) → makeTrials_GL (Mat) → BIDS_coding (WSL)
Step 1: Download data files (Box)
---------------------------------

#. **Go to Box → ECoG_Task_Data → Cogan_Task_Data** and locate the
*Subject (D#) folder → Global Local task folder → All blocks*
subfolder
#. **Go to Box → ECoG_Task_Data → Cogan_Task_Data** and locate the *Subject (D#) folder → Global Local task folder → All blocks* subfolder

#. **Download** **all** **Box** **data files from “All Blocks”** folder
#. Then **Copy + Paste** files into **Local PC** folder in
**CoganLabNL** → **InUnit Preprocessing** → **Subject (D#) → Global
Local → All blocks**
#. **KEY**: locate the Excel csv file titled:
``GL_MainTask_Data_D#_taskdate``

#. Then **Copy + Paste** files into **Local PC** folder in **CoganLabNL** → **InUnit Preprocessing** → **Subject (D#) → Global Local → All blocks**

#. **KEY**: locate the Excel csv file titled: ``GL_MainTask_Data_D#_taskdate``

#. **RENAME this file to** ``Trials``

#. **EDF file**: *2 options - Download (local PC) or Box Drive (no download)*

#. **Download** : from **TaskUploadDir**
**Box → TaskUploadDir → Download** → move to same local PC Global Local folder (Only if you want to download!)
#. **Download** : from **TaskUploadDir Box → TaskUploadDir → Download** → move to same local PC Global Local folder (Only if you want to download!)

#. **Box Drive** : No download, will use Box Drive path in ``edf_filename``
variable instead of local PC path → **See Step 2!**
#. **Box Drive** : No download, will use Box Drive path in ``edf_filename`` variable instead of local PC path → **See Step 2!**

Step 2: ecog_preprocessing(Matlab)
----------------------------------
*general preprocessing script*

#. Once your files are downloaded and Trials is renamed, open Matlab
and run the **ecog_preprocessing** script *(used for all tasks preprocessing)*
#. Once your files are downloaded and Trials is renamed, open Matlab and run the **ecog_preprocessing** script *(used for all tasks preprocessing)*

#. Start the same as all other tasks → create a new ``Case`` for the
task (Global Local = **009** ),
task (Global Local = **009** )

#. Fill in all of the case variable information accordingly: **see differences!**

#. **KEY 1** - for **Global Local only**,
the ``ptb_trialInfo`` is commented out! → put a ``%``
(percentage sign) in front! This is because we do not need
to get trialInfo – it is replaced by the **Trials** excel sheet we
renamed in Step 1.
#. **KEY 2** - ``edf_filename`` variable (path) will
change depending on if you downloaded the EDF above from Box, or if
you are uploading it directly from Box Drive:
#. **KEY 1** - for **Global Local only**, the ``ptb_trialInfo`` is commented out! → put a ``%`` (percentage sign) in front! This is because we do not need to get trialInfo – it is replaced by the **Trials** excel sheet we renamed in Step 1.

#. **KEY 2** - ``edf_filename`` variable (path) will change depending on if you downloaded the EDF above from Box, or if you are uploading it directly from Box Drive:

#. **Downloaded EDF** path to InUnit Preprocessing (PC): ``C:\Users\ncl24\Desktop\CoganLabNL\InUnit Preprocessing\D81\Lexical Delay\D# DATE COGAN_TASKNAME.EDF``

#. **Box Drive EDF** path to TaskUploadDir (Box): ``C:\Users\ncl24\Box\CoganLab\ECoG_Task_Data\TaskUploadDir\D# DATE COGAN_TASKNAME.EDF``

#. Once all variables are filled out, **highlight + run (F9)** to load
into your workspace
#. Ignore the trialInfo section (don’t need trialInfo) → Go straight to
the **edfread + labels** section & run!
#. Once all variables are filled out, **highlight + run (F9)** to load into your workspace

#. Ignore the trialInfo section (don’t need trialInfo) → Go straight to the **edfread + labels** section & run!

#. This will read the EDF file to create your ``labels`` variable

#. Then, run the following **extract trigger + mic channel** section
#. This will create your ``trigger`` & ``mic`` variables, as well as
save them as ``trigger.mat`` & ``mic.mat`` files in your task
folder.
#. Finally, run the **.ieeg.dat + experiment** file section, that will
save the ``experiment.mat`` & ``.ieeg.dat`` files in your task
folder

#. This will create your ``trigger`` & ``mic`` variables, as well as save them as ``trigger.mat`` & ``mic.mat`` files in your task folder.

#. Finally, run the **.ieeg.dat + experiment** file section, that will save the ``experiment.mat`` & ``.ieeg.dat`` files in your task folder

#. As well as create the folders **mat** & **taskdate** *(e.g.**230807**)*

#. Move the **experiment** file into the **mat** folder

#. At the end of Step 5, the **Trials.mat** file will automatically save under the **taskdate (230807) → mat** folder on Box!

Step 3: MaketrigTimes (Matlab)
-------------------------------
*trigTimes + trigTimes_audioAligned files*

#. When you reach the **maketrigtimes** section, you will open the
``maketrigtimes.m`` script and run it in a separate window next to
ecog_preprocessing.
#. When you reach the **maketrigtimes** section, you will open the ``maketrigtimes.m`` script and run it in a separate window next to ecog_preprocessing.

#. *In order to run maketrigtimes successfully, you will need to have*:

#. The **trigger** variable already loaded in your workspace
* Should already be there if going straight from running ecog_preprocessing –
but if not, double-click on trigger saved in folder

* Should already be there if going straight from running ecog_preprocessing – but if not, double-click on trigger saved in folder

#. Already run ``edfread_fast``

* If not, go back and run this in ecog_preprocessing & make sure that your ``edf_filename`` variable (path
to EDF) from the case variables is loaded in your workspace before
doing so.
* If not, go back and run this in ecog_preprocessing & make sure that your ``edf_filename`` variable (path to EDF) from the case variables is loaded in your workspace before doing so.

#. Run the first section at the top to load the graph of the triggers

* **Uncomment the -triggers (negative) linefor Global Local!**

* Otherwise the graph will appear upside down
#. Then, proceed as usual and make the trigTimes adjustments you do for
all other tasks

#. Then, proceed as usual and make the trigTimes adjustments you do for all other tasks

#. **Global Local-specific Task Info** :

#. Total # triggers → **trigTimes** = **448**

#. **4 blocks** total, **112** triggers per block

#. *Rare cases could have 512 total trigs, 128 per block*

#. Seconds between triggers = **1.5**

#. Threshold (thresh) = **-1.25**

#. Bc graph is inverted / negative from the -triggers line!

#. If you need to delete excess triggers (first, last, random in
middle) run: ``trigTimes([1,2,3,etc.]) = []``
#. If you need to delete excess triggers (first, last, random in middle) run: ``trigTimes([1,2,3,etc.]) = []``

* *Fill in brackets with which specific trigger numbers you need to delete!*
#. Once ``trigTimes = 448``, run the final section to save
``trigTimes.mat`` file to your PC folder!
#. Finally, return to the **ecog_preprocessing** script tab and run the
section below, to align the audio to your saved trigTimes

* This will create the ``trigTimes_audioAligned.mat`` file and save it
into your PC folder
#. Once ``trigTimes = 448``, run the final section to save ``trigTimes.mat`` file to your PC folder!

#. Finally, return to the **ecog_preprocessing** script tab and run the section below, to align the audio to your saved trigTimes

* This will create the ``trigTimes_audioAligned.mat`` file and save it into your PC folder

Step 4: Upload Files + Copy EDF to Box D_Data
---------------------------------------------
Expand All @@ -120,67 +115,67 @@ Step 4: Upload Files + Copy EDF to Box D_Data
#. Critical because the **makeTrials_GL script pulls and uses files from Box only! (D_Data Global Local folder specifically)**

* So before running that script, all files must be uploaded there in order for it to work

#. Upload the files to D_Data in the exact same way as all other tasks! - only difference = Trials.csv instead of trialInfo

#. **Also! → Copy EDF file into D_Data folder from TaskUploadDir**

#. The edfread command in this program can only read EDFs / files from
the D_Data folder!!!
#. So you must Copy the EDF from TaskUploadDir into the D_Data folder
with the rest of the uploaded files!
#. The edfread command in this program can only read EDFs / files from the D_Data folder!!!

#. So you must Copy the EDF from TaskUploadDir into the D_Data folder with the rest of the uploaded files!

#. SEE BELOW - you must also change Path to EDF!!!

* Of ``edf_filename`` variable + ``edfread_fast(edf_filename)`` commands!

Step 5: makeTrials_GL (Matlab)
------------------------------
*Global Local only script to make Trials.mat*

#. Once all files have been uploaded to **Box → D_Data** folder, return
to Matlab and run the ``makeTrials_GL.m`` script in another separate
tab window → this script will output the final ``Trials.mat`` file
when finished!
#. Once all files have been uploaded to **Box → D_Data** folder, return to Matlab and run the ``makeTrials_GL.m`` script in another separate tab window → this script will output the final ``Trials.mat`` file when finished!

#. **STEPS TO RUN SUCCESSFULLY** *(also written on script!)*

* **Step 1** : **Copy EDF file into D_Data Box folder!** (from TaskUploadDir)

* **KEY** - Make sure EDF file is copied into the **D_Data** Subject Global Local folder on Box!

* **Step 2**: **Edit info** (specific to each subject) + **copy in command line to run each command below (A, B, C) ONE AT A TIME:**

* 2A) Command 1: change edf_filename variable
``edf_filename = ‘C:\Users\ncl24\Box\CoganLab\D_Data\GlobalLocal\D103\240110 COGAN_GLOBALLOCAL.EDF’;``

* 2B) Command 2: change h variable
* 2B) Command 2: change h variable
``h = edfread_fast(‘C:\Users\ncl24\Box\CoganLab\D_Data\GlobalLocal\D103\240110 COGAN_GLOBALLOCAL.EDF’);``

* 2C) Command 3: run makeTrials_GL function
``makeTrials_GL(‘D103’, ‘240110’)``

#. Must replace: (‘subject’, ‘taskdate’) 1. Replace **subject** with
**‘D#’** 2. Replace **date** with **‘taskdate’**
(e.g. **‘230807’)**
#. Must replace: (‘subject’, ‘taskdate’) 1. Replace **subject** with **‘D#’** 2. Replace **date** with **‘taskdate’** (e.g. **‘230807’)**

#. Final format: ``makeTrials_GL(‘D#’, ‘taskdate’)``

#. **Example** : D94

#. subject = ‘D94’

#. date = ‘230807’

#. ``makeTrials_GL(‘D94’, ‘230807’)``

#. You **MUST add the single ‘quotations’** around each of the real
variables that you enter, in order for them to be registered as
the values for those variables!
#. You **MUST add the single ‘quotations’** around each of the real variables that you enter, in order for them to be registered as the values for those variables!

* *Once 2C is finished running, you are done!*

* **Final output** = **Trials.mat** (when 2C is done ^)

#. **Trials.mat** file will automatically save under the **taskdate (e.g. 230807) → matfolder on**\ \*\* Box \****!*\*
#. **Trials.mat** file will automatically save under the **taskdate (e.g. 230807) → matfolder on Box**

#. Example path to locate Trials.mat file:

* Box -> CoganLab -> D_Data -> GlobalLocal -> D103 (subj) -> 240110
(taskdate) -> mat -> Trials.mat
* Box -> CoganLab -> D_Data -> GlobalLocal -> D103 (subj) -> 240110(taskdate) -> mat -> Trials.mat

* If you would like to save it in your local PC folder (InUnit
Preprocessing) as well, you can download the file from Box and copy
it there! – you don’t have to though.
* If you would like to save it in your local PC folder (InUnit Preprocessing) as well, you can download the file from Box and copy it there! – you don’t have to though.

Step 6: BIDS_coding (WSL → Visual Studio (VS) Code program)
----------------------------------------------------------
Expand All @@ -203,36 +198,28 @@ Step 6: BIDS_coding (WSL → Visual Studio (VS) Code program)
* Make sure you are in the right workspace, should look like this:

#. |image4|

#. Press **Enter**

#. If you encounter an **error message!**

#. *Message*:
|image8|

#. You will need to make sure all of your changes to **ALL scripts in the workspace**
(modified files will have an "**M**" next to them
in explorer left side bar) have been **COMMITTED** to Github
**before running** the next line, because they will be
**ERASED!!!**
#. You will need to make sure all of your changes to **ALL scripts in the workspace** (modified files will have an "**M**" next to them in explorer left side bar) have been **COMMITTED** to Github **before running** the next line, because they will be **ERASED!!!**

* *To commit changes to github*: type ``git push`` → ``git commit``

#. If your only changes are the variables of subject, task, etc. that
you make for specific subjects, then you don’t have to commit them –
**BUT** , make sure any files you have run for previous subjects
with the script are **SAVED TO BOX BEFORE RUNNING the next command**
, because they will be **overwritten!!!**
#. If your only changes are the variables of subject, task, etc. that you make for specific subjects, then you don’t have to commit them – **BUT** , make sure any files you have run for previous subjects with the script are **SAVED TO BOX BEFORE RUNNING the next command**, because they will be **overwritten!!!**

* To Save to Box:

* Drag **sub-D00XX** folder into **share** folder above Workspace
in WSL explorer → should be in **Share** folder on Desktop, then
copy into Box → **BIDS-1.1_GlobalLocal** folder
* Drag **sub-D00XX** folder into **share** folder above Workspace in WSL explorer → should be in **Share** folder on Desktop, then copy into Box → **BIDS-1.1_GlobalLocal** folder

#. Once all previous subject files have been saved to Box BIDS
Global Local folder, you will reset the script!
#. Once all previous subject files have been saved to Box BIDS Global Local folder, you will reset the script!

#. Type ``git reset --hard`` + Enter!

#. *Should look like this when idone*:
|image2|

Expand All @@ -250,27 +237,32 @@ Step 6: BIDS_coding (WSL → Visual Studio (VS) Code program)
task going forward)

* Use the exact same name as the D_Data folder!

#. **Final** : |image1|

#. **Line 16** : **Comment out (#) whole** **mapfile** **line!**

#. Don’t need for Global Local (will cause error)

#. **Final** : *see full line on script* |image0|

#. **Line 17** : Change **SUB_IDS=(D#)** D# to correct Subject D#’s!

#. Can run **multiple subjects at once** , or just **one**
#. If running multiple, separate by spaces only! No comma! → *see
example below:*

#. If running multiple, separate by spaces only! No comma! → *see example below:*

#. **Final** : |image5|

#. **Line 35** : **Comment out (#) the whole line 35!**

#. Global Local doesn’t have task stimuli, so don’t need this line
and it will cause an error if you keep it!
#. Global Local doesn’t have task stimuli, so don’t need this line and it will cause an error if you keep it!

#. **Final** : *see full line on script* |image6|

#. Only comment this out for Global Local or tasks that don’t have
task stimuli!

* For other future tasks that do, change the ``“sentence_rep”`` task
name in the middle of the command line (35) and insert the
correct task name to use proper task stimuli!
Expand All @@ -279,52 +271,43 @@ Step 6: BIDS_coding (WSL → Visual Studio (VS) Code program)

#. When all edits have been made to script & saved ( **ctrl + s** ), type ``conda activate BIDS_coding`` + Enter!

#. The conda activate command will change (base) at the start
of the command path to (BIDS_coding)
#. The conda activate command will change (base) at the start of the command path to (BIDS_coding)

* Once the new command line pops up below:

* Type ``cd BIDS_converter`` + Enter!

#. within BIDS_coding (adds it to end of path), which is where you can
now run the script to perform the BIDS conversion functions
#. within BIDS_coding (adds it to end of path), which is where you can now run the script to perform the BIDS conversion functions

* Once the next command line pops up below with /BIDS_converter at the
end: type ``./BIDS_convert_wsl.sh`` + Enter!
* Once the next command line pops up below with /BIDS_converter at the end: type ``./BIDS_convert_wsl.sh`` + Enter!

**STEPS 8, 9, 10 SHOULD LOOK LIKE THIS** : (in order top → bottom!)

|image7|

#. The script should then run for a few minutes (10-15 min)
after entering the last command to create all of the converted BIDS
files!
#. The script should then run for a few minutes (10-15 min) after entering the last command to create all of the converted BIDS files!

#. Final output will be on the left side bar (WSL Explorer)

#. Final output will be on the left side bar (WSL Explorer) 1. *To open
explorer*: click double paper icon at top left corner
* *To open explorer*: click double paper icon at top left corner

#. Under **ncl24 → Workspace → GlobalLocal → BIDS** 1. Locate the
**sub-D0XXX** folder!

#. i.e. sub-D0100 for Subject D100

#. |image9|

* This is where all of the finalized BIDS files will go!

#. Last step: move to **share** folder (on WSL)

* When it is finished creating BIDS files, in the left side bar with
workspaces, drag and drop this **sub-D00XX** output folder
containing the BIDS files into the " **share**" folder above
Workspace! (see top of pic above) 1. Then you will be able to access
it from **Share PC** folder on Desktop! → if not moved to share,
can’t access on Windows
* When it is finished creating BIDS files, in the left side bar with workspaces, drag and drop this **sub-D00XX** output folder containing the BIDS files into the " **share**" folder above Workspace! (see top of pic above) 1. Then you will be able to access it from **Share PC** folder on Desktop! → if not moved to share, can’t access on Windows

Final Step: Upload sub-D00XX on Share folder to Box BIDS-1.1_GlobalLocal
-------------------------------------------------------------------------

* Copy **sub-D00XX** with all finalized BIDS file outputs from
**Share** PCfolder into **Box → CoganLab → BIDS-1.1_GlobalLocal →
BIDS** folder!
* Copy **sub-D00XX** with all finalized BIDS file outputs from **Share** PCfolder into **Box → CoganLab → BIDS-1.1_GlobalLocal → BIDS** folder!

|image3|

Expand Down

0 comments on commit 327ef7d

Please sign in to comment.