print('Hello, brain!')Events
B = "git+https://github.com/bkowshik/neuroai.git@main"
!uv pip install -q --system \
"moabb" \
"neuralset[all] @ {B}#subdirectory=neuralset-repo" \
"{B}#subdirectory=neuralfetch-repo"
!uv pip install -q --system globus-sdk!uv pip freeze | grep neuralimport os, getpass
import pandas as pd
import neuralset as ns
from neuralset import events
from neuralset.events import etypes
from neuralfetch.utils import compute_study_info
import globus_sdk# To download data from https://www.globus.org/ Ex: Brennan2019Hierarchical
os.environ["NEURALFETCH_GLOBUS_CLIENT_ID"] = getpass.getpass("Globus Client UUID: ")
os.environ["NEURALFETCH_GLOBUS_CLIENT_SECRET"] = getpass.getpass("Globus Client Secret: ")len(etypes.Event._CLASSES), list(etypes.Event._CLASSES.keys())[:5]# Create event from a dictionary
data = {
"type": "Word",
"start": 1.0,
"timeline": "run-01",
"text": "hello",
"surprisal": 3.2,
}
event = etypes.Event.from_dict(data)
event# Create event using the class
word = etypes.Word(
start=1.5,
duration=0.3,
timeline="sub-01_run-01",
text="hello"
)
word# Create a timeline using a Pandas DataFrame
tl = "sub-01_run-01"
rows = [
dict(type="Word", start=10.5, duration=0.3, timeline=tl, text="The"),
dict(type="Word", start=11.0, duration=0.4, timeline=tl, text="cat"),
dict(type="Word", start=11.6, duration=0.3, timeline=tl, text="sat"),
dict(type="Sentence", start=10.5, duration=1.4, timeline=tl, text="The cat sat", language='en', subject='bkowshik', session=1, run=1)
]
df = events.standardize_events(pd.DataFrame(rows))
dfStudies
catalog = ns.Study.catalog()
len(catalog), list(catalog.keys())[:5]study = ns.Study(name="Fake2025Meg", path=ns.CACHE_FOLDER)
events = study.run()
columns = ["subject", "type", "start", "duration", "timeline"]
events[columns]