neurolang
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 從 MNE-Python 的 class 取得數據 從原始檔 'de00110.con' 進行前處理: ```python import mne import matplotlib.pyplot as plt import pandas as pd import numpy as np # 本機端儲存 de00110.con 檔案的目錄 data_path = '/folder1/folder2/doc' # 匯入 CON 檔 sid = 1 confile = data_path + '/de%.3d10.con' % sid # raw = mne.io.kit.read_raw_kit(confile, stim = [192, 193, 194], slope = '+') # MNE-Python 會將原本分散在各 trigger channel 的標記合併到 # 同一個 channel 上 (`STI 014`)。後面的分析就利用 STI 014 # 產生事件 onsets 的列表 events = mne.find_events(raw, stim_channel='STI 014') # preload raw MEG data raw.load_data() # low pass fillter,由於這筆資料要做 time-frequency # ananlysis, 所以不執行低通濾波 #raw.filter(0, 60, phase= 'zero-double') # duration of epochs 指定事件標記前後的時間範圍,從`raw`的資 # 料切割每次事發生時 tmin ~ tmax 的一小段訊號,以秒為單位 tmin = -0.1 # pre stimulis interval (in seconds) # tmax = 0.6 # post stimulus interval # # artifact rejection criteria 以 3pT 作為拒絕 epochs 的標準 reject = dict(mag=3e-12) # +/- 3pT # 以文字標記事件類別。dictionary 的 `key` 可以自訂。value 必 # 須是 events 物件第三欄出現過的整數 event_id = {'AM40Hz':1, 'Tone1kHz': 2} # KIT 的硬體組共有 255 個channel, 執行 epoching 的時候只要 # 留下 157 個 MEG sensor 的資料 picks = mne.pick_types(raw.info, meg= True, stim = False) # channels to use in epochs # # 基準線校正。`None` 等同於使用 tmin 的值 baseline = (None, 0) # what to use as baseline comparison - here it's pre-stim interval # # 這邊才是真的開始執行 epoching epochs = mne.Epochs(raw, events, event_id, tmin, tmax, proj = False, picks = picks, baseline=baseline, preload = True, reject=reject) epochs = epochs.resample(1000, npad='auto') # saving an epoch object into a fif file epochs.save(data_path + '/%.3d_raw_epo.fif' % sid, overwrite= True) # `epochs['AM40Hz']` 的意思是從 epochs 裡面,篩選出 'AM40Hz' # 這一類的資料; `.average()` 則是 epochs 底下的一種 method, # 將選擇之後的 epochs 平均在一起 # 所以下面兩行指令會產生兩種平均波形 evoked1 = epochs['AM40Hz'].average() evoked2 = epochs['Tone1kHz'].average() # 如果不打算分類,而是要看所有事件合併再一起的總平均: # evoked = epochs.average() # saving multiple evoked objects into a fif file mne.write_evokeds('%.3d-ave.fif' % sid, [evoked1, evoked2]) # saving an epoch object into a fif file epochs.save(data_path + '/%.3d_raw_epo.fif' % sid, overwrite= True) # artifact rejection 的結果可以另外存成一個csv檔案 drop_log = pd.DataFrame(epochs.drop_log) drop_log.to_csv('s%.3d_droplog.csv' % sid) ``` 到這邊為止,用到三種mne-pyton建立的 class,分別是 `raw`、`epochs`、`evoked`: ```python print(type(raw)) print(type(epochs)) print(type(evoked1)) ``` <class 'mne.io.kit.kit.RawKIT'> <class 'mne.epochs.Epochs'> <class 'mne.evoked.EvokedArray'> 這三個物件底下都有一項 `numpy ndarray`, 裡面儲存 MEG 資料。從 mne-python 的 class 取得資料的方法如下: ```python # 請注意有時候要加上括弧,有時候不用括弧 raw.get_data() epochs.get_data() evoked1.data ``` 由於上述三項指令的輸出都是 numpy ndarray,因此會繼承一些 numpy 的 methods ```python # 描述各個 ndarray 的維度 print(raw.get_data().shape) print(epochs.get_data().shape) print(evoked1.data.shape) ``` (257, 1075000) >> channels x samples (193, 157, 700) >> events x channels x times (157, 700) >> channels x times 後續要使用 HHT 的話,要從 epochs.get_data() 這筆資料開始

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully