Skip to content

Commit

Permalink
Merge pull request #26 from digital-cinema-arts/development
Browse files Browse the repository at this point in the history
Added scaling of power bands for Mind Monitor format
  • Loading branch information
digital-cinema-arts authored Jan 5, 2020
2 parents 6d09ad2 + 4554310 commit 85e1b66
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
28 changes: 26 additions & 2 deletions analyze_muse/analyze_muse_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
eeg_stats = []
CVS_fname = ""
out_dirname = ""
Sampling_Rate = 250.0
EEG_data_source = 'Mind Monitor'
Sampling_Rate = 256.0
Filter_Lowcut = 0.1
Filter_Highcut = 100.0
Filter_Order = 3
Expand Down Expand Up @@ -827,7 +828,25 @@ def read_eeg_data(fname, date_time_now):
columns=['Beta_TP9', 'Beta_AF7', 'Beta_AF8', 'Beta_TP10'])
gamma_df = pd.DataFrame(muse_EEG_data,
columns=['Gamma_TP9', 'Gamma_AF7', 'Gamma_AF8', 'Gamma_TP10'])



# Scale Mind Monitor brainwave data

# if False:
if EEG_data_source == 'Mind Monitor':

data_keys = ['Delta_TP9', 'Delta_AF7', 'Delta_AF8', 'Delta_TP10',
'Theta_TP9', 'Theta_AF7', 'Theta_AF8', 'Theta_TP10',
'Alpha_TP9', 'Alpha_AF7', 'Alpha_AF8', 'Alpha_TP10',
'Beta_TP9', 'Beta_AF7', 'Beta_AF8', 'Beta_TP10',
'Gamma_TP9', 'Gamma_AF7', 'Gamma_AF8', 'Gamma_TP10']
# y = ((x + 1.0) * 50)

for data_col in data_keys:
muse_EEG_data[data_col] += 1.0
muse_EEG_data[data_col] *= 50.


elements_df = pd.DataFrame(muse_EEG_data, columns=['TimeStamp', 'Elements'])

if Verbosity > 1:
Expand Down Expand Up @@ -1053,12 +1072,17 @@ def write_hdf5_data(muse_EEG_data, data_fname):
'''
def scale(x, out_range=(-1, 1), axis=None):

# Get the min and max of the data
domain = np.min(x, axis), np.max(x, axis)
# Normalize to +-0.5
y = (x - (domain[1] + domain[0]) / 2) / (domain[1] - domain[0])
# Scale and add offset
return y * (out_range[1] - out_range[0]) + (out_range[1] + out_range[0]) / 2




'''
Tail-rolling average transform
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

setup(
name="Muse-Analysis-Tools",
version="1.1.1",

version="1.1.2",

author="debra_peri",
# author="Debra Grace Peri",
Expand Down

0 comments on commit 85e1b66

Please sign in to comment.