fills_string += '_%d' % filln
 fill_dict = {}
 if os.path.isdir(data_folder_fill + '/fill_basic_data_csvs'):
     fill_dict.update(
         tm.parse_timber_file(
             data_folder_fill +
             '/fill_basic_data_csvs/basic_data_fill_%d.csv' % filln,
             verbose=False))
     fill_dict.update(
         tm.parse_timber_file(
             data_folder_fill +
             '/fill_bunchbybunch_data_csvs/bunchbybunch_data_fill_%d.csv' %
             filln,
             verbose=False))
     if use_recalculated:
         fill_dict.update(qf.get_fill_dict(filln))
     else:
         fill_dict.update(
             tm.parse_timber_file(
                 data_folder_fill +
                 '/fill_heatload_data_csvs/heatloads_fill_%d.csv' % filln,
                 verbose=False))
 elif os.path.isdir(data_folder_fill + '/fill_basic_data_h5s'):
     fill_dict.update(
         tm.CalsVariables_from_h5(
             data_folder_fill +
             '/fill_basic_data_h5s/basic_data_fill_%d.h5' % filln, ))
     fill_dict.update(
         tm.CalsVariables_from_h5(
             data_folder_fill +
             '/fill_bunchbybunch_data_h5s/bunchbybunch_data_fill_%d.h5' %
Exemple #2
0
    filln_offset = fill_info.filln_at_time(t_zero_unix)

    data_folder_fill = dict_fill_bmodes[filln_offset]['data_folder']

    try:
        fill_dict = tm.timber_variables_from_h5(data_folder_fill+'/heatloads_fill_h5s/heatloads_all_fill_%d.h5'%filln_offset)
        print 'From h5!'
    except IOError:
        print "h5 file not found, using csvs"
        fill_dict = {}
        fill_dict.update(tm.parse_timber_file(data_folder_fill+'/fill_basic_data_csvs/basic_data_fill_%d.csv'%filln_offset, verbose=False))
        fill_dict.update(tm.parse_timber_file(data_folder_fill+'/fill_heatload_data_csvs/heatloads_fill_%d.csv'%filln_offset, verbose=False))

    if args.use_recalc:
        #import GasFlowHLCalculator.qbs_fill as qf
        fill_dict.update(qf.get_fill_dict(filln_offset,h5_storage=H5_storage(recalc_h5_folder),use_dP=True))


    dict_offsets={}
    for kk in hl_varlist:
        dict_offsets[kk] = np.interp(t_zero_unix, np.float_(np.array(fill_dict[kk].t_stamps)), fill_dict[kk].float_values())


pl.close('all')
ms.mystyle_arial(fontsz=fontsz, dist_tick_lab=9)
fig = pl.figure(1, figsize=figsz)
fig.patch.set_facecolor('w')
ax1 = fig.add_subplot(311)
ax11 = ax1.twinx()
ax2 = fig.add_subplot(312, sharex=ax1)
ax3 = fig.add_subplot(313, sharex=ax1)
Exemple #3
0
    t_sample_h = snapshots[i_snapshot]['t_h']
    t_offset_h = snapshots[i_snapshot]['t_offs_h']

    # get location of current data
    data_folder_fill = dict_fill_bmodes[filln]['data_folder']
    t_fill_st = dict_fill_bmodes[filln]['t_startfill']
    t_fill_end = dict_fill_bmodes[filln]['t_endfill']
    t_ref = t_fill_st
    tref_string = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(t_ref))
    tref_string_short = time.strftime("%d %b %Y %H:%M", time.localtime(t_ref))

    if from_published:
        fill_file = f"{data_folder_fill}/fill_cell_by_cell_heatload_data_h5s/cell_by_cell_heatloads_fill_{filln}.h5"
        hid = tm.CalsVariables_from_h5(fill_file)
    else:
        hid = qf.get_fill_dict(filln, h5_storage=H5_storage(recalc_h5_folder))

    # extract standard fill data
    fill_dict = {}
    if os.path.isdir(data_folder_fill + '/fill_basic_data_csvs'):
        # 2016 structure
        fill_dict.update(
            tm.parse_timber_file(
                data_folder_fill +
                '/fill_basic_data_csvs/basic_data_fill_%d.csv' % filln,
                verbose=args.v))
        fill_dict.update(
            tm.parse_timber_file(
                data_folder_fill +
                '/fill_bunchbybunch_data_csvs/bunchbybunch_data_fill_%d.csv' %
                filln,
    if args.subtract_offset:
        for sp_ in sp, sphlcell:
            for tt_ in t_start_injphys, (t_start_injphys - 600 / 3600.):
                sp_.axvline(tt_, color='black', ls='--', lw=2)

plt.figure(fig.number)
# Heat load q6
quad_keys_list.sort()
sp_quad = plt.subplot(2, 2, 4, sharex=sptotint)
for sp_ in (sp_quad, sp2):
    sp_.set_title('Q6 standalones')
    sp_.grid(True)
    sp_.set_xlabel('Time [h]')
    sp_.set_ylabel('Heat load [W]')
fill_dict_recalc = qf.get_fill_dict(filln)
heatloads_recalc = SetOfHomogeneousNumericVariables(
    variable_list=quad_keys_list, timber_variables=fill_dict_recalc)


def plot_both(*args, **kwargs):
    sp2.plot(*args, **kwargs)
    sp_quad.plot(*args, **kwargs)


if no_use_dP:
    fill_dict_nodp = qf.get_fill_dict(filln, use_dP=False)
    heatloads_nodp = SetOfHomogeneousNumericVariables(
        variable_list=quad_keys_list, timber_variables=fill_dict_nodp)
for ctr, key in enumerate(quad_keys_list):
    color = ms.colorprog(ctr, len(quad_keys_list) + 1)
    if not use_recalculated:
        fill_dict.update(tm.parse_timber_file(data_folder_fill+'/fill_heatload_data_csvs/heatloads_fill_%d.csv'%filln, verbose=False))
else:
    # 2015 structure
    fill_dict = {}
    fill_dict.update(tm.parse_timber_file(data_folder_fill+'/fill_csvs/fill_%d.csv'%filln, verbose=True))



if use_recalculated:
    print 'Using recalc data'
    # remove db values from dictionary (for 2015 cases)
    for kk in fill_dict.keys():
        if 'QBS' in kk and '.POSST'in kk:
            fill_dict[kk] = 'Not recalculated'
    fill_dict.update(qf.get_fill_dict(filln, h5_storage=H5_storage(recalc_h5_folder), use_dP=use_dP))
# Handle additional csvs
for csv in added_csvs:
    fill_dict.update(tm.parse_timber_file(csv), verbose=True)


dict_beam = fill_dict
dict_fbct = fill_dict

energy = Energy.energy(fill_dict, beam=1)

t_fill_st = dict_fill_bmodes[filln]['t_startfill']
t_fill_end = dict_fill_bmodes[filln]['t_endfill']
t_fill_len = t_fill_end - t_fill_st
t_min = dict_fill_bmodes[filln]['t_startfill']-0*60.
t_max = dict_fill_bmodes[filln]['t_endfill']+0*60.
Exemple #6
0
N_snapshots = len(snapshots)

for i_snapshot in xrange(N_snapshots):

    filln = snapshots[i_snapshot]['filln']
    t_sample_h = snapshots[i_snapshot]['t_h']
    t_offset_h = snapshots[i_snapshot]['t_offs_h']
    if args.zeroat is not None:
        t_offset_h = None

    if from_csv:
        fill_file = 'fill_heatload_data_csvs/hl_all_cells_fill_%d.csv' % filln
        hid = tm.parse_timber_file(fill_file, verbose=args.v)
    else:
        hid = qf.get_fill_dict(filln, h5_storage=H5_storage(recalc_h5_folder))

    # get location of current data
    data_folder_fill = dict_fill_bmodes[filln]['data_folder']
    t_fill_st = dict_fill_bmodes[filln]['t_startfill']
    t_fill_end = dict_fill_bmodes[filln]['t_endfill']
    t_ref = t_fill_st
    tref_string = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(t_ref))
    tref_string_short = time.strftime("%d %b %Y %H:%M", time.localtime(t_ref))

    # extract standard fill data
    fill_dict = {}
    if os.path.isdir(data_folder_fill + '/fill_basic_data_csvs'):
        # 2016 structure
        fill_dict.update(
            tm.parse_timber_file(
    max_hl_scale = args.max_hl_scale

if args.t_offset:
    t_offset = args.t_offset

if args.tag:
    tagfname = args.tag

plot_model = not args.no_plot_model

from_csv = args.fromcsv
if from_csv:
    fill_file = 'fill_heatload_data_csvs/hl_all_cells_fill_%d.csv' % filln
    hid = tm.parse_timber_file(fill_file, verbose=args.v)
else:
    hid = qf.get_fill_dict(filln)

normtointen = args.normtointensity

varlist = hl.arcs_varnames_static

hid_set = shv.SetOfHomogeneousNumericVariables(varlist, hid)

# merge pickles and add info on location
dict_fill_bmodes = {}
for df in data_folder_list:
    with open(df + '/fills_and_bmodes.pkl', 'rb') as fid:
        this_dict_fill_bmodes = pickle.load(fid)
        for kk in this_dict_fill_bmodes:
            this_dict_fill_bmodes[kk]['data_folder'] = df
        dict_fill_bmodes.update(this_dict_fill_bmodes)