_var_defaults = """ lpf = 9 # approx harmonic at 3dB pt test = 0 debug = 2 # >= 2 gives text info from leastsq (not implemented?) ncycles = 2 lfnoise = [0,0,0,0] noise = [.005, .5] fit_params = {} init = None """ exec(_var_defaults) from pyfusion.utils import process_cmd_line_args exec(process_cmd_line_args()) if test: t = np.linspace(-.002, .002, 2000, endpoint=False) v = 50 * np.sin(2 * np.pi * 500 * t) charparams = (40, 20, .02) i_probe = LPchar(v, *charparams) i_probe += noise[0] * 2 * (np.random.random(len(t)) - 0.5) i_probe += (i_probe - max(i_probe)) * noise[1] * 2 * (np.random.random(len(t)) - 0.5) label = str('test - {cp}'.format(cp=charparams)) if np.max(np.abs(lfnoise)) > 0: N = len(i_probe) i_probe += np.sum([ lfnoise[i] * np.sin(2 * np.pi * i * np.arange(N) / float(N)) for i in range(len(lfnoise))
* means relative to 4byte float. """ import tables as tb import os import numpy as np from pyfusion.utils import process_cmd_line_args from time import time as seconds from pyfusion.data.DA_datamining import DA, report_mem _var_defaults = """ DFfilename='/data/datamining/DA/PF2_130813_50_5X_1.5_5b_rms_1_diags_comp5.h5' keep_open = 1 # for read, should keep open! debug=1 """ exec(_var_defaults) exec(process_cmd_line_args()) mem = report_mem('init') df = tb.open_file(DFfilename,'r') dd = {} for nd in df.list_nodes('/'): var = nd.name st_copy = seconds() v = df.get_node('/'+var) dd.update({var:v}) dt_copy = seconds() - st_copy if debug>0: print('{var} in {dt_copy:.1f}s '.format(var=var, dt_copy=dt_copy))