#!/usr/bin/env python

import matplotlib
matplotlib.use('Agg')
from pylab import *

# 1 = HbO2
# 2 = HHb
# a = 660 nm
# b = 940 nm

#author = 'Mendelson'
author = 'King'

if author == 'Mendelson':
    e1a = 0.12
    e2a = 0.86
    e1b = 0.29
    e2b = 0.20
else:
    e1a = 0.10
    e2a = 0.83
    e1b = 0.29
    e2b = 0.17

if author == 'Mendelson':
    def SfO2(R):
        return (-e2a+e2b*R)/(e1a-e2a + (e2b-e1b)*R)
else:
    def SfO2(R):
        return 1./(1 + (R*e1b-e1a)/(e2a-R*e2b))

R = linspace(0.4, 4, 100)
figure(figsize=(4,4))
plot(R, SfO2(R), 'k.')
title('Theory')
xlabel('R')
ylabel('SfO2')

target = __file__[:-2] + 'png'
print target
savefig(target, dpi=300)
