Skip to content

Commit

Permalink
almost finished spectral analysis and creating features from spectral…
Browse files Browse the repository at this point in the history
… analysis for RNN and CNN
  • Loading branch information
MetaverseCrowdsource committed Aug 7, 2023
1 parent bd52953 commit 64dc115
Show file tree
Hide file tree
Showing 11 changed files with 4,330 additions and 703 deletions.
849 changes: 618 additions & 231 deletions .ipynb_checkpoints/Data Loading and Variable Assigning-checkpoint.ipynb

Large diffs are not rendered by default.

57 changes: 39 additions & 18 deletions .ipynb_checkpoints/Multifractal Analysis-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,7 @@
" # Print the head (first 10 elements) of the Hurst exponents array\n",
" print(\"Hurst exponents:\", hurst_exponents)\n",
"\n",
" print(\"Hurst exponents saved to:\", file_path)\n",
"\n"
" print(\"Hurst exponents saved to:\", file_path)"
]
},
{
Expand Down Expand Up @@ -986,7 +985,7 @@
"montage = mne.channels.make_dig_montage(ch_pos=dict(zip(channel_names, scalp_positions)), coord_frame='head')\n",
"\n",
"# Set the montage to the Info object\n",
"info.set_montage(montage)\n"
"info.set_montage(montage)"
]
},
{
Expand Down Expand Up @@ -1067,7 +1066,7 @@
"# Plot the topographical map of mean Hurst exponent values\n",
"evoked.plot_topomap(times=0, scalings=1.0, cmap='viridis')\n",
"\n",
"# Consider performing statistical tests (e.g., ANOVA, t-test) to assess group differences or condition-related variations in the mean Hurst exponent values\n"
"# Consider performing statistical tests (e.g., ANOVA, t-test) to assess group differences or condition-related variations in the mean Hurst exponent values"
]
},
{
Expand Down Expand Up @@ -1262,6 +1261,14 @@
"np.save(rnn_save_dir + 'rnn_mfdfa_X_df.npy', rnn_X_data)"
]
},
{
"cell_type": "markdown",
"id": "4469a3d8-c1d4-4f38-b0a2-0ddf202fb728",
"metadata": {},
"source": [
"# Load Hurst exponents as numpy"
]
},
{
"cell_type": "code",
"execution_count": 18,
Expand All @@ -1278,7 +1285,7 @@
"id": "8f235b5c-b8a9-4a4e-9d28-793fd14d454e",
"metadata": {},
"source": [
"# Load MFDFA RNN X data"
"# Load MFDFA RNN X data as numpy"
]
},
{
Expand All @@ -1295,6 +1302,28 @@
"rnn_mfdfa_X_df_npy = np.load(rnn_mfdfa_X_df_path + 'rnn_mfdfa_X_df.npy')"
]
},
{
"cell_type": "markdown",
"id": "a6e0d4af-f6ca-468b-8eef-696a7a5a7c8e",
"metadata": {},
"source": [
"# Load MFDFA CNN X data as numpy"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3411ab35-af06-4d08-87bf-d1e27eacbc68",
"metadata": {},
"outputs": [],
"source": [
"# Load data\n",
"cnn_save_dir = '/home/vincent/AAA_projects/MVCS/Neuroscience/CNN_data/'\n",
"\n",
"# Load CNN data\n",
"rnn_mfdfa_X_df_npy = np.load(rnn_mfdfa_X_df_path + 'cnn_mfdfa_X_df.npy')"
]
},
{
"cell_type": "markdown",
"id": "a7f9756f-4857-4c8b-bd70-093c764f9eb5",
Expand Down Expand Up @@ -1488,14 +1517,14 @@
],
"source": [
"# Display the shapes\n",
"print(\"Shape of cnn_X_data:\", cnn_X_data.shape)\n",
"print(\"Shape of rnn_X_data:\", rnn_X_data.shape)\n",
"print(\"Shape of cnn_mfdfa_X_df:\", cnn_mfdfa_X_df.npy.shape)\n",
"print(\"Shape of rnn_mfdfa_X_df.npy:\", rnn_mfdfa_X_df.npy.shape)\n",
"\n",
"# Convert the 3D CNN data to a DataFrame\n",
"cnn_X_df = pd.DataFrame(cnn_X_data)\n",
"cnn_X_df = pd.DataFrame(cnn_mfdfa_X_df)\n",
"\n",
"# Convert the 3D RNN data to a list of DataFrames with generic column labels\n",
"rnn_X_df = [pd.DataFrame(time_series) for time_series in rnn_X_data]\n",
"rnn_X_df = [pd.DataFrame(time_series) for time_series in rnn_mfdfa_X_df.npy]\n",
"\n",
"# Display the head of the first DataFrame in the list\n",
"print(\"cnn_X_df:\")\n",
Expand Down Expand Up @@ -1720,7 +1749,7 @@
"id": "2ed88397-ca95-433d-a081-ffb876bd61de",
"metadata": {},
"source": [
"# Save MFDFA RNN X data as DF"
"# Save MFDFA RNN X data and Hurst exp as DF"
]
},
{
Expand Down Expand Up @@ -1773,14 +1802,6 @@
"rnn_data_path = '/home/vincent/AAA_projects/MVCS/Neuroscience/RNN_data/'\n",
"np.save(f\"{rnn_data_path}rnn_X_data_combined.npy\", rnn_X_df_combined)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ec327871-1f8d-43c3-bcef-dc941606890a",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
1,564 changes: 1,562 additions & 2 deletions .ipynb_checkpoints/Spectral Analysis-checkpoint.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 64dc115

Please sign in to comment.