Ejemplo n.º 1
0
    print(filename)
    block_me = not hasattr(sys, 'ps1')

    # from_emacs was called block_me
    from_emacs = not hasattr(sys, 'ps1')
    if from_emacs:
        print('from emacs')
        os.environ['PYFUSION_VERBOSE'] = '-1'  # keep clutter down

    import pyfusion
    pyfusion.VERBOSE = -1  # why doesn't the environ above work?
    da = DA(filename, load=1, verbose=pyfusion.VERBOSE)
    if 'info' in da:
        pprint.pprint(da['info'])
    if hasattr(da, 'info'):
        da.info()
    sys.stdout.flush(
    )  # works, but not effective in emacs, at least when ! is used.

    if len(sys.argv) > 2:
        key = sys.argv[2]
    elif 'ne18' in da:
        typ = 'LP'
        key = 'ne18'
    elif 'phases' in da:
        typ = 'FS'
        key = 'phases'
    else:
        raise LookupError('Keys available are: ' + str(list(da)))

    da.plot(key)
Ejemplo n.º 2
0
""" A small MP+HMP set, just shot 65139 - note that the copy
and the extract() both duplicate data, which is good for development
and debugging, but wasteful of space.
"""
from pyfusion.data.DA_datamining import DA
from pyfusion.utils.utils import fix2pi_skips, modtwopi
from pyfusion.visual.sp import sp
from pyfusion.data.convenience import between, bw, btw, decimate, his, broaden

_var_default = """
DAfilename='300_small.npz'
"""
exec(_var_default)

from pyfusion.utils import process_cmd_line_args

exec(process_cmd_line_args())

DA300 = DA(DAfilename, load=1)
dd = DA300.copyda()
DA300.extract(locals())
DA300.info()
print("DA300", DAfilename)
Ejemplo n.º 3
0
from pyfusion.data.DA_datamining import DA
from pyfusion.utils.utils import fix2pi_skips, modtwopi
from pyfusion.visual.sp import sp
from pyfusion.data.convenience import between, bw, btw, decimate, his, broaden

DAfilename = 'PF2_121206MPRMSv2_Par_fixModes_chirp_ff.npz'
from pyfusion.utils import process_cmd_line_args
exec(process_cmd_line_args())

DA300 = DA(DAfilename, load=1)
dd = DA300.copyda()
DA300.extract(locals())
DA300.info()
print('DA300', DAfilename)
Ejemplo n.º 4
0
    print('Only {n} files found for {fl}'.format(fl=file_list, n=len(file_list)))
(ds_list, comment_list) = read_text_pyfusion(file_list, debug=debug, exception=exception, target=target)

if len(ds_list) == 0: raise LookupError('no valid files found in the {n} files in {f}'
                                        .format(f=file_list,n=len(file_list)))
if isinstance(file_list_in, str):
    comment_list = [file_list_in] + comment_list

if append_old_method:
    ds_list.append(dd)
    comment_list.extend(dd['info']['comment'])
if append:
    dd = merge_ds(ds_list, comment_list, old_dd=dd)
else:
    dd = merge_ds(ds_list, comment_list)

if save_filename != "None":
    from pyfusion.data.DA_datamining import DA
    DAtest=DA(dd)
    DAtest.info()
    DAtest.save(save_filename)









Ejemplo n.º 5
0
#_PYFUSION_TEST_@@script
from matplotlib import pyplot as plt
import numpy as np
from numpy import where, array
from pyfusion.data.DA_datamining import DA
from pyfusion.acquisition.read_text_pyfusion import read_text_pyfusion, plot_fs_DA, merge_ds
from pyfusion.visual.window_manager import rmw, cmw, omw, lmw, smw
from pyfusion.utils.utils import fix2pi_skips, modtwopi
from pyfusion.visual.sp import off, on, tog
from pyfusion.data.convenience import between, bw, btw, decimate, his, broaden


