Skip to content

Commit

Permalink
Adding pipelines for cli analysis (#202)
Browse files Browse the repository at this point in the history
* started pipelines function

* almost working simple function equivalents of nb scripts

* fix: fixed import (brainflow updated API)

* sqc fixes for unicorn (#176)

* Ignore pushes

* Trying to create a cli

* Stepping through the problem

* First commit

* Fixing pause in signal quality check

* Fixing Signal quality check problem

* fix the technical debt

* Save path done for automated saving pdf

* I feel amazing

* Almost through

* Update eegnb/cli/__main__.py

Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>

* Trying to create cli but it's being really painful

* Extra word cli error

* Changed example handling

* Pain

* Adding whole datapath

* Finally fixed cli

* hmm

* Looking good

* added hyperlink

* Having some issues with detecting css and image deltetion

* Just the css now

* Fixed the css linking problem though it's a weird soln

* Automated running, still fnames problem

* Hahahah embedded images in html

* Improving code

* Okay now

* Look at that

* Almost there just the two figures now

* Now

* Added attrdict to do with cli error

Co-authored-by: John Griffiths <j.davidgriffiths@gmail.com>
Co-authored-by: Erik Bjäreholt <erik@bjareho.lt>
Co-authored-by: John Griffiths <JohnGriffiths@users.noreply.github.com>
  • Loading branch information
4 people authored and oreHGA committed Aug 2, 2024
1 parent c0d4e97 commit 7ccf0fc
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
31 changes: 31 additions & 0 deletions eegnb/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,37 @@ def create_analysis_report(
experiment, eegdevice, subject, session, site, filepath = analysis_intro_prompt()
analysis_report(experiment, eegdevice, subject, session, site, filepath)

@main.command()
@click.option("-ex", "--experiment", help="Experiment to run")
@click.option("-ed", "--eegdevice", help="EEG device to use")
@click.option("-sub", "--subject", help="Subject ID")
@click.option("-sess", "--session", help="Session number")
@click.option("-fp", "--filepath", help="Filepath to save data")
@click.option(
"-ip", "--prompt", help="Use interactive prompt to ask for parameters", is_flag=True
)
def create_analysis_report(
experiment: str,
eegdevice: str = None,
subject: str = None,
session: str = None,
filepath:str = None,
prompt: bool = False,
):
"""
Create analysis report of recorded data
"""

if prompt:
example = input("Do you want to load an example experiment? (y/n)\n")
print()
if example == 'y':
example_analysis_report()
return
else:
experiment, eegdevice, subject, session, filepath = analysis_intro_prompt()
create_analysis_report_(experiment, eegdevice, subject, session, filepath)


@main.command()
@click.option("-ed", "--eegdevice", help="EEG device to use", required=True)
Expand Down
57 changes: 57 additions & 0 deletions eegnb/cli/introprompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,63 @@ def intro_prompt() -> Tuple[EEG, str, int, str]:

return eeg_device, exp_selection, duration, str(save_fn)

def analysis_device_prompt():

boards = {
"none": "None",
"muse2016": "Muse (2016)",
"muse2": "Muse 2",
"museS": "Muse S",
"muse2016_bfn": "Muse 2016 - brainflow, native bluetooth",
"muse2016_bfb": "Muse 2016 - brainflow, BLED bluetooth dongle",
"muse2_bfn": "Muse 2 - brainflow, native bluetooth",
"muse2_bfb": "Muse 2 - brainflow, BLED bluetooth dongle",
"museS_bfn": "Muse S - brainflow, native bluetooth",
"museS_bfb": "Muse S - brainflow, BLED bluetooth dongle",
"ganglion": "OpenBCI Ganglion",
"cyton": "OpenBCI Cyton",
"cyton_daisy": "OpenBCI Cyton + Daisy",
"unicorn": "G.Tec Unicorn",
"brainbit": "BrainBit",
"notion1": "Notion 1",
"notion2": "Notion 2",
"crown": "Crown",
"synthetic": "Synthetic",
"freeeeg32": "FreeEEG32",
}

print("Please enter the integer value corresponding to your EEG device: \n")
print("\n".join(f"[{i:2}] {board}" for i, board in enumerate(boards.values())))

board_idx = int(input("\nEnter Board Selection: \n"))

# Board_codes are the actual names to be passed to the EEG class
board_code = list(boards.keys())[board_idx]
return board_code

def analysis_intro_prompt():

# check if user has filepath
print("Welcome to NeurotechX EEG Notebooks\n")
print("Do you have a filepath to a .csv file you would like to analyze? \n")
print("[1] Yes \n")
print("[0] No \n")
file_idx = int(input("Enter selection: \n"))
if file_idx == 1:
print("Please enter the filepath to the .csv file you would like to analyze. \n")
filepath = input("Enter filepath: \n")
subject, session = None, None
else:
subject = int(input("Enter subject ID#: \n"))
session = int(input("Enter session #: \n"))
filepath = None

eegdevice = analysis_device_prompt()
experiment = exp_prompt()

return experiment, eegdevice, subject, session, filepath



def analysis_device_prompt():

Expand Down

0 comments on commit 7ccf0fc

Please sign in to comment.