Skip to content

Commit

Permalink
fix images issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dungscout96 committed Jul 15, 2024
1 parent 726b8a5 commit 69dbd49
Show file tree
Hide file tree
Showing 86 changed files with 112 additions and 129 deletions.
34 changes: 0 additions & 34 deletions code/plugins/README_plugin.py

This file was deleted.

63 changes: 0 additions & 63 deletions code/plugins/Wiki_plugin.py

This file was deleted.

97 changes: 97 additions & 0 deletions code/plugins/reformat_plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import os
import sys
import shutil

# open a text file ending with .md and append a paragraph to it
def reformat_plugin(dirpath, plugin_name):
plugins_dir = '/Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins'
index_file = os.path.join(plugins_dir, 'index.md')
shutil.copyfile(os.path.join(dirpath, 'README.md'), index_file)
with open(index_file) as f:
text = f.read()
append_text = '''---
layout: default
title: {plugin_name}
long_title: {plugin_name}
parent: Plugins
---
'''.format(plugin_name=plugin_name)
text = append_text + text
with open(index_file, 'w') as out:
out.write(text)

# open a text file ending with .md and append a paragraph to it
# Usage: python test.py <filename>.md
def append_to_file(filepath, filename, parent, output_file):
with open(filepath) as f:
text = f.read()
append_text = '''---
layout: default
title: {filename}
long_title: {filename}
parent: {parent}
grand_parent: Plugins
---
'''.format(filename=filename, parent=parent)
text = append_text + text
with open(output_file, 'w') as out:
out.write(text)

def reformat_plugin_dir(plugin_input_dir, plugin_name, plugin_type='wiki'):
# plugins_output_dir = '/Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins'
plugin_output_dir = os.path.join('/Users/dtyoung/Documents/EEGLAB/sccn.github.io/plugins', plugin_name)
if not os.path.exists(plugin_output_dir):
os.makedirs(plugin_output_dir)
# copy image directory from input to output dir
if os.path.exists(os.path.join(plugin_input_dir, 'images')):
shutil.copytree(os.path.join(plugin_input_dir, 'images'), os.path.join(plugin_output_dir, 'images'), dirs_exist_ok=True)

index_file = os.path.join(plugin_output_dir, 'index.md')
if plugin_type == 'wiki':
shutil.copyfile(os.path.join(plugin_input_dir, 'Home.md'), index_file)
with open(index_file) as f:
text = f.read()
append_text = '''---
layout: default
title: {plugin_name}
long_title: {plugin_name}
parent: Plugins
categories: plugins
has_children: true
---
'''.format(plugin_name=plugin_name)
text = append_text + text
with open(index_file, 'w') as out:
out.write(text)

for root, dirs, files in os.walk(plugin_input_dir):
for file in files:
if file.endswith('.md') and not file.startswith('index') and not file.startswith('Home'):
append_to_file(os.path.join(plugin_input_dir, file), file.strip('.md'), plugin_name, os.path.join(plugin_output_dir, file))
else:
shutil.copyfile(os.path.join(plugin_input_dir, 'README.md'), index_file)
with open(index_file) as f:
text = f.read()
append_text = '''---
layout: default
title: {plugin_name}
long_title: {plugin_name}
parent: Plugins
---
'''.format(plugin_name=plugin_name)
text = append_text + text
with open(index_file, 'w') as out:
out.write(text)

# main
def main():
if len(sys.argv) != 4:
print('Usage: python test.py <plugin_dir_path> <plugin_name> <plugin_type>')
sys.exit(1)
dirpath = sys.argv[1]
plugin_name = sys.argv[2]
plugin_type = sys.argv[3]
reformat_plugin_dir(dirpath, plugin_name, plugin_type)

if __name__ == "__main__":
main()
16 changes: 8 additions & 8 deletions code/plugins/update_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def run_command(command):
print(f"Command failed: {command}\nError: {result.stderr}")
return result

def update_repo(repo, script, type='readme'):
def update_repo(repo, script, plugin_type='readme'):
print(f"Updating {repo}...")
current_dir = os.getcwd()
repo_path = os.path.join(current_dir, 'github', repo)
Expand All @@ -16,22 +16,22 @@ def update_repo(repo, script, type='readme'):
os.chdir(repo_path)
run_command('git pull')
else:
if type == "wiki":
if plugin_type == "wiki":
run_command(f'git clone https://github.com/sccn/{repo}.wiki.git {repo_path}')
else:
run_command(f'git clone https://github.com/sccn/{repo}.git {repo_path}')