dd=DA('W7X_MIR/DAMIRNOV_41_13_nocache_15_3m_2018fl.zip')
dd.info()
fig4, axs4=plt.subplots(4,1)
figfs, axf=plt.subplots(1,1)
plot_fs_DA(dd, ax=axf)
w6=where((btw(dd['freq'],4,8)) & (dd['amp']>0.0015) & (dd['t_mid']>3.2) &(dd['shot'] == 180904035))[0]
plot_fs_DA(dd, ax=axf, inds=w6,marker='s',ms=300,alpha=0.5)
axs4[0].plot(array([modtwopi(ph,offset=0) for ph in dd['phases'][w6]]).T,'c',lw=.5)
w6=where((btw(dd['freq'],4,8)) & (dd['amp']>0.015) & (dd['t_mid']>3.2) &(dd['shot'] == 180904035))[0]
axs4[0].plot(array([modtwopi(ph,offset=0) for ph in dd['phases'][w6]]).T,'b',lw=.5)
axs4[0].set_title('4-8kHz, after 3.2s')
w0=where((btw(dd['freq'],0,2)) & (dd['amp']>0.0015) & (dd['t_mid']>3.2) &(dd['shot'] == 180904035))[0]
plot_fs_DA(dd, ax=axf, inds=w0,marker='s',ms=300,alpha=0.5)
axs4[1].plot(array([modtwopi(ph,offset=0) for ph in dd['phases'][w0]]).T,'b',lw=.5)
axs4[1].set_title('0-2kHz, > 3.2s')
w6e=where((btw(dd['freq'],4,12)) & (dd['amp']>0.015) & (dd['t_mid']<3.2) &(dd['shot'] == 180904035))[0]
plot_fs_DA(dd, ax=axf, inds=w6e,marker='^',ms=300,alpha=0.5)
axs4[2].plot(array([modtwopi(ph,offset=0) for ph in dd['phases'][w6e]]).T,'c',lw=.5)
w6e=where((btw(dd['freq'],4,12)) & (dd['amp']>0.025) & (dd['t_mid']<3.2) &(dd['shot'] == 180904035))[0]
Ejemplo n.º 6
0
""" A VERY small MP+HMP set, just shot 65139 - note that the copy
and the extract() both duplicate data, which is good for development
and debugging, but wasteful of space.
"""
from pyfusion.data.DA_datamining import DA
from pyfusion.utils.utils import fix2pi_skips, modtwopi
from pyfusion.visual.sp import sp
from pyfusion.data.convenience import between, btw, bw, decimate, his, broaden

_var_default = """
DAfilename='DA65MP2010HMPno612b5_M_N_fmax.npz'
"""

exec(_var_default)

from pyfusion.utils import process_cmd_line_args
exec(process_cmd_line_args())

DA65 = DA(DAfilename, load=1)
dd = DA65.copyda()
DA65.extract(locals())
DA65.info()
print('DA65', DAfilename)
Ejemplo n.º 7
0
""" A VERY small MP+HMP set, just shot 65139 - note that the copy
and the extract() both duplicate data, which is good for development
and debugging, but wasteful of space.
"""
from pyfusion.data.DA_datamining import DA
from pyfusion.utils.utils import fix2pi_skips, modtwopi
from pyfusion.visual.sp import sp
from pyfusion.data.convenience import between, btw, bw, decimate, his, broaden

_var_defaults="""
DAfilename='DA65MP2010HMPno612b5_M_N_fmax.npz'
"""

exec(_var_defaults)

from pyfusion.utils import process_cmd_line_args
exec(process_cmd_line_args())

DA65=DA(DAfilename,load=1)
dd=DA65.copyda() 
DA65.extract(locals())
DA65.info()
print('DA65', DAfilename)

Ejemplo n.º 8
0
if len(file_list)<10:
    print('Only {n} files found for {fl}'.format(fl=file_list, n=len(file_list)))
(ds_list, comment_list) = read_text_pyfusion(file_list, debug=debug, exception=exception, target=target)

if len(ds_list) == 0: raise LookupError('no valid files found in the {n} files in {f}'
                                        .format(f=file_list,n=len(file_list)))

if append_old_method:
    ds_list.append(dd)
    comment_list.extend(dd['info']['comment'])
if append:
    dd = merge_ds(ds_list, comment_list, old_dd=dd)
else:
    dd = merge_ds(ds_list, comment_list)

if save_filename != "None":
    from pyfusion.data.DA_datamining import DA
    DAtest=DA(dd)
    DAtest.info()
    DAtest.save(save_filename)









Ejemplo n.º 9
0
shot_list = []
diags=diag_basic
diags_scalar="b_0,R_ax,Quad,Gamma".split(',')
filename='DA_file.npz'

import pyfusion.utils
exec(pyfusion.utils.process_cmd_line_args())
# now to merge the two.
if len(np.shape(diags)) == 0: diags = [diags]

try:
    dd
except:
    print('trying file ' + filename)
    thisDA = DA(filename,load=1)
    thisDA.info()
    dd = thisDA.da
    
sz = len(dd['shot'])
missing_shots = []
good_shots =[]

ctr=0
 
if len(shot_list)==0:
    shots = np.unique(dd['shot'])
    wgt = np.where((shots >= minshot) & (shots <= maxshot))
    shot_list = shots[wgt]

for shot in shot_list:
    # ws is the set of indices corresponding to the shot
Ejemplo n.º 10
0
shot_list = []
diags = diag_basic
diags_scalar = "b_0,R_ax,Quad,Gamma".split(',')
filename = 'DA_file.npz'

import pyfusion.utils
exec(pyfusion.utils.process_cmd_line_args())
# now to merge the two.
if len(np.shape(diags)) == 0: diags = [diags]

try:
    dd
except:
    print('trying file ' + filename)
    thisDA = DA(filename, load=1)
    thisDA.info()
    dd = thisDA.da

sz = len(dd['shot'])
missing_shots = []
good_shots = []

ctr = 0

if len(shot_list) == 0:
    shots = np.unique(dd['shot'])
    wgt = np.where((shots >= minshot) & (shots <= maxshot))
    shot_list = shots[wgt]

for shot in shot_list:
    # ws is the set of indices corresponding to the shot