#!/usr/bin/env python
# coding: utf-8
# In[2]:
get_ipython().run_line_magic('matplotlib', 'inline')
import numpy as np
import matplotlib.pyplot as plt
# In[3]:
import pandas as pd
# In[54]:
base_url = "http://golem.fjfi.cvut.cz/shots/{shot_no}/DAS/0417RigolDS1074{group}.ON/data_all"
def load_data(shot_no, identifier, fs_full, n_samp_full):
url = base_url.format(shot_no=shot_no, group=identifier)
data = pd.read_csv(url, header=None, sep='\\s+')
fs_red = data.shape[0]/n_samp_full * fs_full
dt = 1/fs_red
data.index *= dt
data.index.name = 'time'
return data, dt
# In[61]:
df, dt = load_data(29703, 'd', 125e3, 3e6) # in S/ms -> ms time
df.head()
# In[47]:
df.plot(subplots=True)
# In[62]:
offset = df.loc[0:4,1].mean()
offset
# In[63]:
corrected = df[1] - offset
# In[64]:
dt = df.index[1] - df.index[0]
dt
# In[66]:
I_ch = np.cumsum(corrected) * dt * -5e3
# In[67]:
I_ch.plot()