Commit 27e26311 authored by Michal Maciejewski's avatar Michal Maciejewski
Browse files

Added qps figures for IPQ circuits.

parent 1ecad312
%% Cell type:markdown id: tags:
 
|Magnets in the Circuit|Temperature|Position|General information|
|----------------------|-----------|--------|-------------------|
|2MQM|1.9 K| RQ7.L4, RQ7.R4|I Nominal: 5390A, I_Ultimate: 6820A|
| | | |L tot: 2x15 mH, L per aperture: 15 mH|
| | | |max(di/dt): 12.917 A/s|
|2x2MQM|1.9\4.5\* K| RQ7.L1, RQ7.R1 RQ7.L2, RQ7.R2 RQ7.L5, RQ7.R5 RQ7.L8, RQ7.R8 RQ5.L8\*, RQ5.R2\*|I Nominal: 5390A\4310A\*, I_Ultimate: 5820A\4650A\*|
| | | |L tot: 2x2x15 mH, L per aperture: 15 mH|
| | | |max(di/dt): 12.917 A/s|
|2MQML|1.9\4.5\* K| RQ5.L1\*, RQ5.R1\* RQ5.L5\*, RQ5.R5\* RQ6.L1\*, RQ6.R1\* RQ6.L5\*, RQ6.R5* RQ8.L1, RQ8.R1 RQ8.L2, RQ8.R2 RQ8.L4, RQ8.R4 RQ8.L5, RQ8.R5 RQ8.L6, RQ8.R6 RQ8.L8, RQ8.R8 RQ10.L1, RQ10.R1 RQ10.L2, RQ10.R2 RQ10.L4, RQ10.R4 RQ10.L5, RQ10.R5 RQ10.L6, RQ10.R6 RQ10.L8, RQ10.R8|I Nominal: 5390A \ 4310A\*, I_Ultimate: 5820A \ 4650A\*|
| | | |L tot: 2x21 mH, L per aperture: 21 mH|
| | | |max(di/dt): 12.917 A/s|
|2MQMC|1.9 K\4.5K\*| Does not exist as an individual power circuit (exists only in combination with 2MQM)|I Nominal: 5390A\4310A\*, I_Ultimate: 5820A\4650A\*|
| | | |L tot: 2x11 mH, L per aperture: 11 mH|
| | | |max(di/dt): 12.917 A/s|
|2MQM+2MQML|4.5 K| RQ6.L2, RQ6.R2 RQ6.L8, RQ6.R8|I Nominal: 4310A, I_Ultimate: 4650A|
| | | |L tot: 2x15 mH + 2x21 mH|
| | | |max(di/dt): 12.917 A/s|
|2MQM+2MQMC|1.9 K| RQ9.L1, RQ9.L1 RQ9.L2, RQ9.R2 RQ9.L4, RQ9.R4 RQ9.L5, RQ9.R5 RQ9.L6, RQ9.R6 RQ9.L8, RQ9.R8|I Nominal: 5390A, I_Ultimate: 5820A|
| | | |L tot: 2x15 mH + 2x21 mH|
| | | |max(di/dt): 12.917 A/s|
 
%% Cell type:markdown id: tags:
 
The MQM quadrupole consists of two individually powered apertures assembled in a common yoke structure. Depending on a subsector there are few kinds of power circuits:
- 2MQM
 
Apertures B1 of 2 magnets are powered in series with one power supply Apertures B2 of 2 magnets are powered in series with second power supply. The return bus is common for both power circuits.
 
- 2x2MQM
 
Apertures B1 of 4 magnets are powered in series with one power supply Apertures B2 of 4 magnets are powered in series with second power supply. The return bus is common for both power circuits.
 
- 2MQML – long version
 
Apertures B1 of 2 magnets are powered in series with one power supply Apertures B2 of 2 magnets are powered in series with second power supply. The return bus is common for both power circuits.
 
- 2MQM + 2MQML
 
Apertures B1 of 2 MQM and 2 MQML are powered in series with one power supply Apertures B2 of 2 MQM and 2 MQML are powered in series with second power supply. The return bus is common for both power circuits.
 
- 2MQM+2MQMC
 
Apertures B1 of 2 MQM and 2 MQMC are powered in series with one power supply Apertures B2 of 2 MQM and 2 MQMC are powered in series with second power supply. The return bus is common for both power circuits.
 
%% Cell type:markdown id: tags:
 
## Quench Detection System
**Quench Detector Type**
DQQDC – current leads quench detector
DQAMG – controller attached to global protection
**Current Leads:**
- Typical resistance for U_RES: 7 uOhm
- Threshold for U_HTS: 3 mV, 1 s
- Polarity convention: if I_B1 = I_B2 > 0, LD1:U_RES < 0, LD3:U_RES > 0
- PM file:
- Buffer range: 0 to 250, event at point 50
- Time range: -10 to 40 s
- Frequency: 5 Hz (dt = 200 ms)
**Magnet:**
- See polarity convention here above
- U_RES_B1 = U_1_B1 + U_2_B1
- U_RES_B2 = U_1_B2 + U_2_B2
- Threshold on U_RES: 100 mV, 10 ms
- Attention: B1 signals & B2 signals can be shifted by 4ms from each other
- If pure inductive signal:
- If dI/dt < 0:
- U_1_Qx = Ldi / dt < 0
- U_2_Qx = -Ldi / dt > 0
- PM file:
- Buffer range: 501 to 1500, event at point 1000
- Time range: -2 to 2s
- Frequency: 250Hz (dt = 4ms)
The protection of the MQM quadrupole during a quench is assured by eight strip quench heaters placed on the outer layer of each coil octant.
For redundancy, the heaters are connected in two circuits, such that each circuit covers all four poles and powered by independent power supplies.
%% Cell type:markdown id: tags:
# Import Necessary Packages
 
