コード例 #1
0
    def __init__(self, calibration_config):

        self.calibration_config = calibration_config
        self.names = [cc['name'] for cc in calibration_config]
        self.files = [cc['file'] for cc in calibration_config]
        self.calibrations = [Calibration(ff) for ff in self.files]

        self.start_timestamps = [
            th.localtime2unixstamp(cc['start']) for cc in calibration_config
        ]

        self.end_timestamps = [
            th.localtime2unixstamp(cc['end']) for cc in calibration_config
        ]
コード例 #2
0
    if varname in device_blacklist:
        hl_varlist.remove(varname)


# get magnet lengths for normalization_to_length_of
if normalization_to_length_of == 'magnet':
    norm_length_dict = HL.get_dict_magnet_lengths()
if normalization_to_length_of == 'cryostat':
    norm_length_dict = HL.get_dict_cryostat_lengths()

t_start_unix =  time.mktime(time.strptime(t_start_plot, '%d-%m-%Y,%H:%M'))
t_end_unix =  time.mktime(time.strptime(t_end_plot, '%d-%m-%Y,%H:%M'))
t_ref_unix = t_start_unix
tref_string = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime(t_ref_unix))

time_conv = TH.TimeConverter(time_in, t_ref_unix, t_plot_tick_h=t_plot_tick_h)
tc = time_conv.from_unix



# 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)

fill_info = Fills_Info(dict_fill_bmodes)
fill_list = fill_info.fills_in_time_window(t_start_unix, t_end_unix)
コード例 #3
0
emitt_end_inj_h = np.interp(t_maxint, t_resampled, mean_h)
emitt_end_inj_v = np.interp(t_maxint, t_resampled, mean_v)

Demitt_h_Dt_um_h = (np.interp(t_maxint + DT_Demitt_s, t_resampled, mean_h) -
                    emitt_end_inj_h) / DT_Demitt_s * 3600.
Demitt_h_Dt_um_v = (np.interp(t_maxint + DT_Demitt_s, t_resampled, mean_v) -
                    emitt_end_inj_v) / DT_Demitt_s * 3600.

pl.close('all')
lw = 2
ms.mystyle_arial(fontsz=14, dist_tick_lab=5)

# Time manipulation
import LHCMeasurementTools.TimestampHelpers as th

time_conv = th.TimeConverter(time_in='hourtime')
tc = time_conv.from_unix

fig1 = pl.figure(1, figsize=(8 * 1.1, 6 * 1.5))
fig1.set_facecolor('w')
sp1 = pl.subplot(4, 1, 1)
pl.plot(tc(bct.t_stamps), bct.values, lw=lw, color={1: 'b', 2: 'r'}[beam])
sp1.set_ylim(bottom=0.)
sp1.set_ylabel('Intensity [p]')

sp2 = pl.subplot(4, 1, 2, sharex=sp1)
pl.plot(tc(t_resampled), mean_h, 'b')
pl.fill_between(x=tc(t_resampled),
                y1=np.nan_to_num(mean_h - std_h),
                y2=np.nan_to_num(mean_h + std_h),
                color='b',
コード例 #4
0
def with_empty_slots(lifet_woBO_h, slots):

    mat = lifet_woBO_h.copy()
    outp = np.zeros((mat.shape[0], 3564), dtype=float)
    outp[:, slots] = mat

    return outp


plt.close('all')
ms.mystyle_arial(fontsz=14, dist_tick_lab=5)
# Instantaneous lumi is in m^-2 s^-1

t_stamps = fill_data['time_range']
time_conv = th.TimeConverter(time_in='h',
                             t_plot_tick_h=None,
                             t_ref=t_stamps[0])
tc = time_conv.from_unix

t_start_SB = t_stamps[0]
t_stop_SB = t_stamps[-1]

physics_BP_end = "PHYSICS-6.5TeV-30cm-120s-2018_V1@120_[END]"
physics_BP = "PHYSICS-6.5TeV-30cm-120s-2018_V1"
lsa = pjlsa.LSAClient()

QP_offsets = {
    'LHCBEAM1/QPH': 15. - 7.95981,
    'LHCBEAM1/QPV': 15. - 20.1143,
    'LHCBEAM2/QPH': 15. - 8.51945,
    'LHCBEAM2/QPV': 15. - 18.32254,
コード例 #5
0
    #'2017_09_25 16:00:00!2017_09_26 16:00:00', #
]

#pkl_name = 'fills_and_bmodes.pkl'
json_name = 'fills_and_bmodes.json'

ldb = pytimber.LoggingDB(source='nxcals')
#ldb = pytimber.LoggingDB()

dict_fill_info = {}
for period in periods:

    t_start_string = period.split('!')[0]
    t_stop_string = period.split('!')[1]

    t_start = th.localtime2unixstamp(t_start_string)
    t_stop = th.localtime2unixstamp(t_stop_string)

    # Get data from database
    data_fnum = tm.CalsVariables_from_pytimber(
        ldb.get(['HX:FILLN'], t_start, t_stop))
    list_bmodes = ldb.getLHCFillsByTime(t_start, t_stop)

    # Generate dictionary
    dict_fill_info.update(
        Fills.make_fill_info_dict(data_fnum, list_bmodes, t_stop))

# with open(pkl_name, 'wb') as fid:
#     pickle.dump(dict_fill_info, fid)

import json
コード例 #6
0

def with_empty_slots(lifet_woBO_h, slots):
    
    mat = lifet_woBO_h.copy()
    outp = np.zeros((mat.shape[0], 3564), dtype=float)
    outp[:, slots]=mat

    return outp



plt.close('all')
ms.mystyle_arial(fontsz=14, dist_tick_lab=5)

t_start_SB = th.localtime2unixstamp(t_start_string)
t_stop_SB = th.localtime2unixstamp(t_stop_string)

time_conv = th.TimeConverter(time_in='h', t_plot_tick_h=None, t_ref=np.float_(t_start_SB))
tc = time_conv.from_unix


lsa = pjlsa.LSAClient()

QP_offsets = {
'LHCBEAM1/QPH': 15.-7.95981,
'LHCBEAM1/QPV': 15.-20.1143,
'LHCBEAM2/QPH': 15.-8.51945,
'LHCBEAM2/QPV': 15.-18.32254,
}
コード例 #7
0
import LHCMeasurementTools.lhc_log_db_query as lldb
import LHCMeasurementTools.TimestampHelpers as th
import LHCMeasurementTools.LHC_Fills as Fills

t_start_string = '2016_04_21 18:00:00'
t_stop_string = '2016_04_25 08:00:00'

t_start = th.localtime2unixstamp(t_start_string)
t_stop = th.localtime2unixstamp(t_stop_string)

filename = 'fills_and_bmodes'
csv_name = filename + '.csv'
pkl_name = filename + '.pkl'

# Get data from database
varlist = Fills.get_varlist()
lldb.dbquery(varlist, t_start, t_stop, csv_name)

# Make pickle
Fills.make_pickle(csv_name, pkl_name, t_stop)