e = at.ECG(shape=(200, 200), probe_height=3,
           m=args.mode)  # Assuming shape/probe height doesn't change.
file_name = args.output  #nput("Name of output file: ")
#print("Nu Value:")
nu = args.nu  #float(input())

print(file_name, nu, e.mode, Iterations)
# print(nu)

h5f = h5py.File('%s.h5' % file_name, 'w')
for index in range(Iterations):
    #nu = (np.random.rand() / 5) + 0.1
    start_time1 = time.time()
    index_grp = h5f.create_group('Index: %s' % index)

    a = fp.Heart(nu=nu, fakedata=True)
    crit_position = np.random.randint(40000)
    y_rand, x_rand = np.unravel_index(crit_position, (200, 200))
    a.set_pulse(60, [[y_rand], [x_rand]])
    raw_data = a.propagate(1260)
    converted_data = list()
    grid = np.zeros(a.shape)
    convert(raw_data, converted_data)

    # Saving the critical circuit position
    index_grp.create_dataset('Crit Position', data=crit_position)
    index_grp.create_dataset('Nu', data=nu)
    ecg = e.solve(converted_data[1111:])

    index_grp.create_dataset('ECG', data=ecg)
    index_grp.create_dataset('Probe Positions', data=e.probe_position)
示例#2
0
import propagate_singlesource as ps
import analysis_theano as at
import numpy as np
import matplotlib.pyplot as plt
from Functions import sampling_convert
# import pyqtgraph as pg
# import pyqtgraph.ptime as ptime
# from pyqtgraph.Qt import QtCore, QtGui
a = ps.Heart(fakedata=True)
a.set_pulse(220, [[100], [100]])
e = at.ECG(shape=(200, 200), probe_height=3)
raw_data = a.propagate(400)

converted_data = list()
grid = np.zeros(a.shape)
sampling_convert(raw_data,
                 converted_data,
                 shape=a.shape,
                 rp=a.rp,
                 animation_grid=grid)

ecg = e.solve(converted_data[100:])

probe_positions = e.probe_position

print probe_positions
print "Plotting..."
fig = plt.figure()
for index, i in enumerate(ecg):
    plt.plot(range(len(i)),
             i,
import analysis_theano as at
from Functions import ani_convert, feature_extract_multi_test_rt, multi_feature_compile_rt
import propagate_singlesource as ps

args = sys.argv

# Loading in Machine Learning models
#####################################
y_classifier_full = joblib.load(args[1])
y_class = joblib.load(args[2])
x_classifier_full = joblib.load(args[3])
x_class = joblib.load(args[4])
#####################################

# Initialising the Heart structure
a = ps.Heart(nu=0.2, delta=0.0, fakedata=True)
# Randomises the rotor x,y position
cp_x_pos = randint(30, 169)
cp_y_pos = randint(0, 199)
a.set_pulse(60, [[cp_y_pos], [cp_x_pos]])
tissue_reset = False

# Initialising ECG recording (randomises the probe x,y position)
current_ecg_x_pos = randint(20, 179)
current_ecg_y_pos = randint(0, 199)
ecg_processing = at.ECG(centre=(current_ecg_y_pos, current_ecg_x_pos),
                        m='g_single')

# Initialising the animation window
app = QtGui.QApplication([])
win = pg.GraphicsWindow(border=True)
示例#4
0
from Functions import ani_convert

print "Propagator types: [Normal, Single Crit, Double Point]"

propagate_choice = raw_input("Propagate type: ")
a = None

if propagate_choice == 'Normal':
    import basic_propagate as bc
    nu_value = float(raw_input('Choose a Nu value: '))
    a = bc.Heart(nu_value)
    a.set_pulse(220)

if propagate_choice == 'Single Crit':
    import propagate_singlesource as ps
    a = ps.Heart(nu=0.2, fakedata=True)
    x_pos = int(raw_input("Crit x position: "))
    y_pos = int(raw_input("Crit y position: "))
    a.set_pulse(60, [[y_pos], [x_pos]])

if propagate_choice == 'Double Point':
    import propagate_singlesource as ps
    nu_value = float(raw_input('Choose a Nu value: '))
    a = ps.Heart(nu=nu_value, fakedata=True)
    x_pos = input("Crit x position: ")
    y_pos = input("Crit y position: ")
    a.set_pulse(60, [[y_pos], [x_pos]])

e = at.ECG_single(a.shape, 3)

app = QtGui.QApplication([])