Skip to content

Instantly share code, notes, and snippets.

@ShigekiKarita
Created July 7, 2014 09:45
Show Gist options
  • Save ShigekiKarita/b8b0e9670eaf48dc1465 to your computer and use it in GitHub Desktop.
Save ShigekiKarita/b8b0e9670eaf48dc1465 to your computer and use it in GitHub Desktop.
Lawson criterion
#!/usr/bin/env python
# -*- coding: utf-8 -*-*
import matplotlib.pyplot as plt
import scipy.interpolate as intp
import numpy as np
# <σν> データセット
x = [1, 10, 10**2, 10**3]
y = [10**-26.5, 10**-22, 10**-21.2, 10**-21.8]
xi = np.arange(x[0], x[-1], 0.1);
sigma_nu = intp.interp1d(x, y, kind='quadratic') # 補間
y_data = sigma_nu(xi)
plt.subplots_adjust(hspace=0.5, wspace=0.5)
# 上側のグラフ:sigma_nu
axes = plt.subplot(211)
axes.set_xscale("log")
axes.set_yscale("log") # Y 軸を対数表示にする
plt.plot(xi,y_data,"r") # axes.plot に同じ
plt.xlabel('TEMPERATURE (keV)')
plt.ylabel('<sigma_nu> (m^3 / sec)')
# 下側のグラフ:n_tau
axes = plt.subplot(212)
axes.set_xscale("log")
axes.set_yscale("log") # Y 軸を対数表示にする
Q_range = [ r * 10 for r in range(1, 5)]
for Q in Q_range:
def n_tau(kt):
return 60 / Q / sigma_nu(kt) * kt
kts = np.arange(10, 101, 10);
nts = n_tau(kts)
#plt.plot(kts, nts, label="Q") # axes.plot に同じ
plt.plot(kts, nts, "o") # axes.plot に同じ
Q_labels = ["Q=" + str(q) for q in Q_range]
axes.legend(Q_labels, loc=0)
axes.axhline(color="black")
axes.axvline(color="black")
plt.xlabel('kT (keV)')
plt.ylabel('n_tau (sec keV /m^3)')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment