if seg_dt is not None and n_samples is not None: raise ValueError('both n_samples and seg_dt are set!') count = 0 # we print the header right before the first data for shot in shot_range: while(os.path.exists(pyfusion.root_dir+'/pause')): print('paused until '+ pyfusion.root_dir+'/pause'+ ' is removed') sleep(int(20*(1+random.uniform()))) # wait 20-40 secs, so they don't all start together timeinfo('start shot {s}'.format(s=shot)) try: d = lhd.acq.getdata(shot, diag_name) if n_samples is None: n_samples = next_nice_number(seg_dt*d.timebase.sample_freq) print('n_samples set to {n}'.format(n=n_samples)) timeinfo('data read') n_channels = len(d.channels) if time_range != None: d.reduce_time(time_range, copy=False) sections = d.segment(n_samples, overlap) print(d.history, len(sections), pyfusion.version.get_version('verbose')) try: for k in pyfusion.conf.history.keys(): print(pyfusion.conf.history[k][0].split('"')[1]) if info>1: sys.stdout.writelines(pyfusion.conf.utils.dump()) except: pass
print('paused until '+ pyfusion.root_dir+'/pause'+ ' is removed') sleep(int(20*(1+random.uniform()))) # wait 20-40 secs, so they don't all start together timeinfo('start shot {s}'.format(s=shot)) try: d = dev.acq.getdata(shot, diag_name) timeinfo('data read') try: n_channels = len(d.channels) except: raise LookupError('{dn} is not a multi_channel diagnostic' .format(dn=diag_name)) dt = np.average(np.diff(d.timebase)) if n_samples is None: n_samples = next_nice_number(seg_dt/dt) write('Choosing {N} samples to cover {seg_dt}\n' .format(N=n_samples, seg_dt=seg_dt)) if (n_samples>n_samples_max) or (n_samples < 16): # this will catch milliseconds vs seconds errors sys.stderr.writelines('########### Warning: n_samples ({ns}) > n_samples_max ({nsm}) ###' .format(ns=n_samples, nsm=n_samples_max)) if time_range != None: if type(time_range)==str: # strings are recipes for finding shot times time_range = find_shot_times(dev, shot, time_range) d.reduce_time(time_range, copy=False) sections = d.segment(n_samples, overlap) if info+first > 0: write('<<{h}, {l} sections, version = {vsn}\n' .format(h=d.history, l=len(sections),
if seg_dt is not None and n_samples is not None: raise ValueError('both n_samples and seg_dt are set!') count = 0 # we print the header right before the first data for shot in shot_range: while (os.path.exists(pyfusion.root_dir + '/pause')): print('paused until ' + pyfusion.root_dir + '/pause' + ' is removed') sleep(int(20 * (1 + random.uniform())) ) # wait 20-40 secs, so they don't all start together timeinfo('start shot {s}'.format(s=shot)) try: d = lhd.acq.getdata(shot, diag_name) if n_samples is None: n_samples = next_nice_number(seg_dt * d.timebase.sample_freq) print('n_samples set to {n}'.format(n=n_samples)) timeinfo('data read') n_channels = len(d.channels) if time_range != None: d.reduce_time(time_range, copy=False) sections = d.segment(n_samples, overlap) print(d.history, len(sections), pyfusion.version.get_version('verbose')) try: for k in pyfusion.conf.history.keys(): print(pyfusion.conf.history[k][0].split('"')[1]) if info > 1: sys.stdout.writelines(pyfusion.conf.utils.dump())
this_time_range = time_range print('this_time_range = ', this_time_range) try: d = dev.acq.getdata(shot, diag_name, time_range=this_time_range) timeinfo('data read') if 'diff_dimraw' in d.params: d.params['diff_dimraw'] = None # save space try: n_channels = len(d.channels) except: raise LookupError( '{dn} is not a multi_channel diagnostic'.format(dn=diag_name)) dt = np.nanmean(np.diff(d.timebase)) if n_samples is None: n_samples = next_nice_number(seg_dt / dt) write('Choosing {N} samples to cover {seg_dt}\n'.format( N=n_samples, seg_dt=seg_dt)) if (n_samples > n_samples_max) or (n_samples < 16): # this will catch milliseconds vs seconds errors sys.stderr.writelines( '########### Warning: n_samples ({ns}) > n_samples_max ({nsm}) ###' .format(ns=n_samples, nsm=n_samples_max)) if time_range != None: if type(time_range ) == str: # strings are recipes to find shot times # 'nonan; is thelast resort for mixed starts in npz - # prefer 'find_secs_rel_t1' (is this same as 'old_find'? if time_range == 'nonan': wnonan = np.where(~np.isnan(np.sum(d.signal, axis=0)))[0]