os.chdir(current_dir)
run_command(f'python {script} {repo_path} {repo}')
run_command(f'python {script} {repo_path} {repo} {plugin_type}')

if __name__ == "__main__":
# if 'github' not in current directory, create it
if not os.path.exists('github'):
os.makedirs('github')

wiki_plugins = ['SIFT', 'get_chanlocs', 'NFT', 'PACT', 'nsgportal', 'clean_rawdata']
for plugin in wiki_plugins:
update_repo(plugin, "Wiki_plugin.py", 'wiki')
readme_plugins = ['roiconnect', 'EEG-BIDS', 'trimOutlier', 'groupSIFT', 'nwbio', 'ICLabel', 'dipfit', 'eegstats', 'PowPowCAT', 'PACTools', 'zapline-plus', 'amica', 'fMRIb', 'relica', 'std_dipoleDensity', 'imat', 'viewprops', 'cleanline', 'ARfitStudio ', 'NIMA', 'firfilt']
# wiki_plugins = ['SIFT', 'get_chanlocs', 'NFT', 'PACT', 'nsgportal', 'clean_rawdata']
# for plugin in wiki_plugins:
# update_repo(plugin, "reformat_plugin.py", 'wiki')
readme_plugins = ['ARfitStudio'] #, 'roiconnect', 'EEG-BIDS', 'trimOutlier', 'groupSIFT', 'nwbio', 'ICLabel', 'dipfit', 'eegstats', 'PowPowCAT', 'PACTools', 'zapline-plus', 'amica', 'fMRIb', 'relica', 'std_dipoleDensity', 'imat', 'viewprops', 'cleanline','NIMA', 'firfilt']
for plugin in readme_plugins:
update_repo(plugin, "README_plugin.py")
update_repo(plugin, "reformat_plugin.py", "readme")
Binary file added plugins/ARfitStudio/images/Onchannels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/ARfitStudio/images/Onics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added plugins/NIMA/images/Alphacomparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/NIMA/images/Blob_from2to7mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/NIMA/images/Dipfitcomparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/NIMA/images/Nimafigure01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/NIMA/images/P159_separatealpha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/NIMA/images/Voxels_from2to7mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/NIMA/images/Voxels_fwhm8to28mm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
Binary file added plugins/PowPowCAT/images/Continuous_pearson.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Continuous_spearman.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Defaultgui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Epoched_pearson.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Epoched_spearman.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Ic6vs8_redone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file added plugins/PowPowCAT/images/PowPowCAT_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Powpowcatfigure2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Powpowcatfigure5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Powpowcatfigure7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Scalptopos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/Stern125_scalptopos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/PowPowCAT/images/shot1.png
Binary file added plugins/PowPowCAT/images/shot2.png
Binary file added plugins/PowPowCAT/images/shot3.png
Binary file added plugins/PowPowCAT/images/shot4.png
Binary file added plugins/PowPowCAT/images/shot5.png
Binary file added plugins/PowPowCAT/images/shot6.png
Binary file added plugins/PowPowCAT/images/shot7.png
Binary file added plugins/PowPowCAT/images/shot8.png
File renamed without changes.
7 changes: 3 additions & 4 deletions plugins/SIFT/Chapter-1.-Downloads.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ grand_parent: Plugins

SIFT releases can be downloaded below