%% Cell type:code id: tags:
 
``` python
import lhcsmapi
lhcsmapi.__version__
```
 
%% Output
 
'1.3.128'
 
%% Cell type:code id: tags:
 
``` python
import pandas as pd
import matplotlib.pyplot as plt
 
import pytimber
ldb = pytimber.LoggingDB()
 
from lhcsmapi.pyedsl.QueryBuilder import QueryBuilder
from lhcsmapi.metadata.SignalMetadata import SignalMetadata
```
 
%% Cell type:markdown id: tags:
 
# Import HWC Summary
 
%% Cell type:code id: tags:
 
``` python
hwc_summary = pd.read_csv('/eos/project/l/lhcsm/hwc/HWC_Summary.csv')
```
 
%% Cell type:markdown id: tags:
 
# List of Available HWC Campaigns
 
%% Cell type:code id: tags:
 
``` python
hwc_summary['campaign'].unique()
```
 
%% Output
 
array([nan, 'HWC_2014', 'HWC_2017', 'HWC_2018_1', 'HWC_2016_2',
'HWC_2018_2', 'HWC_2016_3', 'HWC_2016_1'], dtype=object)
 
%% Cell type:markdown id: tags:
 
# Select HWC Test Corresponding to Analysed Circuit and Campaign
 
%% Cell type:code id: tags:
 
``` python
HWC_2018_1, RQX.L1, PNO.a9, 2018-03-15 18:41:46.740, 2018-03-15 20:26:43.254
```
 
%% Cell type:code id: tags:
 
``` python
hwc_summary_circuit = hwc_summary[(hwc_summary['systemName'] == 'RQX.R1') & (hwc_summary['campaign'] == 'HWC_2014') & (hwc_summary['executedTestStatus'] == 'SUCCESSFUL')]
hwc_summary_circuit
```
 
%% Output
 
