<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 What we are going for here is recovering apower law from a set of channels that will become more realistic as we move down the notebook.
Data
The data form a powerlaw from 50keV to 5MeV with power law index of -2.5.
Step1:  100% efficiency integral channels
<ASSISTANT_TASK:>
Python Code:
def get_data(x, mag=100, pl=-2.5, xmin=50.0):
    C = (-pl - 1)*xmin**(-pl-1)
    return mag/0.03*C*x**(pl)
    
get_data(50)    
50**-2.5
100**(-1/2.5) * 50**-2.5
pl = -2.5
xmin = 50
C = (-pl - 1)*xmin**(-pl-1)
get_data(50)
plt.loglog(tb.logspace(50, 5000, 10), get_data(tb.logspace(50, 5000, 10)))
Explanation: What we are going for here is recovering apower law from a set of channels that will become more realistic as we move down the notebook.
Data
The data form a powerlaw from 50keV to 5MeV with power law index of -2.5.
End of explanation
def integral_channel(x, cutoff, mag=1.0):
    ans = np.ones_like(x)
    ans.fill(mag)
    ind = (x < cutoff)
    ans[ind] = 0
    return ans
plt.loglog(tb.logspace(50, 5000, 10), integral_channel(tb.logspace(50, 5000, 10), 60))
integral_channel(tb.logspace(50, 5000, 10), 60)
def de_e_channels(de=30, xmin=50, xmax=5000, npts=500):
    ans = []
    co = xmin
    xval = tb.logspace(xmin, xmax, npts)
    while co < xmax:
#         print('co', co)
        ans.append(integral_channel(xval, co))
#         print(de/100 * co, de)
        co += (de/100 * co)
    return xval, np.asarray(ans).T
x, y = de_e_channels()
plt.semilogx(x, y)
print(x.shape, y.shape)
# print(x, y)
Explanation: 100% efficiency integral channels
End of explanation
<END_TASK>