| You can install SIFT using the [EEGLAB Extension Manager](https://eeglab.org/others/EEGLAB_Extensions.html) (see also section 5.1). |
|------------------------------------------------------------------------------------------------------------------------|
You can install SIFT using the [EEGLAB Extension Manager](https://eeglab.org/others/EEGLAB_Extensions.html) (see also section 5.1).

<table>
<tbody>
Expand All @@ -20,7 +19,7 @@ SIFT releases can be downloaded below
</tr>
<tr class="odd">
<td><p><img src="images/Dlpdf.jpeg"></p></td>
<td><p>70-page <a href="https://sccn.ucsd.edu/githubwiki/files/sift_manual_0.1a.pdf" title="wikilink">SIFT manual</a>. It gives both SIFT methods theory and a practical guide to using SIFT using downloadable sample data (some of the content in the PDF document is outdated, and this wiki is more up-to-date).
<td><p>70-page <a href="https://sccn.ucsd.edu/githubwiki/files/sift_manual_0.1a.pdf" title="wikilink">SIFT manual</a>. It gives both SIFT methods theory and a practical guide to using SIFT using downloadable sample data (some of the content in the PDF document is outdated, and this wiki is more up-to-date).</p></td>
</tr>
<tr class="even">
<td><p><img src="images/Dlpdf.jpeg"></p></td>
Expand All @@ -29,7 +28,7 @@ SIFT releases can be downloaded below
<tr class="even">
<td><p><img src="images/Dlpdf.jpeg"></p></td>
<td><p>A short video lecture on the (very) basic theory and application of SIFT to modeling distributed brain dynamics in EEG is available
<a href="https://www.youtube.com/watch?v=6_WW6EMHmWo&list=PLXc9qfVbMMN2xFa3w5ceJB52Dx-3Sgg2Z&index=12l">here</a>. A longer video is available <a href="https://youtu.be/NO3hbYlqNF0">here</a>. </td>
<a href="https://www.youtube.com/watch?v=6_WW6EMHmWo&list=PLXc9qfVbMMN2xFa3w5ceJB52Dx-3Sgg2Z&index=12l">here</a>. A longer video is available <a href="https://youtu.be/NO3hbYlqNF0">here</a>.</p></td>
</tr>
</tbody>
</table>
Expand Down
4 changes: 2 additions & 2 deletions plugins/SIFT/Chapter-5.1.-SIFT-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Folder**)
model-fitting algorithm. You must manually install
as follows: Download the free ARfit package from
<https://climate-dynamics.org/software/#arfit>. After downloading and
unzipping the ARfit package, place the **`/arfit/`** folder in
**<SIFT-path>`/external/`** where **<SIFT-path>** is the full path to
unzipping the ARfit package, place the **/arfit/** folder in
**SIFT-path/external/** where **SIFT-path** is the full path to
the SIFT root directory.

6\) Once the EEGLAB main GUI is visible, you are good to go! You will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ options set. From the EEGLAB menu select **File > Memory and other options**. Ma

Now let’s load our sample datasets in EEGLAB. We will first load the
*RespWrong.set* file and then *RespCorr.set* located in the
**<SIFT-path>`/Data/`** folder (click on [Chapter 1. Downloads](Chapter-1.-Downloads) to download the data).
**SIFT-path/Data/** folder (click on [Chapter 1. Downloads](Chapter-1.-Downloads) to download the data).

![Image:images/SIFTfig5.jpg](images/SIFTfig5.jpg )

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion plugins/dipfit.md → plugins/dipfit/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A major obstacle to using EEG data to visualize macroscopic brain dynamics is th

Documentation
====
For documentation see https://eeglab.org/tutorials/09_source/DIPFIT.html
For documentation see [https://eeglab.org/tutorials/09_source/DIPFIT.html](https://eeglab.org/tutorials/09_source/DIPFIT.html)

Version history
=====
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added plugins/groupSIFT/images/Groupsift1.jpg
Binary file added plugins/groupSIFT/images/Groupsift2.jpg
Binary file added plugins/groupSIFT/images/Mccon_gfwer2.png
File renamed without changes.
File renamed without changes.
16 changes: 0 additions & 16 deletions plugins/nsgportal.md

This file was deleted.

File renamed without changes.
Binary file added plugins/relica/images/relica_cluster1.jpg
Binary file added plugins/relica/images/relica_clusters.jpg
Binary file added plugins/relica/images/relica_gui1.jpg
Binary file added plugins/relica/images/relica_gui1_example1.jpg
Binary file added plugins/relica/images/relica_guiplot.jpg
Binary file added plugins/relica/images/relica_realicmaps.jpg
File renamed without changes.
File renamed without changes.
Binary file added plugins/std_dipoleDensity/images/Crosshair2.png
Binary file added plugins/std_dipoleDensity/images/Version0_40.png
File renamed without changes.
Binary file added plugins/trimOutlier/images/T02.png
Binary file added plugins/trimOutlier/images/T03.png
Binary file added plugins/trimOutlier/images/T04.png
Binary file added plugins/trimOutlier/images/T05.png
Binary file added plugins/trimOutlier/images/To1.png
Binary file added plugins/trimOutlier/images/additional.jpg
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 69dbd49

Please sign in to comment.