Commit b6e106a4 authored by Michal Maciejewski's avatar Michal Maciejewski
Browse files

Refactored RQ HWC notebooks

parent b45e26d8
......@@ -58,6 +58,20 @@ deploy_production_eos_it:
before_script: []
after_script: []
deploy_production_eos_ipd:
stage: deploy
variables:
"EOS_PATH": "/eos/project/l/lhcsm/hwc/lhc-sm-hwc/ipd"
"CI_OUTPUT_DIR": "ipd"
# Only when the pushed with tags
only:
- tags
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer
script:
- deploy-eos
before_script: []
after_script: []
variables:
KRB5CCNAME: "/tmp/krb5cc"
NAME: "gitlab-registry.cern.ch/pkothuri/spark-pipelines/sparknotebook"
......
......@@ -27,11 +27,10 @@
"- If the main current is present, its axis is on the left. Remaining signals are attached to the axis on the right. The legend of these signals is located on the lower left and upper right, respectively.\n",
"- The grid comes from the left axis\n",
"- Title contains timestamp, circuit name, signal name allowing for re-access the signal.\n",
"- The plots assigned to the left scale got colors: blue (C0) and orange (C1). Plots presented on the right have colors red (C2) and green (C3).\n",
"- Each plot has an individual time-synchronization mentioned explicitly in the description.\n",
"- If an axis has a single signal, change color of the label to match the signal's color. Otherwise, the label color is black.\n",
"- If an axis has a single signal, change color of the label to match the signal's color. Otherwise, the label color is black.\n",
"\n"
]
},
{
......@@ -39,16 +38,15 @@
"metadata": {},
"source": [
"# 0. Initialise Working Environment"
]
},
{
 
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
"editable": false
},
"outputs": [],
"source": [
"import io\n",
......@@ -57,30 +55,14 @@
"import pandas as pd\n",
"import numpy as np\n",
"from datetime import datetime\n",
"import time\n",
"from IPython.display import display, Javascript, HTML\n",
"# lhc-sm-api\n",
"from lhcsmapi.Time import Time\n",
"from lhcsmapi.Timer import Timer\n",
"from lhcsmapi.pyedsl.QueryBuilder import QueryBuilder\n",
"from lhcsmapi.analysis.R600ACircuitQuery import R600ACircuitQuery\n",
"from lhcsmapi.analysis.expert_input import get_expert_decision\n",
"from lhcsmapi.analysis.report_template import apply_report_template\n",
"\n",
"from lhcsmapi.metadata.SignalMetadata import SignalMetadata\n",
"# lhc-sm-api\n",
"from lhcsmapi.Time import Time\n",
"from lhcsmapi.gui.qh.DateTimeBaseModule import DateTimeBaseModule\n",
"from lhcsmapi.gui.pc.FgcPmSearchModuleMediator import FgcPmSearchModuleMediator\n",
"from lhcsmapi.gui.pc.R600AFgcPmSearchBaseModule import R600ARcbxhvFgcPmSearchBaseModule\n",
"from lhcsmapi.Timer import Timer\n",
"analysis_start_time = datetime.now().strftime(\"%Y.%m.%d_%H%M%S.%f\")"
]
},
{
"cell_type": "markdown",
"from lhcsmapi.analysis.R600ACircuitQuery import R600ACircuitQuery\n",
"from lhcsmapi.analysis.expert_input import get_expert_decision\n",
"from lhcsmapi.analysis.report_template import apply_report_template\n",
"from lhcsmapi.analysis.R600ACircuitAnalysis import R600ACircuitAnalysis\n",
"from lhcsmapi.metadata.SignalMetadata import SignalMetadata\n",
......@@ -100,11 +82,10 @@
" print('Analysis executed with lhc-sm-hwc notebooks version: {}'.format(version))"
]
},
{
"cell_type": "markdown",
"## 0.3. Notebook Version"
"metadata": {},
"source": [
"# 1. Select FGC Post Mortem Entry"
]
},
......@@ -234,47 +215,47 @@
"- 2 PM DQAMGNA (A+B) files and 1 PM EE file should be generated for 600 A circuits with EE\n",
"- Difference between QPS board A and B timestamp = 1 ms\n",
"- PC timestamp is QPS timestamp +/- 20 ms\n",
"\n",
"If one or more of these conditions are not fulfilled, then an in-depth analysis has to be performed by the QPS team."
"results_table = query_rcbxh.create_report_analysis_template_rcbx(timestamp_fgc_rcbxh, timestamp_fgc_rcbxv, circuit_names, author=author)\n",
 
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
 
 
"editable": false
},
"outputs": [],
"source": [
"The analysis for MP3 consists of checking the existence of PM file and of consistency of the PM timestamps (PC, QPS). The criterion of passing this test described in detail in 600APIC2.\n",
"timestamp_dct = {'FGC_RCBXH': timestamp_fgc_rcbxh, 'FGC_RCBXV': timestamp_fgc_rcbxv, \n",
" 'PIC_RCBXH': timestamp_pic_rcbxh, 'PIC_RCBXV': timestamp_pic_rcbxv, \n",
" 'QDS_A_RCBXH':source_timestamp_qds_rcbxh_df.loc[0, 'timestamp'] if len(source_timestamp_qds_rcbxh_df) > 0 else np.nan, \n",
" 'QDS_B_RCBXH':source_timestamp_qds_rcbxh_df.loc[1, 'timestamp'] if len(source_timestamp_qds_rcbxh_df) > 1 else np.nan,\n",
" 'QDS_A_RCBXV':source_timestamp_qds_rcbxv_df.loc[0, 'timestamp'] if len(source_timestamp_qds_rcbxv_df) > 0 else np.nan, \n",
" 'QDS_B_RCBXV':source_timestamp_qds_rcbxv_df.loc[1, 'timestamp'] if len(source_timestamp_qds_rcbxv_df) > 1 else np.nan}\n",
"\n",
"analysis_rcbxh.create_timestamp_table(timestamp_dct, circuit_name=circuit_names[0])"
 
 
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
 
 
"## 4.1. Main Current\n",
"\n",
"*QUERY*:\n",
"\n",
"timestamp_dct = {'FGC_RCBXH': timestamp_fgc_rcbxh, 'FGC_RCBXV': timestamp_fgc_rcbxv, \n",
 
"|---------------|---------------|---------------|--------|------|\n",
"|i_a_rcbx_df\t|DataFrame\t|A\t|PM|I_A is the raw RCBX power converter current logged around the FPA with high sampling frequency|\n",
"|i_meas_rcbx_df\t|DataFrame\t|A\t|PM|I_MEAS RCBX power converter current is filtered I_A with lower sampling frequency and longer duration|\n",
"|i_ref_rcbx_df\t|DataFrame\t|A\t|PM|The reference current of an RCBX power converter, I_REF|\n",
"|events_action_rcbx_df\t|DataFrame\t|text\t|PM|event action storing information about the state of an RCBX PC operation, e.g. FAULT, EVENTS.ACTION|\n",
"\n",
"|events_symbol_rcbx_df\t|DataFrame\t|text\t|PM|event action storing information about source of an RCBX PC FPA, e.g. TRG EXTERNAL FAST ABORT, EVENTS.SYMBOL|\n",
"\n",
"Note that **rcbx** in the table above denotes RCBXH and RCBXV, i.e., there are four signals for each circuit.\n",
"\n",
"*ANALYSIS*:\n",
"- determination of the source of an FPA trigger based on EVENTS.SYMBOL and EVENTS.ACTION signals\n",
......@@ -410,19 +391,15 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"analysis_rcbxh.calculate_max_i_earth_pc(i_earth_rcbxh_df, col_name='Earth Current H')"
]
},
{
"source": [
"# 5. QDS\n",
"The quench voltage U_RES is calculated according to the following formula:\n",
"\n",
"editable": false
"\\begin{equation}\n",
"U_{\\text{RES}} = U_{\\text{DIFF}} + L d/dt (I+U_{\\text{DIFF}}/R).\n",
"\\end{equation}\n",
"\n",
"Note that I_DCCT is the QPS signal name, even though the current is actually measured not with a DCCT, but with a LEM detector, hence the poorer quality w.r.t. to the FGC I_A/B/MEAS signals that are measured with a DCCT.\n",
"It can be seen from the sign convention in the figure below that a resistive voltage always has opposite sign to the measured current.\n",
......@@ -434,11 +411,11 @@
"\n",
"## 5.1. Resistive Voltage\n",
"\n",
"*QUERY*:\n",
"\n",
"U_{\\text{RES}} = U_{\\text{DIFF}} + L d/dt (I+U_{\\text{DIFF}}/R).\n",
"|Variable Name\t|Variable Type\t|Variable Unit\t|Database|Comment\n",
"|---------------|---------------|---------------|--------|------|\n",
"|i_meas_nxcals_rcbx_df |DataFrame |A |NXCALS|Power converter current in an RCBX circuit, I_MEAS|\n",
"|u_res_nxcals_rcbx_df\t|DataFrame\t|V\t|NXCALS|Resistive voltage of magnets measured with QPS in an RCBX circuit, U_RES|\n",
"|u_res_rc_df\t|DataFrame\t|V\t|PM|Resistive voltage of magnets measured with QPS in an RCBX circuit, U_RES|\n",
"\n",
......@@ -461,97 +438,47 @@
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
},
"*GRAPHS*:\n",
"First plot (U_RES and I_MEAS prior to a quench)\n",
"- t = 0 s corresponds to the FGC timestamp\n",
"\n",
"Second plot (U_RES and the initial slope of U_RES)\n",
"- t = 0 s corresponds to the QPS timestamp"
"outputs": [],
"source": [
"analysis_rcbxh.plot_u_res(circuit_names[0], timestamp_qds_rcbxh, u_res_nxcals_rcbxh_df, i_meas_nxcals_rcbxh_df)"
{
"cell_type": "code",
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
},
},
"outputs": [],
"source": [
"u_res_rcbxh_slope_df = analysis_rcbxh.calculate_u_res_slope(u_res_rcbxh_df, col_name='dUres/dt H')\n",
"analysis_rcbxh.plot_u_res_slope(circuit_names[0], timestamp_qds_rcbxh, u_res_rcbxh_df, u_res_rcbxh_slope_df)"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
]
},
{
"editable": false
"cell_type": "code",
"execution_count": null,
"metadata": {
"u_res_rcbxh_slope_df = analysis_rcbxh.calculate_u_res_slope(u_res_rcbxh_df, col_name='dUres/dt H')\n",
"analysis_rcbxh.plot_u_res_slope(circuit_names[0], timestamp_qds_rcbxh, u_res_rcbxh_df, u_res_rcbxh_slope_df)"
]
},
"deletable": false,
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
"editable": false
},
"outputs": [],
"source": [
"outputs": [],
"analysis_rcbxv.plot_u_res(circuit_names[1], timestamp_qds_rcbxv, u_res_nxcals_rcbxv_df, i_meas_nxcals_rcbxv_df)"
"analysis_rcbxv.plot_u_res(circuit_names[1], timestamp_qds_rcbxv, u_res_nxcals_rcbxv_df, i_meas_nxcals_rcbxv_df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
},
"outputs": [],
"source": [
"u_res_rcbxv_slope_df = analysis_rcbxv.calculate_u_res_slope(u_res_rcbxv_df, col_name='dUres/dt V')\n",
"analysis_rcbxv.plot_u_res_slope(circuit_names[1], timestamp_qds_rcbxv, u_res_rcbxv_df, u_res_rcbxv_slope_df)"
]
},
{
{
"cell_type": "code",
"execution_count": null,
"cell_type": "code",
"deletable": false,
"editable": false
},
"outputs": [],
"source": [
"analysis_rcbxh.results_table[['Circuit Name', 'Date', 'Time', 'dUres/dt H', 'dUres/dt V']]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 5.2. I_DCCT, I_DIDT Currents; U_RES, U_DIFF Voltages\n",
"\n",
"*QUERY*:\n",
"\n",
"|Variable Name\t|Variable Type\t|Variable Unit\t|Database|Comment\n",
"|---------------|---------------|---------------|--------|------|\n",
"|i_dcct_rcbx_df\t|DataFrame\t|A\t|PM|DC current leads of QPS in an RCBX circuit, I_DCCT|\n",
"|i_didt_rcbx_df\t|DataFrame\t|A/s\t|PM|di/dt current leads of QPS in an RCBX circuit, I_DIDT|\n",
"|u_diff_rcbx_df\t|DataFrame\t|V\t|PM|differential voltage of QPS in an RCBX circuit, U_DIFF|\n",
"execution_count": null,
 
"metadata": {
"deletable": false,
"editable": false
},
"outputs": [],
"source": [
"u_res_rcbxv_slope_df = analysis_rcbxv.calculate_u_res_slope(u_res_rcbxv_df, col_name='dUres/dt V')\n",
"analysis_rcbxv.plot_u_res_slope(circuit_names[1], timestamp_qds_rcbxv, u_res_rcbxv_df, u_res_rcbxv_slope_df)"
]
......
......@@ -25,11 +25,10 @@
"# Analysis Assumptions\n",
"- We consider standard analysis scenarios, i.e., all signals can be queried. If a signal is missing, an analysis can raise a warning and continue or an error and abort the analysis.\n",
"- In case a signal is not needed for the analysis, a particular analysis is skipped. In other words, all signals have to be available in order to perform an analysis.\n",
"- It is recommended to execute each cell one after another. However, since the signals are queried prior to analysis, any order of execution is allowed. In case an analysis cell is aborted, the following ones may not be executed (e.g. I\\_MEAS not present). \n",
"\n",
"# Plot Convention\n",
"# Plot Convention\n",
"- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A].\n",
"- If a reference signal is present, it is represented with a dashed line.\n",
"- If the main current is present, its axis is on the left. Remaining signals are attached to the axis on the right. The legend of these signals is located on the lower left and upper right, respectively.\n",
"- The grid comes from the left axis.\n",
......@@ -37,16 +36,15 @@
"- The plots assigned to the left scale have colors: blue (C0) and orange (C1). Plots presented on the right have colors red (C2) and green (C3).\n",
"- Each plot has an individual time-synchronization mentioned explicitly in the description.\n",
"- If an axis has a single signal, then the color of the label matches the signal's color. Otherwise, the label color is black."
]
},
"cell_type": "markdown",
 
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false
"source": [
},
"source": [
"# 0. Initialise Working Environment"
]
},
......@@ -55,30 +53,14 @@
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
},
"source": [
"import io\n",
"import re\n",
"import sys\n",
"import pandas as pd\n",
"import numpy as np\n",
"from datetime import datetime\n",
"outputs": [],
"from IPython.display import display, Javascript\n",
"source": [
"import io\n",
"from lhcsmapi.Time import Time\n",
"from lhcsmapi.Timer import Timer\n",
"from lhcsmapi.pyedsl.QueryBuilder import QueryBuilder\n",
"from lhcsmapi.analysis.R600ACircuitQuery import R600ACircuitQuery\n",
"from lhcsmapi.analysis.expert_input import get_expert_decision\n",
"import re\n",
"from lhcsmapi.analysis.R600ACircuitAnalysis import R600ACircuitAnalysis\n",
"from lhcsmapi.metadata.SignalMetadata import SignalMetadata\n",
"\n",
"import sys\n",
"import pandas as pd\n",
"import numpy as np\n",
"from datetime import datetime\n",
"import time\n",
......@@ -98,11 +80,10 @@
"from lhcsmapi.gui.pc.FgcPmSearchModuleMediator import FgcPmSearchModuleMediator\n",
"from lhcsmapi.gui.pc.R600AFgcPmSearchBaseModule import R600ARcdoFgcPmSearchBaseModule\n",
"\n",
"analysis_start_time = datetime.now().strftime(\"%Y.%m.%d_%H%M%S.%f\")\n",
"\n",
"editable": false,
"import lhcsmapi\n",
"print('Analysis executed with lhcsmapi version: {}'.format(lhcsmapi.__version__))\n",
"\n",
"with io.open(\"../__init__.py\", \"rt\", encoding=\"utf8\") as f:\n",
" version = re.search(r'__version__ = \"(.*?)\"', f.read()).group(1)\n",
......@@ -232,47 +213,47 @@
" # Create results table - RCD/O\n",
" results_table = query_rcd.create_report_analysis_template_rcd(timestamp_fgc_rcd, timestamp_fgc_rco, circuit_names, author=author)\n",
" analysis_rcd = R600ACircuitAnalysis(circuit_type, results_table, is_automatic=is_automatic)\n",
" analysis_rco = R600ACircuitAnalysis(circuit_type, results_table, is_automatic=is_automatic)"
]
 
 
{
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false
 
 
"source": [
"# 3. Timestamps\n",
"\n",
"The analysis for MP3 consists of checking the existence of PM file and of consistency of the PM timestamps (PC, QPS). The criterion of passing this test described in detail in 600APIC2.\n",
" u_res_leads_rcd_dfs = query_rcd.query_leads(timestamp_fgc_rcd, source_timestamp_leads_rcd_df, system=leads_name, signal_names=['U_RES'], spark=spark, duration=[(300, 's'), (900, 's')])\n",
 
"\n",
"- 2 PM DQAMGNA (A+B) files and 1 PM EE file should be generated for 600 A circuits with EE\n",
"- Difference between QPS board A and B timestamp = 1 ms\n",
"- PC timestamp is QPS timestamp +/- 20 ms\n",
"\n",
"If one or more of these conditions are not fulfilled, then an in-depth analysis has to be performed by the QPS team."
]
 
 
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
 
 
},
"outputs": [],
"source": [
"timestamp_dct = {'FGC_RCD': timestamp_fgc_rcd, 'FGC_RCO': timestamp_fgc_rco, \n",
"editable": false
" 'PIC_RCD': timestamp_pic_rcd, 'PIC_RCO': timestamp_pic_rco, \n",
" 'QDS_A_RCD':source_timestamp_qds_rcd_df.loc[0, 'timestamp'] if len(source_timestamp_qds_rcd_df) > 0 else np.nan, \n",
" 'QDS_B_RCD':source_timestamp_qds_rcd_df.loc[1, 'timestamp'] if len(source_timestamp_qds_rcd_df) > 1 else np.nan,\n",
" 'QDS_A_RCO':source_timestamp_qds_rco_df.loc[0, 'timestamp'] if len(source_timestamp_qds_rco_df) > 0 else np.nan, \n",
" 'QDS_B_RCO':source_timestamp_qds_rco_df.loc[1, 'timestamp'] if len(source_timestamp_qds_rco_df) > 1 else np.nan}\n",
"\n",
"In short the following criteria should be checked:\n",
 
]
},
{
"cell_type": "markdown",
"metadata": {
......@@ -403,22 +384,13 @@
"- t = 0 s corresponds to the FGC timestamp"
]
},
{
"cell_type": "code",
},
{
"cell_type": "markdown",
"metadata": {
"deletable": false
},
"source": [
"## 4.2. Earth Current\n",
"*QUERY*: \n",
"execution_count": null,
"metadata": {
"|---------------|---------------|---------------|--------|------|\n",
"deletable": false,
"editable": false
},
"outputs": [],
"source": [
"analysis_rcd.plot_i_earth_pc(circuit_names[0], timestamp_fgc_rcd, i_earth_rcd_df)\n",
......@@ -430,11 +402,11 @@
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
},
 
 
"source": [
"analysis_rco.plot_i_earth_pc(circuit_names[0], timestamp_fgc_rco, i_earth_rco_df)\n",
"analysis_rco.calculate_max_i_earth_pc(i_earth_rco_df, col_name='Earth Current RCO')"
]
},
......@@ -456,97 +428,47 @@
"It can be seen from the sign convention in the figure below that a resistive voltage always has opposite sign to the measured current.\n",
"\n",
"<img src=\"https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/600A/600A_without_EE.png\" width=75%>\n",
"\n",
"As U_DIFF contributes directly to U_RES, the resolution of U_RES is, at least partially, limited by that of U_DIFF. Moreover, U_RES is affected by the noisy time derivative of the current signal.\n",
},
"source": [
"# 5. QDS\n",
"\n",
"The quench voltage U_RES is calculated according to the following formula:\n",
"\n",
"The QPS signals that are communicated to the post-mortem system have only 12 bit resolution."
]
},
"\\end{equation}\n",
"\n",
{
"cell_type": "markdown",
"metadata": {
"deletable": false
},
"source": [
"## 5.1. Resistive Voltage\n",
"\n",
"\n",
"*QUERY*:\n",
"\n",
"|Variable Name\t|Variable Type\t|Variable Unit\t|Database|Comment\n",
"|---------------|---------------|---------------|--------|------|\n",
"|i_meas_nxcals_rc_df |DataFrame |A |NXCALS|Power converter current in an RC circuit, I_MEAS|\n",
{
"cell_type": "markdown",
"metadata": {
"deletable": false
},
"|u_res_nxcals_rc_df\t|DataFrame\t|V\t|NXCALS|Resistive voltage of magnets measured with QPS in an RC circuit, U_RES|\n",
"|u_res_rc_df\t|DataFrame\t|V\t|PM|Resistive voltage of magnets measured with QPS in an RC circuit, U_RES|\n",
"\n",
"## 5.1. Resistive Voltage\n",
"Note that **rc** in the table above denotes RCD and RCO, i.e., there are two signals for each circuit.\n",
"\n",
"*ANALYSIS*: \n",
"|Variable Name\t|Variable Type\t|Variable Unit\t|Database|Comment\n",
"|---------------|---------------|---------------|--------|------|\n",
"|i_meas_nxcals_rc_df |DataFrame |A |NXCALS|Power converter current in an RC circuit, I_MEAS|\n",
"|u_res_nxcals_rc_df\t|DataFrame\t|V\t|NXCALS|Resistive voltage of magnets measured with QPS in an RC circuit, U_RES|\n",
"|u_res_rc_df\t|DataFrame\t|V\t|PM|Resistive voltage of magnets measured with QPS in an RC circuit, U_RES|\n",
"\n",
"Note that **rc** in the table above denotes RCD and RCO, i.e., there are two signals for each circuit.\n",
"\n",
"- Check if the U_RES signal before a quench is increasing for at least one board, which would indicate a QPS trip\n",
"- Check if the U_RES signal before a quench is increasing for at least one board, which would indicate a QPS trip\n",
"- Calculate the initial voltage slope of U_RES signal. The slope is calculated as a ratio of the voltage change from 50 to 200 mV and the corresponding time change.\n",
"\n",
"*GRAPHS*:\n",
"First plot (U_RES and I_MEAS prior to a quench)\n",
"\n",
"- t = 0 s corresponds to the FGC timestamp\n",
"First plot (U_RES and I_MEAS prior to a quench)\n",
"- t = 0 s corresponds to the FGC timestamp\n",
"\n",
"Second plot (U_RES and the initial slope of U_RES)\n",
"- t = 0 s corresponds to the QPS timestamp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
},
"\n",
"Second plot (U_RES and the initial slope of U_RES)\n",
"- t = 0 s corresponds to the QPS timestamp"
"analysis_rcd.plot_u_res(circuit_names[0], timestamp_qds_rcd, u_res_nxcals_rcd_df, i_meas_nxcals_rcd_df)\n",
]
"analysis_rcd.plot_u_res_slope(circuit_names[0], timestamp_qds_rcd, u_res_rcd_df, u_res_rcd_slope_df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false,
"scrolled": false
},
"outputs": [],
"source": [
"analysis_rco.plot_u_res(circuit_names[1], timestamp_qds_rco, u_res_nxcals_rco_df, i_meas_nxcals_rco_df)\n",
"u_res_rco_slope_df = analysis_rco.calculate_u_res_slope(u_res_rco_df, col_name='dUres/dt RCO')\n",
"analysis_rco.plot_u_res_slope(circuit_names[1], timestamp_qds_rco, u_res_rco_df, u_res_rco_slope_df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
},
 
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
},
"outputs": [],
"source": [
......
......@@ -25,11 +25,10 @@
"# Analysis Assumptions\n",
"- We consider standard analysis scenarios, i.e., all signals can be queried. If a signal is missing, an analysis can raise a warning and continue or an error and abort the analysis.\n",
"- In case a signal is not needed for the analysis, a particular analysis is skipped. In other words, all signals have to be available in order to perform an analysis.\n",
"- It is recommended to execute each cell one after another. However, since the signals are queried prior to analysis, any order of execution is allowed. In case an analysis cell is aborted, the following ones may not be executed (e.g. I\\_MEAS not present). \n",
"\n",
"# Plot Convention\n",
"# Plot Convention\n",
"- Scales are labeled with signal name followed by a comma and a unit in square brackets, e.g., I_MEAS, [A].\n",
"- If a reference signal is present, it is represented with a dashed line.\n",
"- If the main current is present, its axis is on the left. Remaining signals are attached to the axis on the right. The legend of these signals is located on the lower left and upper right, respectively.\n",
"- The grid comes from the left axis.\n",
......@@ -37,16 +36,15 @@
"- The plots assigned to the left scale have colors: blue (C0) and orange (C1). Plots presented on the right have colors red (C2) and green (C3).\n",
"- Each plot has an individual time-synchronization mentioned explicitly in the description.\n",
"- If an axis has a single signal, then the color of the label matches the signal's color. Otherwise, the label color is black."
]
},
"cell_type": "markdown",
 
