Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gshafiei committed Jan 23, 2023
1 parent 2d05710 commit c067454
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 7 deletions.
Binary file modified code/.DS_Store
Binary file not shown.
Binary file modified code/analysis/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions code/analysis/scpt_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
Y = avg_snr
rho = np.zeros((X.shape[1], 1))
for i in range(X.shape[1]):
tmpcorr = scipy.stats.pearsonr(X[:, i], Y) # or pearsonr
tmpcorr = scipy.stats.pearsonr(X[:, i], Y)
rho[i, 0] = tmpcorr[0]

surf_path = (gitrepo_dir + 'data/surfaces/')
Expand Down Expand Up @@ -344,7 +344,7 @@
rho = np.zeros((X.shape[1], Y.shape[1]))
for i in range(X.shape[1]):
for j in range(Y.shape[1]):
tmpcorr = scipy.stats.pearsonr(X[:, i], Y[:, j]) # or pearsonr
tmpcorr = scipy.stats.pearsonr(X[:, i], Y[:, j])
rho[i, j] = tmpcorr[0]

surf_path = (gitrepo_dir + 'data/surfaces/')
Expand Down Expand Up @@ -590,7 +590,7 @@
rho = np.zeros((X.shape[1], Y.shape[1]))
for i in range(X.shape[1]):
for j in range(Y.shape[1]):
tmpcorr = scipy.stats.pearsonr(X[:, i], Y[:, j]) # or pearsonr
tmpcorr = scipy.stats.pearsonr(X[:, i], Y[:, j])
rho[i, j] = tmpcorr[0]

# save to csv
Expand Down
3 changes: 1 addition & 2 deletions code/analysis/scpt_pls.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ def pls_cv_distance_dependent_par(X, Y, coords, trainpct=0.75, lv=0,
pyls.save_results(outpath + 'pls/plsresults_schaefer100.hdf5', results)

train, test = pls_cv_distance_dependent_par(X, Y, coords=coor)
lv = 0 # latent variable
np.save(outpath + 'pls/pls_train_schaefer100.npy', train)
np.save(outpath + 'pls/pls_test_schaefer100.npy', test)

Expand All @@ -214,10 +213,10 @@ def pls_cv_distance_dependent_par(X, Y, coords, trainpct=0.75, lv=0,

# visualize pls results
# covariance explained
lv = 0 # latent variable
cv = results['singvals']**2 / np.sum(results['singvals']**2)
null_singvals = results['permres']['permsingvals']
cv_spins = null_singvals**2 / sum(null_singvals**2)
p = (1+sum(null_singvals[lv, :] > results['singvals'][lv]))/(1+nspinsall)

myplot = sns.scatterplot(np.arange(len(cv[:10])), cv[:10]*100,
facecolors='darkslategrey', s=70)
Expand Down
6 changes: 4 additions & 2 deletions code/preprocessing/scpt_runBrainstorm.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
addpath(genpath('/usr/local/brainstorm3/'));

% Run Brainstorm
hcp_meg_process_connectivity(hcp_dir, subjList, badChannels, reports_dir)
fcn_hcp_meg_process_rest(hcp_dir, subjList, badChannels, reports_dir)

%% hctsa on MEG: parcellate
% addpath(genpath('/home/gshafiei/data1/Projects/HCP_Reinder/matlabcode'));
% requires cifti-matlab
% (https://github.com/Washington-University/cifti-matlab)
% addpath(genpath('/home/gshafiei/data1/Projects/packages/cifti-matlab'));
hcp_dir = '/path/to/megdata/and/results/';
datapath = strcat(hcp_dir, 'brainstormResults/vertexTimeSeries');
tspath = strcat(hcp_dir, 'parcellated/HCP_MEG_TimeSeries/Schaefer100/');
Expand Down
Binary file modified data/.DS_Store
Binary file not shown.
Binary file modified data/SchaeferParcellation/.DS_Store
Binary file not shown.
Binary file modified data/SchaeferParcellation/FreeSurfer5.3/.DS_Store
Binary file not shown.
Binary file modified data/SchaeferParcellation/FreeSurfer5.3/fsaverage/.DS_Store
Binary file not shown.

0 comments on commit c067454

Please sign in to comment.