Skip to content

Commit

Permalink
corrects formatting, python3 syntax and adds descriptions in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
kebab-mai-haddi committed Mar 30, 2019
1 parent ac3aaa2 commit 493ac81
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 15 deletions.
27 changes: 21 additions & 6 deletions altering.py
Expand Up @@ -204,7 +204,11 @@ def alter_gmax():

present_diff = abs(max_freq - calulated_max_freq)
# our objective is to lessen the absolute difference.
print 'Need to Achive: ', max_freq, ' From: ', calulated_max_freq
print(
'Need to Achive: {}, From: {}'.format(
max_freq, calulated_max_freq
)
)
# can change it to 0.5 for more accurancy, as of now, 1 diff is the threshold.
while present_diff > 1:

Expand Down Expand Up @@ -315,15 +319,26 @@ def alter_gmax():
vTCR, 1000, 'hanning', 500, scaling='spectrum')
calulated_max_freq = f[list(Pxx_spec).index(max(Pxx_spec))]
new_dis = abs(calulated_max_freq - max_freq)
print 'Old Distance: ', present_diff, 'New Distance: ', new_dis
print(
'Old Distance: {} New Distance: {}'.format(
present_diff, new_dis
)
)
present_diff = new_dis

print('Original g_max terms: ')
print "original_gAmpaTCRToTRN,original_gAmpaRetToIN,original_gAmpaRetToTCR,original_gGaba,original_gGabaInToTCR"
print original_gAmpaTCRToTRN, original_gAmpaRetToIN, original_gAmpaRetToTCR, original_gGaba, original_gGabaInToTCR
print (
"original_gAmpaTCRToTRN: {}, original_gAmpaRetToIN: {}, original_gAmpaRetToTCR: {},original_gGaba: {}, original_gGabaInToTCR: {}".format(
original_gAmpaTCRToTRN, original_gAmpaRetToIN, original_gAmpaRetToTCR, original_gGaba, original_gGabaInToTCR
)
)
print('Altered g_max terms: ')
print "gAmpaTCRToTRN,gAmpaRetToIN,gAmpaRetToTCR,gGaba,gGabaInToTCR"
print gAmpaTCRToTRN, gAmpaRetToIN, gAmpaRetToTCR, gGaba, gGabaInToTCR
print(
"gAmpaTCRToTRN: {}, gAmpaRetToIN: {}, gAmpaRetToTCR: {}, gGaba: {}, gGabaInToTCR: {}".format(
gAmpaTCRToTRN, gAmpaRetToIN, gAmpaRetToTCR, gGaba, gGabaInToTCR
)
)
print
f, Pxx_spec = signal.welch(vTCR, 1000, 'hanning', 500, scaling='spectrum')
plt.figure()
plt.semilogy(f, Pxx_spec, linewidth=2.0)
Expand Down
19 changes: 18 additions & 1 deletion readme.md
@@ -1,6 +1,23 @@
In order to simulate EEG readings, no software exists which can run the Kinetic LGN model.
This python library will simulate implements the kinetic lgn model for simulating eeg models.


1. Run simulation via:
python simulation_model.py
2. Determine change in params of a new activity: gaming in this eg.
python altering.py
3. EEG recordings in emotive_recordings folder
4. Consulted research papers(for reference) in docs
4. Consulted research papers(for reference) in docs


altering.py:
To alter the eeg signals generated by the simulation model to match with the standard eeg data so as to compare the simulated output EEG readings with the standard ones.

running_tests.py:
Plots standard and simulated EEG readings, for user to test hooks and nooks.

preprocessing_eeg.py:
Cleans the standard EEG data, the one with which we want to match the sample and the simulated readings.

simulation_model.py:
Implements the Kinetic LGN Model
6 changes: 4 additions & 2 deletions running_tests.py
@@ -1,5 +1,7 @@
import matplotlib.pyplot as plt
import numpy as np

import matplotlib.pyplot as plt

plt.style.use('ggplot')

m_f = np.load('objects/simulation_model_freq.npy')[:50]
Expand All @@ -13,4 +15,4 @@
plt.xlabel('frequency [Hz]')
plt.ylabel('Linear spectrum [V RMS]')
plt.title('Power spectrum (scipy.signal.welch)')
plt.show()
plt.show()
15 changes: 9 additions & 6 deletions simulation_model.py
@@ -1,12 +1,15 @@
from __future__ import division
from scipy.signal import butter, lfilter
import matplotlib.pyplot as plt
from scipy import signal
import numpy as np

import datetime
import numpy
import time
import math
import time

import numpy as np

import matplotlib.pyplot as plt
from scipy import signal
from scipy.signal import butter, lfilter

plt.style.use('ggplot')
global tMax, tTCR, tTRN, tIN, vThr, sigma, rRetToTCR, rRetToIN, rInToTCR, r_TRN_to_TCR, T, timeList, iRetToTCR, iRetToIN, iInToTCR, iInToIn, i_TRN_to_TCR, i_TRN_to_TRN, betaAmpa, betaGaba, vTCR, vIN, iLeakTCR, iLeakIN, gAmpaRetToTCR, gAmpaRetToIN, gGabaInToTCR, EAmpa, EGaba, EGaba_TRN_or_IN_to_TCR, EGaba_TRN_to_TRN_or_IN_to_IN, cIRE, cTRE, cISI, cTII, cNSI, gLeakIN, gLeakTCR, ELeakIN, ELeakTCR, r_TCR_to_TRN, iLeakTRN, cTNI, gLeakTRN, ELeakTRN
tTCR = [0] * 10000
Expand Down

0 comments on commit 493ac81

Please sign in to comment.