Created
January 2, 2015 13:38
-
-
Save edouardklein/2d3937eac5c0c4c1b79f to your computer and use it in GitHub Desktop.
Code to plot Figure 1 in the paper "Easy steps towards a sane IT policy in hospitals"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# <nbformat>3.0</nbformat> | |
# <markdowncell> | |
# We visualize the maximum cost at which an IT worker can be hired given his efficiency and the hourly cost of the people he is replacing. | |
# <codecell> | |
def hourly_cost(monthly_cost=0, hours_per_week=0, hours_per_month=0, monthly_salary=0): | |
#Monthly salary is "brut", before various taxes are removed | |
if not monthly_cost: | |
monthly_cost = monthly_salary * 1.3 #taxes again. | |
if not hours_per_month: | |
hours_per_month = hours_per_week/7*31 | |
return monthly_cost / hours_per_month | |
# <codecell> | |
#rcParams.update({'figure.autolayout': False}) | |
alpha = arange(1,50,1) | |
C_med = arange(6,37,.5) | |
@numpy.vectorize | |
def max_c_it(alpha,c_med): | |
return alpha*c_med | |
ALPHA,C_MED = meshgrid(alpha, C_med) | |
MAX_C_IT = max_c_it(ALPHA, C_MED) | |
CS = contourf(C_MED, ALPHA, MAX_C_IT, 100, # [-1, -0.1, 0, 0.1], | |
#alpha=0.5, | |
cmap=cm.bone, | |
norm=matplotlib.colors.LogNorm(), | |
origin='upper') | |
xlabel('Hourly cost $C_{med}$ of the medical worker (€)') | |
resident_cost = hourly_cost(monthly_cost=3000, hours_per_week=80) #Taken from a resident's salary sheet | |
nurse_cost = hourly_cost(monthly_salary=2000, hours_per_week=40) #From http://www.emploitheque.org/grille-indiciaire-hospitaliere---Infirmiers-en-soins-generaux-et-specialises-51 | |
doctor_cost = hourly_cost(monthly_salary=3000*1.3, hours_per_week=80) #From http://www.ph-parinteret.com/files/fhfremunerationmedecin.pdf | |
professor_cost = hourly_cost(monthly_salary=7000*1.3, hours_per_week=75) #From http://www.leparisien.fr/societe/le-classement-des-professeurs-de-medecine-les-mieux-payes-10-06-2010-958128.php | |
Med_cost_list = [resident_cost, nurse_cost, professor_cost] | |
Med_labels_list = ['Resident', 'Nurse and \nDoctor', 'Professor'] | |
for i in range(0,len(Med_labels_list)): | |
Med_labels_list[i] = Med_labels_list[i]+'\n({:.1f})'.format(Med_cost_list[i]) | |
xticks(Med_cost_list, Med_labels_list) | |
ylabel(r'Relative efficiency $\alpha$ of the IT worker (unitless)') | |
alpha_values = [1, 3.5, 10, 40] | |
alpha_labels = ['IT as efficient as med', 'First job', 'Start of compounding effects', 'Good-quality software'] | |
for i in range(0,len(alpha_labels)): | |
#alpha_labels[i] = alpha_labels[i]+' ({:.1f})'.format(alpha_values[i]) | |
alpha_labels[i] = '{:.1f}'.format(alpha_values[i]) | |
yscale('log') | |
yticks(alpha_values, alpha_labels) | |
cbar = colorbar(CS) | |
cbar.ax.set_ylabel('Maximum hourly cost $C_{IT}$ of the IT worker (€)') | |
intern_cost = hourly_cost(monthly_salary=500, hours_per_week=35) | |
minimum_wage = hourly_cost(monthly_salary=1445, hours_per_week=35) #http://www.journaldunet.com/management/remuneration/smic-mensuel-et-smic-horaire.shtml | |
entry_level = hourly_cost(monthly_salary=2100*1.3, hours_per_week=35) #http://www.urbanlinker.com/salaire-moyen/salaire-technique-2014/ | |
senior_developer_paris_max = hourly_cost(80000*1.3/12, hours_per_week=35) #http://www.urbanlinker.com/salaire-moyen/salaire-technique-2014/ | |
IT_cost_list = [intern_cost, minimum_wage, entry_level, senior_developer_paris_max] | |
IT_labels_list = ['Intern', 'Minimum wage', 'Entry level', 'Max senior developer salary'] | |
for i in range(0,len(IT_labels_list)): | |
#IT_labels_list[i] = IT_labels_list[i]+' ({:.1f})'.format(IT_cost_list[i]) | |
IT_labels_list[i] = '{:.1f}'.format(IT_cost_list[i]) | |
CS2 = plt.contour(CS, levels=IT_cost_list, | |
colors = 'r', | |
origin='upper', | |
hold='on') | |
cbar.add_lines(CS2) | |
cbar.set_ticks(IT_cost_list) | |
cbar.set_ticklabels(IT_labels_list) | |
scatter([8.5],[3.5]) | |
tight_layout() | |
savefig('IT_cost.pdf') | |
# <codecell> | |
professor_cost | |
# <codecell> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment