From b602a0ce3526c0d5f5fd6c681d6a70101a492d89 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Fri, 16 May 2014 01:44:16 -0400 Subject: hw01 assignment and julia notes --- assignments/hw01/question1.jl | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 assignments/hw01/question1.jl (limited to 'assignments/hw01/question1.jl') diff --git a/assignments/hw01/question1.jl b/assignments/hw01/question1.jl new file mode 100644 index 0000000..32be340 --- /dev/null +++ b/assignments/hw01/question1.jl @@ -0,0 +1,40 @@ + +using ImageView, Images +img = imread("flash4.jpg") +img.data = img.data' +#display(img, pixelspacing = [1,1]) + +# flash is 220 to 280 in the x-axis +# flash_data = img.data[220:280,:] +flash_avg = Float64[mean(img.data[r, 220:280]) for r = 1:size(img.data,1)] +noflash_avg = Float64[mean(img.data[r, 300:400]) for r = 1:size(img.data,1)] + +# using Winston +# plot(flash_avg) +# plot(noflash_avg) + +# WRONG: background_F = Float64[mean(img.data[70:100, :])] +background_avg = Float64[mean(img.data[r, 70:100]) for r = 1:size(img.data,1)] + +flash_avg ./= background_avg +noflash_avg ./= background_avg + +function unitify(r, Ca2_baseline, K_D) + return r * K_D / ((K_D/Ca2_baseline) - r + 1) +end + +Ca2_baseline = 100 +K_D = 700 + +#Ca2_baseline = 150 +#K_D = 1000 + +dT = 1.53 +t = dT * [0:length(flash_avg)] +figure() +hold(true) +plot(t, Float64[unitify(v, Ca2_baseline, K_D) for v = flash_avg[:]], color="red") +plot(t, Float64[unitify(v, Ca2_baseline, K_D) for v = noflash_avg[:]], color="blue") +ylabel("[ca](nM)") +xlabel("Time (ms)") + -- cgit v1.2.3