campaign recId testId systemName testName \
51672 HWC_2014 732.0 66553.0 RQX.R1 CC.ELQA
51673 HWC_2014 733.0 66552.0 RQX.R1 ELQA
51675 HWC_2014 734.0 66555.0 RQX.R1 ELQA.CRYO.READY
51676 HWC_2014 735.0 66554.0 RQX.R1 IST.QPS
51679 HWC_2014 3229.0 69908.0 RQX.R1 PC.UNLOCKED
51683 HWC_2014 3226.0 69907.0 RQX.R1 PCC.T4
51685 HWC_2014 13858.0 83785.0 RQX.R1 PGC.1
51686 HWC_2014 13001.0 82374.0 RQX.R1 PGC.2
51687 HWC_2014 13936.0 85505.0 RQX.R1 PIC to BIC Interface
51691 HWC_2014 3249.0 69928.0 RQX.R1 PIC2 CIRCUIT QUENCH VIA QPS
51695 HWC_2014 3227.0 69906.0 RQX.R1 PIC2 CRYO-OK
51696 HWC_2014 3247.0 69926.0 RQX.R1 PIC2 FAST ABORT REQ VIA PIC
51700 HWC_2014 12948.0 82306.0 RQX.R1 PIC2 GLOBAL PROTEC. MECH
51701 HWC_2014 3246.0 69927.0 RQX.R1 PIC2 PC PERMIT
51705 HWC_2014 3244.0 69925.0 RQX.R1 PIC2 POWERING FAILURE
51710 HWC_2014 3245.0 69924.0 RQX.R1 PIC2 QPS-OK
51715 HWC_2014 3733.0 70568.0 RQX.R1 PLI3.f6
51716 HWC_2014 5523.0 72821.0 RQX.R1 PNO.a9
51721 HWC_2014 3298.0 69989.0 RQX.R1 PNO.d12
51724 HWC_2014 3619.0 70438.0 RQX.R1 PNO.d13
51725 HWC_2014 5494.0 72784.0 RQX.R1 PNO.d14
51728 HWC_2014 5515.0 72806.0 RQX.R1 PNO.d15
51729 HWC_2014 5884.0 73327.0 RQX.R1 PNO.d16
51731 HWC_2014 6436.0 73995.0 RQX.R1 PNO.d17
executionStartTime executionEndTime executedTestStatus \
51672 2015-01-21 18:37:21.871 2015-01-21 18:37:21.883 SUCCESSFUL
51673 2015-01-21 18:36:53.472 2015-01-21 18:36:53.482 SUCCESSFUL
51675 2015-01-21 18:36:01.873 2015-01-21 18:36:01.883 SUCCESSFUL
51676 2015-01-21 18:37:52.168 2015-01-21 18:37:52.178 SUCCESSFUL
51679 2015-01-29 16:35:28.752 2015-01-29 16:35:28.765 SUCCESSFUL
51683 2015-01-29 16:38:24.601 2015-01-29 17:03:49.526 SUCCESSFUL
51685 2015-03-23 23:42:11.662 2015-03-23 23:42:11.711 SUCCESSFUL
51686 2015-03-16 21:06:15.859 2015-03-16 21:06:15.873 SUCCESSFUL
51687 2015-04-01 20:52:53.118 2015-04-01 20:53:22.043 SUCCESSFUL
51691 2015-01-29 18:19:16.515 2015-01-29 18:41:51.487 SUCCESSFUL
51695 2015-01-29 16:37:40.895 2015-01-29 16:37:50.987 SUCCESSFUL
51696 2015-01-29 18:41:53.710 2015-01-29 18:46:29.007 SUCCESSFUL
51700 2015-03-15 23:32:53.491 2015-03-15 23:32:58.069 SUCCESSFUL
51701 2015-01-29 18:07:54.606 2015-01-29 18:08:25.269 SUCCESSFUL
51705 2015-01-29 18:08:27.497 2015-01-29 18:19:14.250 SUCCESSFUL
51710 2015-01-29 18:06:25.007 2015-01-29 18:07:52.420 SUCCESSFUL
51715 2015-02-03 18:22:05.384 2015-02-03 18:45:06.048 SUCCESSFUL
51716 2015-02-10 22:21:44.390 2015-02-11 00:08:07.177 SUCCESSFUL
51721 2015-01-29 22:05:56.100 2015-01-29 22:19:49.739 SUCCESSFUL
51724 2015-02-03 16:59:19.636 2015-02-03 17:12:45.491 SUCCESSFUL
51725 2015-02-10 19:03:29.308 2015-02-10 20:50:45.601 SUCCESSFUL
51728 2015-02-10 21:34:05.710 2015-02-10 22:03:14.049 SUCCESSFUL
51729 2015-02-13 12:05:46.778 2015-02-13 14:03:12.020 SUCCESSFUL
51731 2015-02-13 19:12:12.892 2015-02-13 19:51:44.334 SUCCESSFUL
HwcPoExpert Unnamed: 9 \
51672 NaN NaN
51673 NaN NaN
51675 NaN NaN
51676 NaN NaN
51679 2015-01-29 16:35:41.415 mpojer
51683 2015-01-29 16:38:25.000 abessonn
51685 NaN NaN
51686 NaN NaN
51687 NaN NaN
51691 NaN NaN
51695 NaN NaN
51696 NaN NaN
51700 NaN NaN
51701 NaN NaN
51705 NaN NaN
51710 NaN NaN
51715 NaN NaN
51716 2015-02-10 22:21:44.000 hthiesen
51721 2015-01-29 22:05:56.000 hthiesen
51724 2015-02-03 16:59:20.000 ghudson
51725 NaN NaN
51728 2015-02-10 21:34:06.000 ldemalla
51729 NaN NaN
51731 NaN NaN
Unnamed: 10 Unnamed: 11 \
51672 NaN NaN
51673 NaN NaN
51675 NaN NaN
51676 NaN NaN
51679 PC is unlocked. True
51683 Application: DISCHARGE Analysis Comment: 2015-... True
51685 NaN NaN
51686 NaN NaN
51687 NaN NaN
51691 NaN NaN
51695 NaN NaN
51696 NaN NaN
51700 NaN NaN
51701 NaN NaN
51705 NaN NaN
51710 NaN NaN
51715 NaN NaN
51716 Application: DISCHARGE Analysis Comment: 2015-... True
51721 Application: Manual_sign Comment: 2015-01-30 1... True
51724 Application: DISCHARGE Analysis Comment: 2015-... True
51725 NaN NaN
51728 Application: DISCHARGE Analysis Comment: 2015-... True
51729 NaN NaN
51731 NaN NaN
HwcMppExpert Unnamed: 13 \
51672 NaN NaN
51673 NaN NaN
51675 NaN NaN
51676 NaN NaN
51679 NaN NaN
51683 NaN NaN
51685 2015-03-24 16:48:24.646 dwollman
51686 2015-03-23 13:04:32.092 dwollman
51687 NaN NaN
51691 NaN NaN
51695 NaN NaN
51696 NaN NaN
51700 NaN NaN
51701 NaN NaN
51705 NaN NaN
51710 NaN NaN
51715 2015-02-10 15:27:19.833 auchmann
51716 NaN NaN
51721 NaN NaN
51724 NaN NaN
51725 2015-02-10 19:03:29.000 auchmann
51728 NaN NaN
51729 2015-02-13 12:05:47.000 fehers
51731 2015-02-13 19:12:13.000 gwilleri
Unnamed: 14 Unnamed: 15 \
51672 NaN NaN
51673 NaN NaN
51675 NaN NaN
51676 NaN NaN
51679 NaN NaN
51683 NaN NaN
51685 Test successful. DFB analysis ok. No trips/que... True
51686 OK True
51687 NaN NaN
51691 NaN NaN
51695 NaN NaN
51696 NaN NaN
51700 NaN NaN
51701 NaN NaN
51705 NaN NaN
51710 NaN NaN
51715 test analyzed by Gerard and found ok. Signed "... True
51716 NaN NaN
51721 NaN NaN
51724 NaN NaN
51725 Application: DISCHARGE Analysis Comment: 2015-... True
51728 NaN NaN
51729 Application: Manual_sign Comment: 2015-02-13 1... True
51731 Application: DISCHARGE Analysis Comment: 2015-... True
HwcMiExpert Unnamed: 17 \
51672 NaN NaN
51673 NaN NaN
51675 NaN NaN
51676 NaN NaN
51679 NaN NaN
51683 NaN NaN
51685 NaN NaN
51686 NaN NaN
51687 2015-04-01 21:37:55.025 iromerar
51691 2015-01-29 18:19:17.000 iromerar
51695 2015-01-29 16:38:22.467 mpojer
51696 2015-01-29 18:41:54.000 iromerar
51700 2015-03-15 23:33:12.853 mpojer
51701 NaN NaN
51705 2015-01-29 18:08:27.000 iromerar
51710 NaN NaN
51715 NaN NaN
51716 NaN NaN
51721 NaN NaN
51724 NaN NaN
51725 NaN NaN
51728 NaN NaN
51729 NaN NaN
51731 NaN NaN
Unnamed: 18 Unnamed: 19
51672 NaN NaN
51673 NaN NaN
51675 NaN NaN
51676 NaN NaN
51679 NaN NaN
51683 NaN NaN
51685 NaN NaN
51686 NaN NaN
51687 Test ok True
51691 Application: PIC_Analysis Comment: 2015-01-29 ... True
51695 PIC-CRYO link tested by I.Romera. True
51696 Application: PIC_Analysis Comment: 2015-01-29 ... True
51700 GPM activated and tested True
51701 NaN NaN
51705 Application: PIC_Analysis Comment: 2015-01-29 ... True
51710 NaN NaN
51715 NaN NaN
51716 NaN NaN
51721 NaN NaN
51724 NaN NaN
51725 NaN NaN
51728 NaN NaN
51729 NaN NaN
51731 NaN NaN
 
