9-Dec-2015: Simulation with power consumption and LEU quantity shipped from EF in the case where facility is not constrained, gets requests for 5 discrete enrichment levels, has a constrained Gaussian variation of tails (0.2+/-0.1%) and HEU is diverted only after t=20.


In [20]:
# Render our plots inline
%matplotlib inline
%pylab inline  
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab


Populating the interactive namespace from numpy and matplotlib

In [21]:
# General Plotting Parameters
mpl.rcParams['figure.figsize'] = (8,5)
mpl.rcParams['lines.linewidth'] = 2.5
mpl.rcParams['font.weight'] = 'bold'
mpl.rcParams['axes.linewidth'] = 1.5
mpl.rcParams['font.size'] = 14.
mpl.rcParams['legend.fontsize'] = 12.
mpl.rcParams['axes.labelsize'] = 12.
mpl.rcParams['xtick.labelsize'] = 10.
mpl.rcParams['ytick.labelsize'] = 10.
mpl.rcParams['xtick.minor.pad'] = 4
mpl.rcParams['xtick.direction'] = 'out'
mpl.rcParams['ytick.direction'] = 'out'
#Git says this is patched, but it doesn't work from Pip --upgrade 26-mar-2015
#mpl.rcParams['xtick.minor.visible'] = True  

# These are the "Tableau 20" colors as RGB.  
tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14),
             (255, 187, 120), (44, 160, 44), (152, 223, 138),
              (148, 103, 189),
             (197, 176, 213), (140, 86, 75), (196, 156, 148),  
             (227, 119, 194), (247, 182, 210), (127, 127, 127),
             (199, 199, 199), (188, 189, 34), (219, 219, 141),
             (23, 190, 207), (158, 218, 229),(214, 39, 40), (255, 152, 150)]  
    
# Scale the RGB values to the [0, 1] range,
# which is the format matplotlib accepts.  
for i in range(len(tableau20)): 
    r, g, b = tableau20[i]  
    tableau20[i] = (r / 255., g / 255., b / 255.)

In [22]:
# Specific Plotting Params
i_leu = 0
i_swu = 6
i_heu = 4

xlab = "Time (months)"
ylab_tp = "Quantity"
ylab_swu = "Power Consumed"

src_dir = '/Users/mbmcgarry/git/data_analysis/data/UM_data/multi_modal_v1.3/single_runs/'
plot_dir = src_dir + 'UM_011616/'
pfix = 'mm_5enrich_lowtails'

ps = 0

In [23]:
from manip_data import import_data_cyan

In [24]:
dir =plot_dir
#leu_file= dir + '15_mm_5enrich.sqlite.dat'
#heu_file= dir + '16_mm_5enrich.sqlite.dat'
#swu_file = dir + 'PWR_mm_5enrich.sqlite.dat'
#leu_file= dir + '15_mm_5enrich_lowtails.sqlite.dat'
#heu_file= dir + '16_mm_5enrich_lowtails.sqlite.dat'
#swu_file = dir + 'PWR_mm_5enrich_lowtails.sqlite.dat'

leu_file= dir + '15_' + pfix + '.sqlite.dat'
heu_file= dir + '16_' + pfix + '.sqlite.dat'
swu_file = dir + 'PWR_' + pfix + '.sqlite.dat'

#dir = '/Users/mbmcgarry/git/data_analysis/data/UM_data/multi_modal_v1.3/testing/'
#leu_file= dir + '15_noenrich_var.sqlite.dat'
#heu_file= dir + '16_noenrich_var.sqlite.dat'
#swu_file = dir + 'PWR_noenrich_var.sqlite.dat'

leu_time, leu_tp = import_data_cyan(leu_file)
heu_time, heu_tp = import_data_cyan(heu_file)
raw_data = pd.read_csv(swu_file,sep='\s+')
swu_time = raw_data['Time']
swu = raw_data['Value']

In [25]:
plt.plot(leu_time,leu_tp, label='LEU shipped', color=tableau20[i_leu])

plt.legend(loc='best')
plt.xlabel(xlab)
plt.ylabel(ylab_tp)

if ps == 1:
    savefig(plot_dir + pfix + 'leu_shipped_E5.png')



In [26]:
plt.plot(swu_time[1:],swu[1:], label='Power Consumed', color=tableau20[i_swu])

plt.legend(loc='best')
plt.xlabel(xlab)
plt.ylabel(ylab_swu)

if ps == 1:
    savefig(plot_dir + pfix + 'EF_power_E5.png')



In [27]:
plt.plot(heu_time,heu_tp, label='HEU produced', color=tableau20[i_heu])

plt.legend(loc='best')
plt.xlabel(xlab)
plt.ylabel(ylab_tp)

if ps == 1:
    savefig(plot_dir + pfix + 'heu_diverted_E5.png')



In [28]:
plt.plot(swu_time[1:],swu[1:]/leu_tp[1:], color=tableau20[i_swu], marker='o', linestyle='')

plt.xlabel(xlab)
plt.ylabel('Power/LEU')

#plt.ylim([6,7])
if ps == 1:
    savefig(plot_dir + pfix + 'ratio_swu_leu.png')



In [29]:
freq = 1
if freq == 1:
    freq_file = dir + 'SHIP_15_mm_5enrich_lowtails.sqlite.dat'
    raw_freq = pd.read_csv(freq_file)
    precision=2

    bins=15
    hist_min=2.95
    hist_max=3.1
    m_hist = raw_freq.plot(kind='hist', bins=bins,color=tableau20[i_leu+1],
                  alpha=1.0,range=(hist_min,hist_max),normed=0,label='LEU Shipments')
    mean_delta = np.mean(raw_freq)
    variance_delta = np.var(raw_freq)
    sigma_delta = np.sqrt(variance_delta)
    x = np.linspace(hist_min,hist_max,100)
    #plt.ylim([6,7])
    if ps == 1:
        savefig(plot_dir + pfix + 'ship_hist_leu.png')



In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: