# LHC Signal Monitoring API Package
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-api/raw/master/figures/logo.png" width=25%>
This is a package with an API for signal query and processing for the Signal Monitoring project.
## Signal Monitoring Project Architecture
The Signal Monitoring project architecture consists of four elements:
1. API for logging db query and signal processing (<a href="https://gitlab.cern.ch/lhcdata/lhc-sm-api">https://gitlab.cern.ch/lhcdata/lhc-sm-api</a>)
2. Signal Monitoring notebooks (<a href="https://gitlab.cern.ch/lhcdata/lhc-sm-apps">https://gitlab.cern.ch/lhcdata/lhc-sm-apps</a>)
3. HWC and Operation notebooks (<a href="https://gitlab.cern.ch/lhcdata/lhc-sm-hwc">https://gitlab.cern.ch/lhcdata/lhc-sm-hwc</a>)
4. Scheduler for execution of HWC notebooks and monitoring applications (<a href="https://gitlab.cern.ch/lhcdata/lhc-sm-scheduler">https://gitlab.cern.ch/lhcdata/lhc-sm-scheduler</a>)
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-api/raw/master/figures/lhc-sm-architecture.png" width=50%>
## Signal Monitoring API Architecture
The API is a collection of six modules for:
- database access (DBSignal);
- signal, system, circuit naming (Metadata);
- signal and event references (Reference);
- embedded domain specific language for signal/feature/event query and processing, signal assertion, and feature engineering;
- signal query, analysis, and plot (Analysis);
- graphical user interfaces for browsing of historicalsignal features (GUI).
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-api/raw/master/figures/lhc-sm-api-architecture.png" width=50%>
## Installation
There are two ways of using the API in your code:
1. Loading pre-installed packages from an EOS project folder (in SWAN environment)
2. Manual installation (in any environment)
The first option guarantees the use of the most recent code version without manual installation. The second one is more time consuming, however, works in environments with no access to the EOS folder (e.g., Apache Airflow scheduler). In addition, the second method allows to install a selected version (`pip install package_name=version`).
### Preinstalled Packages
To use the set of pre-installed packages please follow these three steps:
1. Contact the Signal Monitoring team (mailto:lhc-signal-monitoring@cern.ch) in order to get read access to the EOS folder with pre-installed packages.
2. (optional) Uninstall existing packages.
Initially, the packages were installed manually as discussed in Section Manual Installation. Depending on the settings, a python script (or notebook) might use manually installed packages instead of the pre-installed ones.
Thus, to avoid issues related to a double reference to a package, please uninstall (with `pip uninstall package_name`) all packages required by the API (tzlocal, tqdm, influxdb, plotly, lhcsmapi).
This operation has to be done only once provided that the packages were installed (to check if a package was installed use `pip list | grep package_name` in SWAN Command Line Interface).
3. While logging to SWAN service, please add the environment script as `/eos/project/l/lhcsm/public/packages.sh`
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-api/raw/master/figures/swan_environment_script.png" width=50%>
### Manual Installation
In order to use the API, it has to be installed with a python package installer as
```python
pip install --user lhcsmapi
```
Check the latest version at <a href="https://pypi.org/project/lhcsmapi/">https://pypi.org/project/lhcsmapi/</a>
The API relies on several external python packages which have to be installed in a similar manner. The list of packages is stored in the <u><i>requirements.txt</i></u> file.
If you use SWAN, the service provides a set of pre-installed python packages through CVMFS. The LHC-SM notebooks require installation of several additional packages on top of CVMFS. In order to install a package, please open a SWAN Terminal by clicking [>_] icon in the top right corner.
![SWAN CLI Button](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/swan-cli-button.png)
Five additional python packages have to be installed:
- tzlocal - for time zone convertion
- tqdm - for progress bar to track queries
- influxdb - for communication with an Influxdb
- plotly - for interactive plotting of circuit schematics
- lhcsmapi - for LHC-SM API
In order to install a package please execute the following command
```
$ pip install --user package_name
```
The expected output, after installing all packages, is presented in five figures below.
- SWAN Terminal output after successful installation of tzlocal package.
![SWAN pip install tzlocal](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/swan-pip-install-tzlocal.png)
- SWAN Terminal output after successful installation of tqdm package.
![SWAN pip install tqdm](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/swan-pip-install-tqdm.png)
- SWAN Terminal output after successful installation of influxdb package.
![SWAN pip install influxdb](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/swan-pip-install-influxdb.png)
- SWAN Terminal output after successful installation of plotly package.
![SWAN pip install plotly](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/swan-pip-install-plotly.png)
- SWAN Terminal output after successful installation of lhcsmapi package.
![SWAN pip install lhcsmapi](https://gitlab.cern.ch/LHCData/lhc-sm-hwc/-/raw/master/figures/swan-pip-install-lhcsmapi.png)
### Updating lhcsmapi Package
Please note that the first four packages (tzlocal, tqdm, influxdb, plotly) have to be installed only once while the last one is still in the development phase and subject to frequent updates. Please send us an e-mail request (mailto:lhc-signal-monitoring@cern.ch) if you want to subscribe for updates. In order to update the lhcsmapi package, please execute the following command.
```
$ pip install --user --upgrade lhcsmapi
```
### Known Issues
At times, in order to update the lhcsmapi package one has to execute the command
```
pip install --user --upgrade lhcsmapi
```
twice while using the SWAN terminal (cf. an error message in the figure below).
<img src="https://gitlab.cern.ch/LHCData/lhc-sm-api/raw/master/figures/double_reinstallation_error.png">
In case this command returns an error, please try to execute it again. Should that operation also fail, please uninstall the package by executing
```
$ pip uninstall lhcsmapi
```
and performing a fresh installation the package
```
$ pip install --user lhcsmapi
```
Should you experience any further issues with installing a package, please contact <a href="https://swan.web.cern.ch">SWAN support</a> or use the preinstalled package with the environment script.
### NXCALS Access with SWAN
The API allows to perform a query of signals from PM and NXCALS. The NXCALS database requires an assignment of dedicated access rights for a user.
If you want to query NXCALS with the API, please follow a procedure below on how to request the NXCALS access.
1. Go to http://nxcals-docs.web.cern.ch/current/user-guide/data-access/nxcals-access-request/ for most updated procedure
2. Send an e-mail to mailto:acc-logging-support@cern.ch with the following pieces of information:
- your NICE username
- system: WinCCOA, CMW
- NXCALS environment: PRO
Optionally one can mention that the NXCALS database will be accessed through SWAN.
Once the access is granted, you can use NXCALS with SWAN.
# 1. Time
**Time** class encapsulates provides a set of methods for conversion between various time formats. In addition it provides a generator for days between given periods. Main methods are:
- Time.to_unix_timestamp(input, unit='ns')
- Time.to_pandas_timestamp(input, unit='ns')
- Time.to_string(input, unit='ns')
- Time.to_datetime(input, unit='ns')
The unit argument is optional. Its default value is 'ns', i.e., nanosecond.
## 1.1. Time.to_unix_timestamp(inpu
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
PyPI 官网下载 | lhcsmapi-1.3.260.tar.gz (285个子文件)
setup.cfg 38B
BLM_NXCALS.csv 1.61MB
RB_QH_2013_1_1-6-0-0_Timestamp_features.csv 1.51MB
600A_LayoutDetails.csv 476KB
600A_MagnetHistory.csv 474KB
60A-120A_LayoutDetails.csv 168KB
nQPS_RB_busBarProtectionDetails.csv 102KB
RB_LayoutDetails.csv 81KB
nQPS_RQ_busBarProtectionDetails.csv 70KB
RB_Reference_Discharges.csv 65KB
60A-120A_MagnetHistory.csv 64KB
RB_MagnetHistory.csv 60KB
RQ_LayoutDetails.csv 45KB
RB_MagnetCellQpscrateSector.csv 38KB
RQ_MagnetCellQpscrateSector.csv 31KB
RB_CrateToDiodeMap.csv 30KB
RB_CrateToMagnetAndVoltageFeelerMap.csv 26KB
RQ_MagnetToCrateMap.csv 25KB
RQ_CrateToDiodeMap.csv 25KB
RB_MagnetToCrateAndVoltageFeelerMap.csv 24KB
IPQ_LayoutDetails.csv 21KB
RQ_Reference_Discharges.csv 20KB
RQ_CrateToVoltageFeelerMap.csv 19KB
RQ_MagnetHistory.csv 15KB
IPQ_MagnetHistory.csv 4KB
IPQ_Reference_Discharges.csv 4KB
IT_LayoutDetails.csv 3KB
IPD_LayoutDetails.csv 3KB
RQ_Reference_PNO_b3.csv 2KB
IT_MagnetHistory.csv 1KB
RB_Reference_PNO_b2.csv 1KB
IPD2_B1B2_Reference_Discharges.csv 674B
IT_Reference_Features.csv 672B
beam_mode.csv 628B
IPD_MagnetHistory.csv 617B
IT_Reference_Discharges.csv 460B
RQ_LHCSM_Quench_Database_Columns.csv 413B
RB_Reference_Differences.csv 385B
OperationPeriods.csv 361B
RB_MP3_Quench_Database_Columns.csv 351B
IT_Reference_Differences.csv 350B
acceptanceLimits.csv 347B
RB_LHCSM_Quench_Database_Columns.csv 320B
IT_LHCSM_Quench_Database_Columns.csv 309B
RQ_MP3_Quench_Database_Columns.csv 283B
RB_Reference_Features.csv 253B
IPD2_Reference_Discharges.csv 248B
600A_RCBXHV_LHCSM_Quench_Database_Columns.csv 238B
600A_RCDO_MP3_Quench_Database_Columns.csv 237B
600A_LHCSM_Quench_Database_Columns.csv 236B
600A_RCDO_LHCSM_Quench_Database_Columns.csv 230B
600A_RCBXHV_MP3_Quench_Database_Columns.csv 228B
600A_MP3_Quench_Database_Columns.csv 223B
IT_MP3_Quench_Database_Columns.csv 214B
IPD_LHCSM_Quench_Database_Columns.csv 199B
IPD2_B1B2_Reference_Features.csv 175B
IPD_MP3_Quench_Database_Columns.csv 164B
IPD2_B1B2_MP3_Quench_Database_Columns.csv 164B
IPD2_Reference_Features.csv 163B
RB_Reference_Features_2014_01_01_2018_01_01.csv 155B
RB_Reference_Features_2018_01_01.csv 155B
IPD2_LHCSM_Quench_Database_Columns.csv 145B
IPD2_B1B2_LHCSM_Quench_Database_Columns.csv 145B
RQ_Reference_Features.csv 131B
IPD2_B1B2_Reference_Differences.csv 92B
IPD2_Reference_Differences.csv 87B
RQ_Reference_Differences.csv 70B
RQ_Reference_Features.csv 67B
RB_Reference_Threshold.csv 32B
RB_Reference_Features.csv 26B
RQ_Reference_Features.csv 25B
MANIFEST.in 467B
600A_METADATA.json 276KB
60A_METADATA.json 204KB
80-120A_METADATA.json 101KB
IPQ4_METADATA.json 63KB
IPQ2_METADATA.json 57KB
RQ_METADATA.json 29KB
RB_METADATA.json 22KB
IPQ8_METADATA.json 16KB
IPD2_B1B2_METADATA.json 15KB
IT_METADATA.json 14KB
IPD2_METADATA.json 8KB
README.md 125KB
PKG-INFO 165KB
PKG-INFO 165KB
test_SignalMetadata.py 82KB
CircuitAnalysis.py 48KB
CircuitQuery.py 43KB
test_QueryBuilder.py 37KB
test_QuenchHeaterAnalysis.py 37KB
test_MappingMetadata.py 34KB
test_Time.py 30KB
DbQueryBuilder.py 27KB
test_DiodeLeadResistanceAnalysis.py 26KB
SignalMetadata.py 26KB
QueryBuilder.py 24KB
Time.py 21KB
test_R600ACircuitAnalysis.py 19KB
test_Signal.py 18KB
共 285 条
- 1
- 2
- 3
资源评论
挣扎的蓝藻
- 粉丝: 13w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功