%% Cell type:code id: tags:
 
``` python
import pandas as pd
hwc_summary = pd.read_csv('HWC_Summary.csv')
hwc_summary_circuit = hwc_summary[(hwc_summary['systemName'] == 'RQD.A12') & (hwc_summary['testName'].str.contains('PNO.b3')) & (hwc_summary['executedTestStatus'] != 'RUNNING')]
hwc_summary_circuit[['systemName', 'campaign', 'testName', 'executionStartTime', 'executionEndTime', 'executedTestStatus']]
```
 
%% Output
 
systemName campaign testName executionStartTime \
39502 RQD.A12 HWC_2014 PNO.b3 2015-01-21 21:05:32.259
39503 RQD.A12 HWC_2014 PNO.b3 2015-03-11 19:51:13.907
39504 RQD.A12 HWC_2016_2 PNO.b3 2016-03-13 17:01:38.962
39506 RQD.A12 HWC_2016_2 PNO.b3 2016-03-16 22:18:33.714
39507 RQD.A12 HWC_2016_2 PNO.b3 2016-03-17 22:24:25.616
39508 RQD.A12 HWC_2017 PNO.b3 2017-04-25 06:53:57.069
39509 RQD.A12 HWC_2018_1 PNO.b3 2018-03-18 07:17:37.130
39510 RQD.A12 HWC_2018_2 PNO.b3 2018-12-10 16:25:35.048
39511 RQD.A12 HWC_2018_2 PNO.b3 2018-12-10 19:02:29.785
39512 RQD.A12 HWC_2018_2 PNO.b3 2018-12-11 18:21:41.793
39513 RQD.A12 HWC_2018_2 PNO.b3 2018-12-12 14:22:53.332
executionEndTime executedTestStatus
39502 2015-01-21 21:32:34.193 FAILED
39503 2015-03-11 20:16:15.671 SUCCESSFUL
39504 2016-03-13 21:41:52.963 SUCCESSFUL
39506 2016-03-17 03:06:48.857 FAILED
39507 2016-03-18 03:07:09.784 SUCCESSFUL
39508 2017-04-25 10:54:25.502 SUCCESSFUL
39509 2018-03-18 12:13:29.766 SUCCESSFUL
39510 2018-12-10 16:56:48.328 FAILED
39511 2018-12-10 19:34:00.078 FAILED
39512 2018-12-11 18:51:33.654 FAILED
39513 2018-12-12 14:48:15.285 ANALYSIS_PENDING
 
%% Cell type:code id: tags:
 
