Пример #1
0
def compare_hfs(s=s, tct=tct, Fdecon=Fdecon, F=F, lpqf=lpqf, lptf=lptf):
    plt.figure()
    #plt.plot(tct,Fdecon/1e6,label='TC ELM deconvolution')
    #plt.plot(tct-.098,F2/1e6,'k', label='TC2 measurement')
    plt.plot(tct, F / 1e6, 'b', label='TC measurement')
    plt.plot(s.lptmed / 1e3,
             s.lpqmed / 1e2,
             'og',
             label='LP (ELMs filtered out)')
    lps = smooth(s.lpq, 151, 3)
    plt.plot(s.lpt[0:3950] / 1e3,
             lps[0:3950] / 1e2,
             'g',
             label='LP (raw)',
             linewidth=2)
    #lpqfs = smooth(lpqf,501,3)
    #plt.plot(lptf/1e3,lpqfs/1e2)
    try:
        plt.plot(s.irt / 1e3, s.irq2 / 1e2 * 1.4, 'r', label='IRTV (peak)')
    except:
        print('plotting (r) integrated irtv data')
        plt.plot(s.irt / 1e3, s.irq / 1e2 * 1.4, 'r', label='IRTV (int)')
    plt.xlim([0, 6])
    plt.ylim([0, 15])
    plt.legend(loc='best')
    plt.show()
    return
Пример #2
0
        c = 0  # index for number of the same R values
        for j in range(r_q.size):
            if r_q[j] == x:
                c += 1
        # save value of R and save average jsat at that R
        rqdum = np.append(rqdum, [x])
        qdum = np.append(qdum, [np.mean(qperp_sort[i + c - 1])])

# convert to better units
rdum = rdum * 100  # m to cm
rqdum = rqdum * 100  # m to cm
e = 1.602e-19
jdum = jdum / e * 1e4  # A/cm2 to ions/m2/s

# fit a smoothed curve to the data
jsat_smooth = smooth(jdum, 11, 3)
qperp_smooth = smooth(qdum, 11, 3)

# plot everything
plt.figure()
plt.subplot(2, 1, 1)
fsize = 22  # font size for axes
#plt.plot(rdum, jdum/1e22, 's', label='data')
plt.plot(jsat.R * 100, jsat.jsat / e * 1e4 / 1e22, 's', label='data')
plt.plot(rdum, jsat_smooth / 1e22, label='fit')
# sample locations relative to steady OSP at 146.7 cm
osploc = 146.7  # cm
plt.plot([147.376 - osploc, 147.376 - osploc + .6], [0.1, 0.1], 'k')
plt.plot([148.247 - osploc, 148.247 - osploc + .6], [0.1, 0.1], 'k')
plt.plot([149.103 - osploc, 149.103 - osploc + .6], [0.1, 0.1], 'k')
plt.plot([0, 0], [0, 3], 'k')
Пример #3
0
# convert raw data to calibrated data with background subtraction
leak = 2.4e-11  # D2 mol/s  calibration leak
avo = 6.022e23  # at/mol
area = np.pi * (3e-3)**2
if cem == 0:
    pp = 5.3e-9  # calibration pressure cem off
    # get background pressures from run with empty tube
    back = pd.read_table(path + 'RunTest3', header=3)
else:
    pp = 3.0e-9  # calibration pressure cem on
    back = pd.read_table(path + 'runtest_cem_on', header=3)
    # get calibration factor
cal = leak * avo / pp / area
# smooth the background pressure noise level
h2back = smooth(np.array(back[h2]), 51, 3)
hdback = smooth(np.array(back[hd]), 51, 3)
d2back = smooth(np.array(back[d2]), 51, 3)
# make arrays the same length
diff = np.int(np.size(df[h2]) - np.size(h2back))
if diff > 0:  # data array is bigger than background array
    a = np.zeros(diff) + h2back[-1]
    h2back = np.append(h2back, a)
    a = np.zeros(diff) + hdback[-1]
    hdback = np.append(hdback, a)
    a = np.zeros(diff) + d2back[-1]
    d2back = np.append(d2back, a)
elif diff < 0:  # data array is smaller than background array
    h2back = h2back[:diff]
    hdback = hdback[:diff]
    d2back = d2back[:diff]
Пример #4
0
lpqave = np.mean(lpqarr) / 1e2  # converting W/cm2 to MW/m2
hlpqave = '{:0.2f}'.format(lpqave)
print('\nLP mean hf = ' + hlpqave + ' MW/m2 (raw average)')
try:
    lpt, lpq1, let, leq = elm_sep(s.lpt[zmin:zmax + 1], s.lpq[zmin:zmax + 1])
except:
    print('Cannot use the elm_sep function for this shot')
    lpt = s.lpt[zmin:zmax + 1]
    lpq1 = s.lpq[zmin:zmax + 1]
    let = 0.
    leq = 0.
lpt = np.array(lpt)
lpq1 = np.array(lpq1)
let = np.array(let)
leq = np.array(leq)
lpq = smooth(lpq1, 151, 3)
try:
    lptf, lpqf, letf, leqf = elm_sep(s.lpt, s.lpq)
except:
    print('Cannot use the elm_sep function for this shot')
    lptf = s.lpt
    lpqf = s.lpq
    letf = 0.
    leqf = 0.
lptf = np.array(lptf)
lpqf = np.array(lpqf)
letf = np.array(letf)
leqf = np.array(leqf)
#lpqf = smooth(lpqf,501,3)
# heat flux used in calculating inter-ELM temperature history
lpqinter = np.mean(lpq) / 1e2
Пример #5
0
import numpy as np
import matplotlib.pyplot as plt
from scipy.special import erfc
import import_hfdecon_data as decondata
from cookbook import savitzky_golay as smooth
from scipy.interpolate import interp1d
from scipy.optimize import curve_fit
from scipy.stats import pearsonr

#---------------------------------------------------------------------
# Compare IR data to TC deconvolution
# shot 167353, finite=0, Finter=lpqinter, tmin=2.1, tmax=4.5, de=1Elm
# get inter-ELM IR data
irti, irqi, irte, irqe = elm_sep(s.irt, s.irq2)
# smooth inter-ELM IR data
irqsm = smooth(irqi, 1001, 3)
# interpolate smoothed data on full IR data scale
fint = interp1d(irti, irqsm)
irback = fint(s.irt)
# subtract IR heat flux background to get ELM heat fluxes
irelms = (s.irq2 - irback) * 1.
# plot TC ELM heat flux and IR ELM heat flux
f, ax = plt.subplots()
ax.plot(s.irt / 1e3, irelms / 1e2, 'r', linewidth=2, label='IR ELMs')
ax.plot(tct, (Fdecon - Fintermed) / 1e6,
        'b',
        linewidth=2,
        label='TC ELM calculation')
ax.set_xlabel('t [s]', fontsize=24)
ax.set_ylabel(r'ELM heat flux [MW/m$^2$]', fontsize=24)
#plt.xlim([2.1,3.1])