Ejemplo n.º 1
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)
Ejemplo n.º 2
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 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.
Ejemplo n.º 4
0
from __future__ import division
import os
import cPickle as pickle
import argparse
import time

import LHCMeasurementTools.lhc_log_db_query as lldb
from LHCMeasurementTools.SetOfHomogeneousVariables import SetOfHomogeneousNumericVariables
import LHCMeasurementTools.myfilemanager as mfm

from GasFlowHLCalculator.h5_storage import H5_storage

import GasFlowHLCalculator

h5_storage = H5_storage(h5_dir='/eos/user/l/lhcecld/heatload_data_storage')

# Config
dt_seconds = 60
max_fill_hrs = 35
blacklist = []
blacklist.append(4948)  # 116 hour long fill, exceeds memory
blacklist.append(5488)  # 40 hour long fill, also exceeds memory

parser = argparse.ArgumentParser()
parser.add_argument('-r', help='reversed', action='store_true')
parser.add_argument('--year',
                    choices=[2012, 2015, 2016, 2017, 2018, 2019],
                    type=int,
                    default=2019)

args = parser.parse_args()
    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 h5s :-P")
        fill_dict = {}
        fill_dict.update(tm.CalsVariables_from_h5(
            data_folder_fill + ('/fill_basic_data_h5s/'
                'basic_data_fill_%d.h5'%filln_offset)))
        fill_dict.update(tm.CalsVariables_from_h5(
            data_folder_fill + ('/fill_heatload_data_h5s/'
                'heatloads_fill_%d.h5'%filln_offset)))

    if args.use_recalc:
        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)