Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion file_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def file_read (file):
lines_of_file = block_lines.split('\n') #divide into lines at carriage rtns
del lines_of_file [0] # header
del lines_of_file [-1] # last line is blank so remove it
print lines_of_file [0]
print (lines_of_file [0])
return lines_of_file

def file_write (file,data):
Expand Down
27 changes: 15 additions & 12 deletions noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## Traces that exceed the limit are popped from the list and the failing points are explicitly listed to the terminal
## Output is tab delimited columns of verified traces 'verified.txt'


import sys
from math import *
import platform
from trace_tools import mean, variance, rmsd, traces_scale, trace_scale, traces_average, baselines_quality, baseline_subtract
Expand Down Expand Up @@ -46,9 +46,9 @@ def clean_bad_baselines(input_traces, baseline_range=[0,99]):
b_end = baseline_range[1]
mean_sigma2_bs, rmsd_sigma2_bs, bs_variances = baselines_quality (input_traces, b_start, b_end)

print 'Mean baseline variance = ', mean_sigma2_bs
print 'RMSD of baseline variance =', rmsd_sigma2_bs
print bs_variances
print ('Mean baseline variance = ', mean_sigma2_bs)
print ('RMSD of baseline variance =', rmsd_sigma2_bs)
print (bs_variances)

## discard any trace with excessive baseline noise - Sigma2Bs gt Mean + 4 RMSD
ex_noise_traces_to_pop = []
Expand Down Expand Up @@ -83,7 +83,7 @@ def construct_diffs(input_traces, UNITARY_CURRENT=.5, baseline_range=[0,99]):
diff.append((input_traces[x+1][y]-input_traces[x][y])/2)
difference_traces.append(diff)

print 'Constructed ', len(difference_traces), ' difference traces'
print ('Constructed ', len(difference_traces), ' difference traces')

## calculate mean current, invert and subtract baseline
mean_I_inverted_bs_sub = mean_inverse_baseline_sub(input_traces, b_start, b_end)
Expand All @@ -99,7 +99,7 @@ def construct_diffs(input_traces, UNITARY_CURRENT=.5, baseline_range=[0,99]):
limit = 7 * sqrt(UNITARY_CURRENT * I + mean_sigma2_bs)
limits.append(limit)

print 'Verifying variance of difference traces'
print ('Verifying variance of difference traces')

excess_points, excess_limits, excess_differences = [],[],[]

Expand Down Expand Up @@ -130,8 +130,8 @@ def construct_diffs(input_traces, UNITARY_CURRENT=.5, baseline_range=[0,99]):
if len(excess_points[i]) > 0:
message = "Trace {} contained {} points greater than the limit and was removed from set\n".format(i, len(excess_points[i]))
messages += message
print message
print zip(excess_limits[i],excess_differences[i])
print (message)
print (zip(excess_limits[i],excess_differences[i]))
difference_traces_to_pop.append(i)
if input_traces_to_pop.count(i) == 0: #Check if this trace was already discarded last time
input_traces_to_pop.append(i)
Expand Down Expand Up @@ -171,8 +171,11 @@ def final_prep(input_traces, difference_traces, baseline_range):
for d_trace in difference_traces:
isochrone.append(d_trace[isochronous_point])

mean_dZt_squared = mean (map (square, isochrone))

if sys.version_info[0] > 2:
mean_dZt_squared = mean (list(map (square, isochrone)))
else:
mean_dZt_squared = mean (map (square, isochrone))

#factor of '2' because of dZt = 1/2 * {y(i+1)-y(i)}; Heinemann and Conti
final_ensemble_variance.append(2 * mean_dZt_squared)

Expand All @@ -195,10 +198,10 @@ def write_output (difference_traces, header_line, filename='verified.txt'):
output_lines.insert(0, header_line)
output_file = filename

print 'Writing {} difference traces to {} with mean and variance in first two columns...'.format(len(difference_traces), output_file)
print ('Writing {} difference traces to {} with mean and variance in first two columns...'.format(len(difference_traces), output_file))

file_write (output_file,output_lines)
print 'Done'
print ('Done')



Expand Down
2 changes: 1 addition & 1 deletion verifyTk.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def on_help():
def callback_fname(self):
### there is no need to do anything until the analysis starts
#this is just for debugging
print self.v.get()
print (self.v.get())

def callback5(self):
'Called by PLOT variance current button.'
Expand Down