"cell_type": "markdown",
"metadata": {
"deletable": false,
"editable": false
"source": [
},
"source": [
"# 0. Initialise Working Environment"
]
},
......@@ -55,30 +53,14 @@
"execution_count": null,
"metadata": {
"deletable": false,
"editable": false
},
"source": [
"import io\n",
"import re\n",
"import sys\n",
"import pandas as pd\n",
"import numpy as np\n",
"from datetime import datetime\n",
"outputs": [],
"from IPython.display import display, Javascript\n",
"source": [
"import io\n",
"from lhcsmapi.Time import Time\n",
"from lhcsmapi.Timer import Timer\n",
"from lhcsmapi.pyedsl.QueryBuilder import QueryBuilder\n",
"import re\n",
"from lhcsmapi.analysis.expert_input import get_expert_decision\n",
"from lhcsmapi.analysis.report_template import apply_report_template\n",
"from lhcsmapi.analysis.R600ACircuitAnalysis import R600ACircuitAnalysis\n",
"from lhcsmapi.metadata.SignalMetadata import SignalMetadata\n",
"\n",
"import sys\n",
"import pandas as pd\n",
"import numpy as np\n",
"from datetime import datetime\n",
"import time\n",
......@@ -99,11 +81,10 @@
"from lhcsmapi.gui.pc.R600AFgcPmSearchBaseModule import R600AFgcPmSearchBaseModule\n",
"\n",
"analysis_start_time = datetime.now().strftime(\"%Y.%m.%d_%H%M%S.%f\")\n",
"\n",
"import lhcsmapi\n",
"scrolled": true
"print('Analysis executed with lhcsmapi version: {}'.format(lhcsmapi.__version__))\n",
"\n",
"with io.open(\"../__init__.py\", \"rt\", encoding=\"utf8\") as f:\n",
" version = re.search(r'__version__ = \"(.*?)\"', f.read()).group(1)\n",
" print('Analysis executed with lhc-sm-hwc notebooks version: {}'.format(version))"
......@@ -210,17 +191,17 @@
" leads_name = [x for x in SignalMetadata.get_system_types_per_circuit_name(circuit_type, circuit_name) if 'LEADS' in x][0]\n",
" source_timestamp_leads_df = query.find_timestamp_leads(timestamp_fgc, leads_name)\n",
"\n",
" u_hts_leads_dfs = query.query_leads(timestamp_fgc, source_timestamp_leads_df, system=leads_name, signal_names=['U_HTS'], spark=spark, duration=[(300, 's'), (900, 's')])\n",
" u_res_leads_dfs = query.query_leads(timestamp_fgc, source_timestamp_leads_df, system=leads_name, signal_names=['U_RES'], spark=spark, duration=[(300, 's'), (900, 's')])\n",
 
 
" analysis = R600ACircuitAnalysis(circuit_type, results_table, is_automatic=is_automatic)"