Exemple #1
0
def simulation_from_shot(shot):
    time_bbox = db[shot]['time_bbox']
    background_bbox = db[shot]['background_bbox']

    equilibrium_time = sum(time_bbox)/2.0
    print 'Creating LiqueEqulibirium...'
    eq = strahl.LiuqeEquilibrium(shot, equilibrium_time)

    print 'Creating DMPXData...'
    dmpx_data = dmpx_from_shot(shot).select_time(*time_bbox)
    dmpx_data = dmpx_data.remove_offset(*background_bbox)

    print 'Creating ThomsonData...'
    thomson_data = thomson.thomson_data(shot)
    thomson_data = thomson_data.select_time(*time_bbox)

    print 'Creating InversionData'
    inversion = gti.inverted_data(shot).select_time(*time_bbox)

    sim = StrahlSimulation(eq, dmpx_data, thomson_data, inversion)
    sim.gf_parameters = db[shot]
    return sim
Exemple #2
0
    gf = GradientFlux(s, influx_bbox, rho_pol=rho_pol)
    return s, gf, epsilon


def save_profiles(r, D, v, limits=(0,1)):
    mask = (limits[0] < r) & (r < limits[1]) & (D > 0)
    np.savetxt('D_profile.txt', D[mask])
    np.savetxt('r_profile.txt', r[mask])
    np.savetxt('v_profile.txt', v[mask])


if __name__ == '__main__':
    working_directory = './wk'
    of = os.path.join(working_directory, 'result', 'Arstrahl_result.dat')
    res = strahl.viz.read_results(of)
    inversion = gti.inverted_data(42314).select_time(0.7, 1.0)
    parameters = dict(
        influx_bbox = (0.725, 0.75),
        background_bbox = (0.70, 0.705),
    )

    s, gf, epsilon = from_strahl_result(inversion, res, parameters)

    plt.figure(21); plt.clf()
    s.check_time_derivatives()
    plt.axvspan(*gf.time_bbox, color='black', alpha=0.2)
    plt.draw()

    plt.figure(22); plt.clf()
    s.check_spatial_derivatives()
    plt.draw()