Commit aec36e3b authored by Per Hagen's avatar Per Hagen 🐵 Committed by Thibaud Marie Eric Buffet
Browse files

Contributor

parent 13baa4c9
__version__ = "1.5.57"
__version__ = "1.5.58"
......@@ -26,24 +26,24 @@
%% Cell type:code id: tags:
``` python
# External libraries
print('Loading (1/12)'); import sys; import pandas as pd
print('Loading (1/12)'); import sys, warnings
print('Loading (2/12)'); from IPython.display import display, Javascript, HTML, clear_output
print('Loading (3/12)'); import pandas as pd
# Internal libraries
print('Loading (4/12)'); import lhcsmapi
print('Loading (5/12)'); from lhcsmapi.Time import Time
print('Loading (6/12)'); from lhcsmapi.Timer import Timer
print('Loading (7/12)'); from lhcsmapi.analysis.RbCircuitQuery import RbCircuitQuery
print('Loading (8/12)'); from lhcsmapi.analysis.RbCircuitAnalysis import RbCircuitAnalysis
print('Loading (9/12)'); from lhcsmapi.analysis.report_template import apply_report_template
print('Loading (10/12)'); from lhcsmapi.gui.qh.DateTimeBaseModule import DateTimeBaseModule
print('Loading (11/12)'); from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
print('Loading (12/12)'); from lhcsmapi.analysis.expert_input import get_expert_decision
print('Loading (10/12)'); from lhcsmapi.analysis.expert_input import get_expert_decision
print('Loading (11/12)'); from lhcsmapi.gui.qh.DateTimeBaseModule import DateTimeBaseModule
print('Loading (12/12)'); from lhcsmapi.gui.hwc.HwcSearchModuleMediator import HwcSearchModuleMediator
clear_output()
lhcsmapi.get_lhcsmapi_version()
lhcsmapi.get_lhcsmhwc_version('../__init__.py')
print('Analysis performed by %s' % HwcSearchModuleMediator.get_user())
......@@ -105,11 +105,11 @@
t_end = Time.to_unix_timestamp(t_end)
t_start_ref, t_end_ref = HwcSearchModuleMediator.get_last_ref_start_end_time('/eos/project/l/lhcsm/hwc/HWC_Summary.csv', circuit_name, hwc_test, Time.to_string_short(t_start))
t_start_ref, t_end_ref = Time.to_unix_timestamp(t_start_ref), Time.to_unix_timestamp(t_end_ref)
is_automatic = False
rb_query = RbCircuitQuery(circuit_type, circuit_name, max_executions=35)
rb_query = RbCircuitQuery(circuit_type, circuit_name, max_executions=40)
with Timer():
source_timestamp_pc = rb_query.find_source_timestamp_pc(t_start, t_end)
timestamp_fgc = source_timestamp_pc.at[0, 'timestamp']
......@@ -144,10 +144,11 @@
t_res_even_0_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_even_df.loc[0, 'timestamp'], timestamp_fgc, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_EVEN')
if len(source_timestamp_ee_even_df) > 1:
t_res_even_1_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_even_df.loc[1, 'timestamp'], timestamp_fgc, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_EVEN')
else:
t_res_even_1_df = [pd.DataFrame(columns=['T_RES_BODY_1']), pd.DataFrame(columns=['T_RES_BODY_2']), pd.DataFrame(columns=['T_RES_BODY_3'])]
# EE TEMPERATURE REF
source_timestamp_ee_odd_ref_df = rb_query.find_source_timestamp_ee(timestamp_fgc_ref, system='EE_ODD')
source_timestamp_ee_even_ref_df = rb_query.find_source_timestamp_ee(timestamp_fgc_ref, system='EE_EVEN')
t_res_odd_0_ref_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_odd_ref_df.loc[0, 'timestamp'], timestamp_fgc_ref, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_ODD')
......@@ -158,10 +159,11 @@
t_res_even_0_ref_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_even_ref_df.loc[0, 'timestamp'], timestamp_fgc_ref, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_EVEN')
if len(source_timestamp_ee_even_ref_df) > 1:
t_res_even_1_ref_df = rb_query.query_ee_t_res_pm(source_timestamp_ee_even_ref_df.loc[1, 'timestamp'], timestamp_fgc_ref, signal_names=['T_RES_BODY_1', 'T_RES_BODY_2', 'T_RES_BODY_3'], system='EE_EVEN')
else:
t_res_even_1_ref_df = [pd.DataFrame(columns=['T_RES_BODY_1']), pd.DataFrame(columns=['T_RES_BODY_2']), pd.DataFrame(columns=['T_RES_BODY_3'])]
# U_DIODE - CALS
u_diode_rb_dfs = rb_query.query_voltage_nxcals('DIODE_RB', 'U_DIODE_RB', timestamp_fgc, spark=spark, duration=[(50, 's'), (350, 's')])
# iQPS, nQPS - PM
source_timestamp_qds_df = rb_query.find_source_timestamp_qds(timestamp_fgc)
......@@ -187,11 +189,11 @@
# DIODE LEADS
i_a_u_diode_u_ref_pm_dfs = rb_query.query_current_voltage_diode_leads_pm(timestamp_fgc, source_timestamp_qds_df)
i_meas_u_diode_nxcals_dfs = rb_query.query_current_voltage_diode_leads_nxcals(source_timestamp_qds_df, spark=spark, duration=[(50, 's'), (350, 's')])
# U_EARTH
u_earth_rb_dfs = rb_query.query_voltage_nxcals('VF', 'U_EARTH_RB', timestamp_fgc, ldb=ldb, duration=[(50, 's'), (350, 's')])
u_earth_rb_dfs = rb_query.query_voltage_nxcals('VF', 'U_EARTH_RB', timestamp_fgc, spark=spark, duration=[(50, 's'), (350, 's')])
# DFB
source_timestamp_leads_odd_df = rb_query.find_timestamp_leads(timestamp_fgc, 'LEADS_ODD')
u_hts_odd_dfs = rb_query.query_leads(timestamp_fgc, source_timestamp_leads_odd_df, system='LEADS_ODD', signal_names=['U_HTS'], spark=spark)
u_res_odd_dfs = rb_query.query_leads(timestamp_fgc, source_timestamp_leads_odd_df, system='LEADS_ODD', signal_names=['U_RES'], spark=spark)
......@@ -490,11 +492,11 @@
```
%% Cell type:code id: tags:
``` python
u_diode_with_quench_rb_dfs = rb_analysis.filter_quenched_magnets(u_diode_rb_dfs)
u_diode_with_quench_rb_dfs = rb_analysis.filter_quenched_magnets(u_diode_rb_dfs, results_table['Position'])
rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_with_quench_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', legend=True, xlim=(-5, 350))
rb_analysis.analyze_u_diode_nqps(circuit_name, timestamp_fgc, i_meas_df, u_diode_with_quench_rb_dfs, 'U_DIODE_RB', 'DIODE_RB', legend=True, xlim=(-2, 3))
```
%% Cell type:markdown id: tags:
......@@ -569,13 +571,20 @@
%% Cell type:code id: tags:
``` python
# iQPS Threshold
threshold_iqps = 0.1
```
%% Cell type:code id: tags:
``` python
%matplotlib inline
if u_nqps_dfs:
rb_analysis.analyze_qds(timestamp_fgc, min(timestamp_pic), u_qds_dfs, u_nqps_dfs, i_meas_df)
rb_analysis.analyze_qds(timestamp_fgc, min(timestamp_pic), u_qds_dfs, u_nqps_dfs, i_meas_df, threshold=threshold_iqps)
rb_analysis.results_table[['Circuit Name', 'Position', 'nQPS crate name', 'Delta_t(iQPS-PIC)','I_Q_circ', 'I_Q_M', 'Delta_t(nQPS-PIC)', 'QDS trigger origin', 'dU_iQPS/dt', 'Type of Quench']]
```
%% Cell type:markdown id: tags:
......@@ -680,11 +689,11 @@
```
%% Cell type:code id: tags:
``` python
if not fgc_pm_search.is_automatic_mode():
if not is_automatic:
rb_analysis.results_table['V feeler analysis'] = get_expert_decision('Voltage feeler analysis: ', ['PASS', 'FAIL'])
```
%% Cell type:markdown id: tags:
......@@ -711,11 +720,11 @@
- green horizontal dashed line denotes the EE even timestamp
%% Cell type:code id: tags:
``` python
rb_analysis.analyze_leads_voltage(u_hts_odd_dfs+u_hts_even_dfs, circuit_name, timestamp_fgc, timestamp_qps=source_timestamp_qds_df.loc[0, 'timestamp'], signal='U_HTS', value_min=-0.001, value_max=0.001)
rb_analysis.analyze_leads_voltage(u_hts_odd_dfs+u_hts_even_dfs, circuit_name, timestamp_fgc, timestamp_qps=source_timestamp_qds_df.loc[0, 'timestamp'], signal='U_HTS', value_min=-0.003, value_max=0.003)
```
%% Cell type:code id: tags:
``` python
......@@ -729,12 +738,13 @@
```
%% Cell type:code id: tags:
``` python
rb_analysis.results_table['FPA Reason'] = get_expert_decision('Reason for FPA: ', ['Heater-provoked', 'QPS trip', 'Converter trip', 'EE spurious opening', 'Spurious heater firing', 'Busbar quench', 'Magnet quench', 'HTS current lead quench' ,'RES current lead overvoltage', 'No quench', 'Unknown'])
rb_analysis.results_table['QDS trigger origin'] = get_expert_decision('QDS trigger origin: ', ['QPS', 'HTS current lead', 'RES current lead','Busbar', 'No quench'])
if not is_automatic:
rb_analysis.results_table['FPA Reason'] = get_expert_decision('Reason for FPA: ', ['Heater-provoked', 'QPS trip', 'Converter trip', 'EE spurious opening', 'Spurious heater firing', 'Busbar quench', 'Magnet quench', 'HTS current lead quench' ,'RES current lead overvoltage', 'No quench', 'Unknown'])
rb_analysis.results_table['QDS trigger origin'] = get_expert_decision('QDS trigger origin: ', ['QPS', 'HTS current lead', 'RES current lead','Busbar', 'No quench'])
```
%% Cell type:markdown id: tags:
# 9. Plot of Energy Extraction after 3 h from an FPA
......@@ -772,11 +782,12 @@
# 10. Signature Decision
%% Cell type:code id: tags:
``` python
signature = get_expert_decision('Expert Signature Decision: ', ['PASSED', 'FAILED'])
if not is_automatic:
signature = get_expert_decision('Expert Signature Decision: ', ['PASSED', 'FAILED'])
```
%% Cell type:markdown id: tags:
# 11. Final Report
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment