Spectral inversion trail

Here we take data that follow a power law and try to recover this power law


In [1]:
import datetime

import pymc
import numpy as np
import spacepy.plot as spp # for the style
import matplotlib.pyplot as plt
import spacepy.toolbox as tb
import spacepy.plot as spp
%matplotlib inline

datetime.datetime.now()


This unreleased version of SpacePy is not supported by the SpacePy team.
/Users/balarsen/miniconda3/envs/python3/lib/python3.5/site-packages/matplotlib/__init__.py:872: UserWarning: axes.color_cycle is deprecated and replaced with axes.prop_cycle; please use the latter.
  warnings.warn(self.msg_depr % (key, alt_key))
Out[1]:
datetime.datetime(2016, 6, 27, 13, 33, 36, 542696)

In [6]:
# setup data from y=x~{-1.4}
x_real = tb.logspace(1, 100, 20) # think of as energy
y_real = x_real**(-1.4)
plt.loglog(x_real, y_real, '.-')


Out[6]:
[<matplotlib.lines.Line2D at 0x114a9b4a8>]

In [7]:
#setup data 
x = np.random.random_sample?

In [14]:
x = np.sort(np.random.random_sample(size=30)*(x_real.max()-x_real.min()) + x_real.min())
y = np.random.normal(loc=0, scale=0.1, size=len(x)) * x**(-1.4 + np.random.normal(loc=0, scale=0.001, size=len(x)) )
plt.loglog(x, y, '.-')


Out[14]:
[<matplotlib.lines.Line2D at 0x114e5fef0>]

In [ ]:


In [ ]: