diff --git a/Ccs/ccs_function_lib.py b/Ccs/ccs_function_lib.py index b022f46a8fe9b5b90694db4b37f3b075f7fa0284..36e388a13ad5a466b0b30ec3fae867e21cb10f71 100644 --- a/Ccs/ccs_function_lib.py +++ b/Ccs/ccs_function_lib.py @@ -2688,10 +2688,11 @@ def get_tc_calibration_and_parameters(ccf_descr=None): return calibrations_dict -def get_tm_id(ccf_descr=None): - if ccf_descr is None: +def get_tm_id(pcf_descr=None): + if pcf_descr is None: tms = scoped_session_idb.execute('SELECT pid_type, pid_stype, pid_apid, pid_pi1_val, pid_descr, pid_tpsd, ' - 'pid_spid, pcf_name, pcf_descr, pcf_curtx, txp_from, txp_altxt, plf_offby ' + 'pid_spid, pcf_name, pcf_descr, pcf_curtx, txp_from, txp_altxt, plf_offby,' + 'pcf_ptc, pcf_pfc ' 'FROM pid ' 'LEFT JOIN plf ' 'ON pid_spid = plf_spid AND pid_tpsd = -1 ' @@ -2706,7 +2707,8 @@ def get_tm_id(ccf_descr=None): else: tms = scoped_session_idb.execute('SELECT pid_type, pid_stype, pid_apid, pid_pi1_val, pid_descr , pid_tpsd, ' - 'pid_spid, pcf_name, pcf_descr, pcf_curtx, txp_from, txp_altxt, plf_offby ' + 'pid_spid, pcf_name, pcf_descr, pcf_curtx, txp_from, txp_altxt, plf_offby,' + 'pcf_ptc, pcf_pfc ' 'FROM pid ' 'LEFT JOIN plf ' 'ON pid_spid = plf_spid AND pid_tpsd = -1 ' @@ -2730,6 +2732,25 @@ def get_tm_id(ccf_descr=None): return tms_dict +def get_data_pool_items(pcf_descr = None): + if pcf_descr is None: + data_pool = scoped_session_idb.execute('SELECT pcf_pid, pcf_descr, pcf_ptc, pcf_pfc ' + 'FROM pcf').fetchall() + + else: + data_pool = scoped_session_idb.execute('SELECT pcf_pid, pcf_descr, pcf_ptc, pcf_pfc ' + 'FROM pcf'.format(ccf_descr)).fetchall() + + scoped_session_idb.close() + + data_pool_dict = {} + + for row in data_pool: + data_pool_dict.setdefault(row[0:4], []).append(row[5:]) + + + return data_pool_dict + def make_tc_template(ccf_descr, pool_name='LIVE', preamble='cfl.Tcsend_DB', options='', comment=True, add_parcfg=False):