Skip to content
Snippets Groups Projects
Commit 41fd4304 authored by Thijs vanEeden's avatar Thijs vanEeden
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:9ca0bae6-c86d-4348-b9ad-a76bafb09cb7 tags:
``` python
import km3dia
db = km3dia.DBManager()
df.session_cookie()
```
%% Output
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-211c2e002ecf> in <module>
1 import km3dia
2 db = km3dia.DBManager()
----> 3 db.session_cookie()
TypeError: 'str' object is not callable
%% Cell type:code id:c2433240-3251-42d5-bcfc-94cdd236de9c tags:
``` python
```
%% Cell type:code id:6b9d9ddb-8cf4-4c9c-bdc0-0de78f0ec35d tags:
``` python
#pip install km3dia
```
%% Cell type:code id:4d699873-c366-4870-a262-56b4c1312855 tags:
``` python
#pip install xmltodict
```
%% Cell type:code id:9034b755-3525-4a06-bbd5-59fe2a1ce3d3 tags:
``` python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import xmltodict
import km3db
import km3dia
```
%% Cell type:code id:d9bf120b-39cc-4adc-8c2f-ecb425d7cd18 tags:
``` python
dia = km3dia.DBManager(container='pd')
DOMInt = km3dia.DOMIntegrationSummary()
```
%% Cell type:code id:1959e023-8415-465c-90a2-7da4b9c3a93b tags:
``` python
#Get measurement results
df_tests = DOMInt.test_results
df_tests = df_tests.reset_index().set_index('UPI')
# display( df_tests[ df_tests["SiteID"] == "1" ] )
# display( df_tests["SiteID"] )
# display( df_tests )
display( df_tests[ df_tests["SERIAL"] == "909" ] )
```
%% Output
%% Cell type:code id:8ba41596-7e7a-4925-80f9-98c697e705f4 tags:
``` python
# Generate the list of relevant keys
gain_keys = [key for key in df_tests.columns if key.lower().find('gain') != -1]
dc_keys = [key for key in df_tests.columns if key.lower().find('dark') != -1]
DOM_key = ['SERIAL', 'SiteID']
pmt_keys = gain_keys + dc_keys
```
%% Cell type:code id:7f681bc2-bfb5-4232-8983-de877bf2f1d4 tags:
``` python
# Cut the dataframe to no NaN
df_pmt = df_tests.dropna(subset=pmt_keys)
df_pmt = df_pmt[pmt_keys + DOM_key]
```
%% Cell type:code id:5d602ade-f9d6-4303-ab4c-94938eb0660a tags:
``` python
# Convert pmt results result branches to float
df_pmt = df_pmt.astype(dict(zip(pmt_keys, [float]*len(pmt_keys))))
# display( df_pmt )
# display( df_pmt[ df_pmt["SiteID"] == "1" ] )
```
%% Cell type:code id:357eef49-fcb1-4db6-abab-133bbbf7daf1 tags:
``` python
# df_bad_channels = df_pmt[ df_pmt["Gain 22"] > 1.6 ]
# # df_bad_channels[ df_bad_channels["SiteName"] =="Amsterdam"]
# display(df_bad_channels)
```
%% Cell type:code id:7c303c75-fa66-48f2-a09f-a5bf146538bc tags:
``` python
def count_chan_above_threshold( threshold = 1.7):
doms = []
bad_channels = []
for index, row in df_pmt.iterrows():
bad = 0
# if row["SiteID"] != "1": continue # only amsterdam
for gain_key in gain_keys:
if row[gain_key] > threshold: bad +=1
# if bad == 31: continue # why?
doms.append( row["SERIAL"] )
bad_channels.append( bad )
return doms, bad_channels
doms, bad_channels = count_chan_above_threshold()
bad_doms = [i for i,v in enumerate(bad_channels) if v > 3]
```
%% Cell type:code id:4a9a5b4b-4d41-450d-bc2e-fdb10a870ed8 tags:
``` python
import matplotlib.pyplot as plt
plt.hist(bad_channels, [-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5])
plt.plot(3, 0, 3, 40, color='red')
plt.show()
print("failed doms", len(bad_doms))
```
%% Output
failed doms 20
%% Cell type:code id:4eaed37c-3cae-44ef-88db-fac0ce64acbf tags:
``` python
```
%% Cell type:code id:ca1f27e5-fecb-42d5-8e17-dd58da923f08 tags:
``` python
```
%% Cell type:code id:9ca0bae6-c86d-4348-b9ad-a76bafb09cb7 tags:
``` python
import km3dia
db = km3dia.DBManager()
db.session_cookie
```
%% Output
'xxx.d26b5781'
%% Cell type:code id:c2433240-3251-42d5-bcfc-94cdd236de9c tags:
``` python
```
%% Cell type:code id:7edde1b5-733d-4e31-a539-0a9247551b9f tags:
``` python
```
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment