summaryrefslogtreecommitdiffstats
path: root/assignments/hw01/question1.jl
diff options
context:
space:
mode:
Diffstat (limited to 'assignments/hw01/question1.jl')
-rw-r--r--assignments/hw01/question1.jl40
1 files changed, 40 insertions, 0 deletions
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)")
+