<jupyter_start><jupyter_text>Figure on how to calculate the transition from one motion mode to another<jupyter_code>%pylab inline
from matplotlib.font_manager import FontProperties
matplotlib.rcParams.update({'font.size': 23,'legend.fontsize':25})#,'font.family': 'serif'})
rc('axes', linewidth=2)
def data4erro(bins, mu_l, sigma_l):
    y = ((1 / (sqrt(2.0 * pi) * sigma_l)) *
     exp(-0.5 * (1.0 / sigma_l * (bins - mu_l))**2.0))
    y = y.cumsum()
    y /= y[-1]
    return y


def make_outputfile(fig,tt='test',res=200):
    fname_eps = 'Fig_{t1}.eps'.format(t1=tt)
    fname_png = 'Fig_{t1}.png'.format(t1=tt)
    fname_pdf = 'Fig_{t1}.pdf'.format(t1=tt)
    fname_svg = 'Fig_{t1}.svg'.format(t1=tt)
    print("Making files with dpi={t4}:".format(t4=str(res)))
    fig.savefig(fname_eps,bbox_inches='tight', transparent=True)
    print('\t - {t1}'.format(t1=fname_eps))
    fig.savefig(fname_png,dpi=res,bbox_inches='tight', transparent=True)
    print('\t - {t1}'.format(t1=fname_png))
    fig.savefig(fname_pdf,dpi=res,bbox_inches='tight', transparent=True)
    print('\t - {t1}'.format(t1=fname_pdf))    
x = linspace(0,20,200)
y1 = data4erro(x,10.0,2.5)
al = 0.01
line_w=16.2
tick_length = 12
font0 = FontProperties()
font = font0.copy()
font.set_weight('bold')
fig, ax1 = subplots(nrows=1,ncols=1,figsize=(10,5)) 
ax1.spines['right'].set_visible(False)
ax1.spines['top'].set_visible(False)

# Only show ticks on the left and bottom spines
ax1.yaxis.set_ticks_position('left')
ax1.xaxis.set_ticks_position('bottom')
ax1.tick_params(which='both', width=2)
ax1.tick_params(which='major', length=tick_length)
ax1.plot(x,y1,'k-')
ax1.fill_between(x,0,y1,color='r',alpha=0.5)
ax1.plot(x,y1[::-1],'k-')
ax1.fill_between(x,0,y1[::-1],color='b',alpha=0.5)
#ax1.axvline(10.0,ymin=0.0,ymax=2.1,linestyle ='--',color='r')
arst='-'#',head_width=0.25,head_length=0.5'
ax1.annotate('',
             xy=(10.0, 0.0), xycoords='data',
             xytext=(10.0, 1.1), textcoords='data', fontsize=16,
             arrowprops=dict(arrowstyle=arst,linestyle='--',lw=1.5,fc='k'))

arst='<|-,head_width=0.25,head_length=0.5'
ax1.annotate('',
             xy=(12.0, 1.02), xycoords='data',
             xytext=(10.0, 0.8), textcoords='data', fontsize=16,
             arrowprops=dict(arrowstyle=arst,linestyle='--',lw=1.0,fc='k'))
ax1.text(10.1,1.04,r'$\rho_{p,\!c}\equiv \rho_p^{(1)} = \rho_p^{(2)}$')

arst='<|-,head_width=0.25,head_length=0.5'
ax1.annotate('',
             xy=(2.5, 0.85), xycoords='data',
             xytext=(2.1, 1.0), textcoords='data', fontsize=16,
             arrowprops=dict(arrowstyle=arst,linestyle='--',lw=1.0,fc='k'))
ax1.text(2.1,0.79,r'$\rho_p^{(1)}$')
arst='<|-,head_width=0.25,head_length=0.5'
ax1.annotate('',
             xy=(13.7, 0.75), xycoords='data',
             xytext=(12.5, 0.85), textcoords='data', fontsize=16,
             arrowprops=dict(arrowstyle=arst,linestyle='--',lw=1.0,fc='k'))
ax1.text(13.6,0.71,r'$\rho_p^{(2)}$')



ax1.text(2., 0.5,'No dislodgement')
ax1.text(12., 0.5,'Dislodgement')

ax1.set_xlim(0,20)
ax1.set_ylim(-0.01,1.02)
ax1.set_ylabel(r'Density, $\rho_p$',fontproperties=font);
ax1.set_xlabel('Flow Depth [m]', fontproperties=font);<jupyter_output><empty_output><jupyter_text>__Figure Caption:__ Idealized plot to find the mode transition from no dislodgement for the Monte Carlo simulations. $\rho_p^{(1)}$ denotes the density for the no dislodgement and $\rho_p^{(2)}$ for dislodgement. The critical density that defines the boundary between both motion modes is defined to be $\rho_{p,c} \equiv \rho_p^{(1)} = \rho_p^{(2)}$. In case of three overlapping mode densities, we define the critical density to be $\rho_{p,c} \equiv \rho_p^{(1)} = \rho_p^{(2)}+\rho_p^{(3)}$.<jupyter_code>make_outputfile(fig,'trans',400)
!ls<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21286089238845143, 'fraction_numerical': 0.06115485564304462, 'mean_word_length': 4.809451219512195, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '652326', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1601, 'n_words': 233, 'path': 'FigureDensity.ipynb', 'repo_name': 'weiszr/MonteCarloBoulder', 'size': '3810'}