コード例 #1
0
alldas = []
for ts in np.linspace(tstart, tstart + seg_len * dt, nfull, endpoint=False):
    results = LP.process_swept_Langmuir(t_range=[ts, tend],
                                        dtseg=seg_len,
                                        plot_DA=plot_DA,
                                        **kwargs)
    if hasattr(LP, 'da'):
        alldas.append(LP.da)

# this one must start at a V maximum
half_kwargs = dict(dtseg=seg_len // 2, **kwargs)
fit_params = half_kwargs['fit_params']

cycavg_h = fit_params['cycavg']
if cycavg_h is not None and (seg_len // 2) < cycavg_h[0]:
    cycavg_h = [seg_len // 2, 1, cycavg_h[2]]
    fit_params.update(dict(cycavg=cycavg_h))
    half_kwargs.update(dict(fit_params=fit_params))

for ts in np.linspace(tstart, tstart + seg_len * dt, nhalf, endpoint=False):
    results = LP.process_swept_Langmuir(t_range=(ts, tend),
                                        plot_DA=plot_DA,
                                        **half_kwargs)
    if hasattr(LP, 'da'):
        alldas.append(LP.da)

bigda = DA(alldas[0].copyda())
for da in alldas[1:]:
    bigda.append(da)
コード例 #2
0
if remerge:  #
    #tmpDA_file holds the merged flucstrucs until they can be merged into da
    tmpDA_file = '/tmp/DA_{sht}.npz'.format(sht=sht)
    # flucfiles is the wildcard name for the files processed on h1svr or locally
    mcmd = '''python pyfusion/examples/merge_text_pyfusion.py 'file_list=np.sort(glob("{tfile}"))' exception=Exception save_filename={DA_file}'''.format(
        sht=sht, tfile=flucfiles, DA_file=tmpDA_file)
    sub_pipe = subprocess.Popen(mcmd,
                                shell=True,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE)
    print('merging')
    (resp, err) = sub_pipe.communicate()
    print(resp, err)
    newda = DA(tmpDA_file, load=1)
    da.append(newda.da)

    print('{n} shots in {da}'.format(n=len(np.unique(da.da['shot'])),
                                     da=da.name))

da.extract(locals())

if boydsdata:
    ph = -phases
else:
    ph = phases

ws = np.where(sht == shot)[0]
ph = ph[ws]

print('where on {0:,}x{1} phases '.format(*np.shape(ph))),
コード例 #3
0
ファイル: realtime_mode.py プロジェクト: bdb112/pyfusion
    print(err)
    with open(flucfiles.replace('*','_'),'w') as txtfile:
        txtfile.write(resp)

if remerge:  #  
    #tmpDA_file holds the merged flucstrucs until they can be merged into da
    tmpDA_file = '/tmp/DA_{sht}.npz'.format(sht=sht)
    # flucfiles is the wildcard name for the files processed on h1svr or locally
    mcmd = '''python pyfusion/examples/merge_text_pyfusion.py 'file_list=np.sort(glob("{tfile}"))' exception=Exception save_filename={DA_file}'''.format(sht=sht,tfile=flucfiles,DA_file=tmpDA_file)
    sub_pipe = subprocess.Popen(mcmd,  shell=True, stdout=subprocess.PIPE,
                                        stderr=subprocess.PIPE)
    print('merging') 
    (resp,err) = sub_pipe.communicate()
    print(resp,err)
    newda = DA(tmpDA_file,load=1)
    da.append(newda.da)
    
    print('{n} shots in {da}'.format(n=len(np.unique(da.da['shot'])),da=da.name))

da.extract(locals())

if boydsdata:
    ph = -phases
else:
    ph = phases

ws = np.where(sht == shot)[0]
ph = ph[ws]

print('where on {0:,}x{1} phases '.format(*np.shape(ph))),
w15=where((ml[15].one_rms(ph)<thr))[0];len(w15)