``` python
import getpass
import functools
 
import pandas as pd
from IPython.display import display, clear_output
from ipywidgets import Dropdown, Text, HBox, VBox, Select, Label, ToggleButtons, Layout
 
from lhcsmapi.gui.pc.FgcPmSearchModuleMediator import get_circuit_names_or_types
from lhcsmapi.gui.ModuleMediator import ModuleMediator
from lhcsmapi.metadata.SignalMetadata import SignalMetadata
 
 
class HwcSearchModuleMediator(ModuleMediator):
 
def __init__(self, circuit_type, hwc_test, hwc_summary_path):
self._circuit_type = circuit_type
self.hwc_test = hwc_test
self.hwc_summary = pd.read_csv(hwc_summary_path)[
['systemName', 'campaign', 'testName', 'executionStartTime', 'executionEndTime', 'executedTestStatus']]
self.hwc_summary_circuit = self.hwc_summary
# First row
circuit_names = get_circuit_names_or_types(
circuit_type) if circuit_type != 'RQ' else SignalMetadata.get_circuit_names('RQ')
description = 'Circuit type:' if self._circuit_type == '600A' else 'Circuit name'
self.select_circuit_name_dropdown = Dropdown(
options=circuit_names,
description=description,
disabled=False,
)
 
self.select_circuit_name_dropdown.observe(
functools.partial(HwcSearchModuleMediator.update_hwc_table, self=self),
names=['value'])
 
first_row = HBox(children=[self.select_circuit_name_dropdown])
 
# Second row
self.done_by_txt = Text(placeholder='Your name', description='Done by:', value=getpass.getuser(),
disabled=True)
 
self.analysis_mode_tgl_btn = ToggleButtons(
options=['Automatic', 'Manual'],
description='Analysis:',
disabled=False,
button_style='',
tooltips=['Select automatic for automatic execution, comment, and acceptance.',
'Select manual to execute, comment, and accept each analysis manually.']
)
second_row = HBox(children=[self.done_by_txt, self.analysis_mode_tgl_btn])
 
# Third row
self.hwc_sel = Select(
options=[],
rows=15,
disabled=False,
layout=Layout(width='90%', font='monospace')
)
HwcSearchModuleMediator.update_hwc_table(None, self)
 
# On select value change, update output
self.hwc_sel.observe(functools.partial(HwcSearchModuleMediator.update_text_output, self=self),
names=['value'])
 
third_row = HBox(children=[Label(value='HWC tests:'), self.hwc_sel])
 
# Final GUI
self.widget = VBox(children=[first_row, second_row, third_row])
 
display(self.widget)
HwcSearchModuleMediator.update_text_output(None, self)
 
@staticmethod
def update_hwc_table(value, self):
self.hwc_summary_circuit = self.hwc_summary[
(self.hwc_summary['systemName'] == self.select_circuit_name_dropdown.value) & (
self.hwc_summary['testName'].str.contains(self.hwc_test)) & (
self.hwc_summary['executedTestStatus'] != 'RUNNING')]
self.hwc_summary_circuit.reset_index(drop=True, inplace=True)
 
# find max string length
max_str_lens = []
for col in self.hwc_summary_circuit.columns:
max_str_lens.append(len(max(self.hwc_summary_circuit[col].values, key=len)))
 
options = []
for index, row in self.hwc_summary_circuit.iterrows():
aligned_values = [(max_str_len - len(value)) * ' ' + value for max_str_len, value in
zip(max_str_lens, row.values)]
options.append(' | '.join(aligned_values))
 
self.hwc_sel.options = options
 
@staticmethod
def update_text_output(value, self):
clear_output(wait=True)
display(self.widget)
 
print('Selected HWC test start time: %s and end time: %s.' % (self.get_start_time(), self.get_end_time()))
 
def get_start_time(self):
return self.hwc_summary_circuit.loc[self.hwc_sel.index, 'executionStartTime']
 
def get_end_time(self):
return self.hwc_summary_circuit.loc[self.hwc_sel.index, 'executionEndTime']
 
circuit_type = 'RB'
hwc_test = 'PNO.b2'
hwc_browser = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='HWC_Summary.csv')
```
 
%% Output
 
 
Selected HWC test start time: 2015-02-06 14:20:37.700 and end time: 2015-02-06 16:23:13.535.
 
%% Cell type:code id: tags:
 
``` python
circuit_type = 'RQ'
hwc_test = 'PNO.b3'
hwc_browser = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='HWC_Summary.csv')
```
 
%% Output
 
 
%% Cell type:code id: tags:
 
``` python
circuit_type = 'IT'
hwc_test = 'PNO.d16'
hwc_browser = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='HWC_Summary.csv')
```
 
%% Output
 
 
%% Cell type:code id: tags:
 
``` python
circuit_type = 'IPD'
hwc_test = 'PLI3.c5'
hwc_browser = HwcSearchModuleMediator(circuit_type=circuit_type, hwc_test=hwc_test, hwc_summary_path='HWC_Summary.csv')
```
 
%% Output
 
 
%% Cell type:code id: tags:
 
``` python
from lhcsmapi.gui.pc.FgcPmSearchModuleMediator import FgcPmSearchModuleMediator
from lhcsmapi.gui.pc.RqFgcPmSearchBaseModule import RqFgcPmSearchBaseModule
from lhcsmapi.gui.qh.DateTimeBaseModule import DateTimeBaseModule
from IPython.display import display
 
 
circuit_type = 'IPD'
fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2018-12-12 00:00:00+01:00',
end_date_time='2018-12-13 00:00:00+01:00'), RqFgcPmSearchBaseModule(), circuit_type=circuit_type)
display(fgc_pm_search.widget)
 
```
 
%% Output
 
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-93-756871c318eb> in <module>
7 circuit_type = 'IPD'
8 fgc_pm_search = FgcPmSearchModuleMediator(DateTimeBaseModule(start_date_time='2018-12-12 00:00:00+01:00',
----> 9 end_date_time='2018-12-13 00:00:00+01:00'), RqFgcPmSearchBaseModule(), circuit_type=circuit_type)
10 display(fgc_pm_search.widget)
11
~/venv/lib/python3.7/site-packages/lhcsmapi/gui/pc/FgcPmSearchModuleMediator.py in __init__(self, date_time_module, fgc_pm_search_module, circuit_type)
57 self._circuit_type = circuit_type
58 # First row
---> 59 circuit_names = get_circuit_names_or_types(circuit_type)
60 description = 'Circuit type:' if circuit_type == '600A' else 'Circuit name'
61 self.select_circuit_name_dropdown = Dropdown(
~/venv/lib/python3.7/site-packages/lhcsmapi/gui/pc/FgcPmSearchModuleMediator.py in get_circuit_names_or_types(circuit_type)
48 return sorted(list(circuit_names_rcd_set))
49 else:
---> 50 raise KeyError('Circuit type {} is not supported'.format(circuit_type))
51
52
KeyError: 'Circuit type IPD is not supported'
 
%% Cell type:code id: tags:
 
``` python
import pandas as pd
# GUI
from lhcsmapi.gui.hwc.HwcBrowser import HwcBrowser
 
circuit_type = 'RQ'
hwc_test = 'PNO.b3'
hwc_test_history_df = pd.read_csv('HWC_Summary.csv')
hwcb = HwcBrowser(hwc_test_history_df, circuit_type, hwc_test)
display(hwcb.widget)
```
 
%% Output
 
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/venv/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'Test'
 
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
<ipython-input-4-3704804bdb79> in <module>
6 hwc_test = 'PNO.b3'
7 hwc_test_history_df = pd.read_csv('HWC_Summary.csv')
----> 8 hwcb = HwcBrowser(hwc_test_history_df, circuit_type, hwc_test)
9 display(hwcb.widget)
10
~/venv/lib/python3.7/site-packages/lhcsmapi/gui/hwc/HwcBrowser.py in __init__(self, hwc_test_history_df, circuit_type, hwc_test)
12
13 self.hwc_test_history_df = hwc_test_history_df
---> 14 self.hwc_sel_test_df = self.hwc_test_history_df[self.hwc_test_history_df['Test'] == self.hwc_test]
15
16 unique_circuits = self.hwc_sel_test_df['Circuit'].unique()
~/venv/lib/python3.7/site-packages/pandas/core/frame.py in __getitem__(self, key)
2798 if self.columns.nlevels > 1:
2799 return self._getitem_multilevel(key)
-> 2800 indexer = self.columns.get_loc(key)
2801 if is_integer(indexer):
2802 indexer = [indexer]
~/venv/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2646 return self._engine.get_loc(key)
2647 except KeyError:
-> 2648 return self._engine.get_loc(self._maybe_cast_indexer(key))
2649 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2650 if indexer.ndim > 1 or indexer.size > 1:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'Test'
 
%% Cell type:markdown id: tags:
 
# Query CALS (low sampling) to Get the Current Profile (Slow and Fast Power Abort)
 
%% Cell type:code id: tags:
 
``` python
from lhcsmapi.pyedsl.QueryBuilder import QueryBuilder
import pytimber
ldb = pytimber.LoggingDB()
 
t_start = '2013-01-01 00:00:00'
t_end = '2013-02-01 00:00:00'
i_meas_dfs = QueryBuilder().with_cals(ldb) \
.with_duration(t_start=t_start, t_end=t_end) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name=['RQ4.L1B1', 'RQ4.L1B2'], system='PC', signal='I_MEAS')\
.signal_query() \
.synchronize_time() \
.dfs
```
 
%% Output
 
WARNING:cmmnbuild_dep_manager:JVM is already started
 
 
 
%% Cell type:code id: tags:
 
``` python
ax = i_meas_dfs[0].plot()
i_meas_dfs[1].plot(ax=ax)
```
 
%% Output
 
<matplotlib.axes._subplots.AxesSubplot at 0x7f11512fa5f8>
 
 
%% Cell type:code id: tags:
 
``` python
t_start = '2013-01-01 00:00:00'
t_end = '2013-02-01 00:00:00'
v_meas_dfs = QueryBuilder().with_cals(ldb) \
.with_duration(t_start=t_start, t_end=t_end) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name=['RQ4.L1B1', 'RQ4.L1B2'], system='PC', signal='V_MEAS')\
.signal_query() \
.synchronize_time() \
.dfs
```
 
%% Output
 
 
 
%% Cell type:code id: tags:
 
``` python
ax = v_meas_dfs[0].plot()
v_meas_dfs[1].plot(ax=ax)
```
 
%% Output
 
<matplotlib.axes._subplots.AxesSubplot at 0x7f114a4933c8>
 
 
%% Cell type:markdown id: tags:
 
# Query CALS for HWC PC current and voltage
 
%% Cell type:code id: tags:
 
``` python
for index, row in hwc_summary_circuit.iterrows():
 
t_start = row['executionStartTime']
t_end = row['executionEndTime']
 
print('Analyzing index {}, t_start={}, t_end={}'.format(index, t_start, t_end))
 
i_meas_dfs = QueryBuilder().with_cals(ldb) \
.with_duration(t_start=t_start, t_end=t_end) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name=['RQ7.L1B1', 'RQ7.L1B2'], system='PC', signal='I_MEAS')\
.signal_query() \
.synchronize_time() \
.dfs
 
u_res_b1_ld1_df, u_res_b1_ld2_df = QueryBuilder().with_cals(ldb) \
.with_duration(t_start=t_start, t_end=t_end) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name='RQ7.L1B1', system='LEADS_B1', signal='U_RES')\
.signal_query() \
.synchronize_time() \
.dfs
 
u_res_b2_ld1_df, u_res_b2_ld2_df = QueryBuilder().with_cals(ldb) \
.with_duration(t_start=t_start, t_end=t_end) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name='RQ7.L1B2', system='LEADS_B2', signal='U_RES')\
.signal_query() \
.synchronize_time() \
.dfs
 
if not i_meas_dfs[0].empty:
ax = i_meas_dfs[0].plot()
i_meas_dfs[1].plot(ax=ax)
plt.show()
 
ax = u_res_b1_ld1_df.plot()
u_res_b1_ld2_df.plot(ax=ax)
u_res_b2_ld1_df.plot(ax=ax)
u_res_b2_ld2_df.plot(ax=ax)
plt.show()
 
user_input = input('Show next? (Y/N)')
if user_input.upper() == 'N':
break
```
 
%% Output
 
Analyzing index 37558, t_start=2017-04-03 16:43:50.297, t_end=2017-04-03 16:43:51.234
 
 
 
 
 
 
Analyzing index 37561, t_start=2017-04-03 17:54:45.985, t_end=2017-04-03 17:54:46.679
 
 
 
 
 
 
Analyzing index 37564, t_start=2017-04-14 16:48:38.277, t_end=2017-04-14 16:48:38.288
 
 
 
 
 
 
Analyzing index 37567, t_start=2017-04-03 21:34:31.323, t_end=2017-04-03 21:34:31.707
 
 
 
 
 
 
Analyzing index 37575, t_start=2017-04-10 21:13:26.483, t_end=2017-04-10 21:45:24.038
 
 
 
 
 
 
 
 
 
Show next? (Y/N)
Analyzing index 37581, t_start=2017-09-19 21:15:08.781, t_end=2017-09-19 21:20:34.836
 
 
 
 
 
 
 
 
 
Show next? (Y/N)
Analyzing index 37585, t_start=2017-04-07 14:17:09.296, t_end=2017-04-07 14:17:54.236
 
 
 
 
 
 
 
 
 
Show next? (Y/N)
Analyzing index 37586, t_start=2017-09-19 21:05:06.004, t_end=2017-09-19 21:05:51.499
 
 
 
 
 
 
 
 
 
Show next? (Y/N)
Analyzing index 37592, t_start=2017-09-19 21:05:54.389, t_end=2017-09-19 21:09:04.488
 
 
 
 
 
 
 
 
 
Show next? (Y/N)
Analyzing index 37596, t_start=2017-04-07 14:15:35.524, t_end=2017-04-07 14:16:53.750
 
 
 
 
 
 
 
 
 
Show next? (Y/N)
Analyzing index 37597, t_start=2017-09-19 21:02:26.826, t_end=2017-09-19 21:04:40.338
 
 
 
 
 
 
 
 
 
Show next? (Y/N)
Analyzing index 37604, t_start=2017-04-15 18:51:15.823, t_end=2017-04-15 19:13:23.296
 
 
 
 
 
 
 
 
 
Show next? (Y/N)
 
%% Cell type:code id: tags:
 
``` python
i_meas_dfs[0].to_csv('RQ4.L1B1_I_MEAS.csv')
i_meas_dfs[1].to_csv('RQ4.L1B2_I_MEAS.csv')
```
 
%% Cell type:markdown id: tags:
 
# Query PM for HWC QH voltage
 
%% Cell type:code id: tags:
 
``` python
from lhcsmapi.pyedsl.QueryBuilder import QueryBuilder
 
for index, row in hwc_summary_circuit.iterrows():
 
t_start = row['executionStartTime']
t_end = row['executionEndTime']
 
print('Analyzing index {}, t_start={}, t_end={}'.format(index, t_start, t_end))
 
source_timestamp_df = QueryBuilder().with_pm() \
.with_duration(t_start=t_start, t_end=t_end) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name=['RQ7.L1B1', 'RQ7.L1B2'], system='QH', source='*') \
.event_query().df
 
if not source_timestamp_df.empty:
print(source_timestamp_df)
for index, row in source_timestamp_df.iterrows():
u_hds_dfs = QueryBuilder().with_pm() \
.with_timestamp(row['timestamp']) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name=['RQ7.L1B1', 'RQ7.L1B2'], system='QH', signal='U_HDS', source=row['source'], wildcard={'CIRCUIT2': row['source']}) \
.signal_query().dfs
 
fig, ax = plt.subplots()
for u_hds_df in u_hds_dfs:
if not u_hds_df.empty:
u_hds_df.plot(ax=ax)
plt.show()
```
 
%% Output
 
Analyzing index 37558, t_start=2017-04-03 16:43:50.297, t_end=2017-04-03 16:43:51.234
Analyzing index 37561, t_start=2017-04-03 17:54:45.985, t_end=2017-04-03 17:54:46.679
Analyzing index 37564, t_start=2017-04-14 16:48:38.277, t_end=2017-04-14 16:48:38.288
Analyzing index 37567, t_start=2017-04-03 21:34:31.323, t_end=2017-04-03 21:34:31.707
Analyzing index 37575, t_start=2017-04-10 21:13:26.483, t_end=2017-04-10 21:45:24.038
source timestamp
0 RQ7.L1 1491851662986000000
1 RQ7.L1 1491851662987000000
2 RQ7.L1 1491851662986000000
3 RQ7.L1 1491851662987000000
 
 
 
 
 
Analyzing index 37581, t_start=2017-09-19 21:15:08.781, t_end=2017-09-19 21:20:34.836
Analyzing index 37585, t_start=2017-04-07 14:17:09.296, t_end=2017-04-07 14:17:54.236
Analyzing index 37586, t_start=2017-09-19 21:05:06.004, t_end=2017-09-19 21:05:51.499
Analyzing index 37592, t_start=2017-09-19 21:05:54.389, t_end=2017-09-19 21:09:04.488
Analyzing index 37596, t_start=2017-04-07 14:15:35.524, t_end=2017-04-07 14:16:53.750
Analyzing index 37597, t_start=2017-09-19 21:02:26.826, t_end=2017-09-19 21:04:40.338
Analyzing index 37604, t_start=2017-04-15 18:51:15.823, t_end=2017-04-15 19:13:23.296
 
%% Cell type:markdown id: tags:
 
# Query PM (high sampling) to Get the Current Profile (Slow and Fast Power Abort)
 
%% Cell type:code id: tags:
 
``` python
for index, row in hwc_summary_circuit.iterrows():
 
t_start = row['executionStartTime']
t_end = row['executionEndTime']
 
print('Analyzing index {}, t_start={}, t_end={}'.format(index, t_start, t_end))
 
source_timestamp_df = QueryBuilder().with_pm() \
.with_duration(t_start=t_start, t_end=t_end) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name=['RQ4.L1B1', 'RQ4.L1B2'], system='PC')\
.event_query() \
.df
 
if not source_timestamp_df.empty:
timestamp_b1 = source_timestamp_df.loc[0, 'timestamp']
i_meas_b1_df = QueryBuilder().with_pm() \
.with_timestamp(timestamp_b1) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name='RQ4.L1B1', system='PC', signal='I_A')\
.signal_query() \
.synchronize_time(timestamp_b1) \
.convert_index_to_sec() \
.dfs[0]
 
timestamp_b2 = source_timestamp_df.loc[1, 'timestamp']
i_meas_b2_df = QueryBuilder().with_pm() \
.with_timestamp(timestamp_b2) \
.with_circuit_type('IPQ4') \
.with_metadata(circuit_name='RQ4.L1B2', system='PC', signal='I_A')\
.signal_query() \
.synchronize_time(timestamp_b2) \
.convert_index_to_sec() \
.dfs[0]
 
if not i_meas_b1_df.empty:
ax = i_meas_b1_df.plot()
i_meas_b2_df.plot(ax=ax)
plt.show()
print(source_timestamp_df)
user_input = input('Show next? (Y/N)')
if user_input.upper() == 'N':
break
```
 
%% Output
 
Analyzing index 35071, t_start=2017-04-03 16:43:50.298, t_end=2017-04-03 16:43:51.254
Analyzing index 35074, t_start=2017-04-03 17:54:45.986, t_end=2017-04-03 17:54:46.704
Analyzing index 35076, t_start=2017-04-08 10:15:37.647, t_end=2017-04-08 10:15:37.666
Analyzing index 35079, t_start=2017-04-03 21:34:31.325, t_end=2017-04-03 21:34:31.727
Analyzing index 35090, t_start=2017-04-04 19:37:39.669, t_end=2017-04-04 20:11:01.213
 
 
source timestamp
0 RPHH.RR13.RQ4.L1B1 1491327541780000000
1 RPHH.RR13.RQ4.L1B2 1491327541780000000
Show next? (Y/N)n
 
%% Cell type:code id: tags:
 
``` python
i_meas_b1_df.to_csv('RPHH.RR13.RQ4.L1B1_I_MEAS.csv')
i_meas_b2_df.to_csv('RPHH.RR13.RQ4.L1B2_I_MEAS.csv')
```
 
%% Cell type:markdown id: tags:
 
# Useful Functions
- check available circuit names
 
%% Cell type:code id: tags:
 
``` python
SignalMetadata.get_circuit_types()
```
 
%% Output
 
['RB',
'RQ',
'IT',
'IPD2_B1B2',
'IPD2',
'IPQ2',
'IPQ4',
'IPQ8',
'600A',
'60A',
'80-120A']
 
%% Cell type:markdown id: tags:
 
- check to which circuit type does the circuit name belong
 
%% Cell type:code id: tags:
 
``` python
SignalMetadata.get_circuit_names_or_types('IPQ4')
```
 
%% Output
 
['RQ4.L1B1',
'RQ4.L1B2',
'RQ4.L5B1',
'RQ4.L5B2',
'RQ4.L6B1',
'RQ4.L6B2',
'RQ4.R1B1',
'RQ4.R1B2',
'RQ4.R5B1',
'RQ4.R5B2',
'RQ4.R6B1',
'RQ4.R6B2',
'RQ5.L4B1',
'RQ5.L4B2',
'RQ5.L6B1',
'RQ5.L6B2',
'RQ5.L8B1',
'RQ5.L8B2',
'RQ5.R2B1',
'RQ5.R2B2',
'RQ5.R4B1',
'RQ5.R4B2',
'RQ5.R6B1',
'RQ5.R6B2',
'RQ6.L2B1',
'RQ6.L2B2',
'RQ6.L4B1',
'RQ6.L4B2',
'RQ6.L8B1',
'RQ6.L8B2',
'RQ6.R2B1',
'RQ6.R2B2',
'RQ6.R4B1',
'RQ6.R4B2',
'RQ6.R8B1',
'RQ6.R8B2',
'RQ7.L1B1',
'RQ7.L1B2',
'RQ7.L2B1',
'RQ7.L2B2',
'RQ7.L5B1',
'RQ7.L5B2',
'RQ7.L8B1',
'RQ7.L8B2',
'RQ7.R1B1',
'RQ7.R1B2',
'RQ7.R2B1',
'RQ7.R2B2',
'RQ7.R5B1',
'RQ7.R5B2',
'RQ7.R8B1',
'RQ7.R8B2',
'RQ9.L1B1',
'RQ9.L1B2',
'RQ9.L2B1',
'RQ9.L2B2',
'RQ9.L4B1',
'RQ9.L4B2',
'RQ9.L5B1',
'RQ9.L5B2',
'RQ9.L6B1',
'RQ9.L6B2',
'RQ9.L8B1',
'RQ9.L8B2',
'RQ9.R1B1',
'RQ9.R1B2',
'RQ9.R2B1',
'RQ9.R2B2',
'RQ9.R4B1',
'RQ9.R4B2',
'RQ9.R5B1',
'RQ9.R5B2',
'RQ9.R6B1',
'RQ9.R6B2',
'RQ9.R8B1',
'RQ9.R8B2']
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
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