In [2]:
from photutils import Background2D, SigmaClip, MedianBackground

from skimage import color
from skimage import exposure

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

In [3]:
afmdata = np.genfromtxt('../Data/UnbackgroundedTXT/500nmGood-0')
afmdata= afmdata*(10**9)
height, width = afmdata.shape


---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-3-4597de9045f4> in <module>()
----> 1 afmdata = np.genfromtxt('../Data/UnbackgroundedTXT/500nmGood-0')
      2 afmdata= afmdata*(10**9)
      3 height, width = afmdata.shape

/Users/wesleytatum/miniconda3/lib/python3.5/site-packages/numpy/lib/npyio.py in genfromtxt(fname, dtype, comments, delimiter, skip_header, skip_footer, converters, missing_values, filling_values, usecols, names, excludelist, deletechars, replace_space, autostrip, case_sensitive, defaultfmt, unpack, usemask, loose, invalid_raise, max_rows)
   1510                 fhd = iter(np.lib._datasource.open(fname, 'rbU'))
   1511             else:
-> 1512                 fhd = iter(np.lib._datasource.open(fname, 'rb'))
   1513             own_fhd = True
   1514         else:

/Users/wesleytatum/miniconda3/lib/python3.5/site-packages/numpy/lib/_datasource.py in open(path, mode, destpath)
    149 
    150     ds = DataSource(destpath)
--> 151     return ds.open(path, mode)
    152 
    153 

/Users/wesleytatum/miniconda3/lib/python3.5/site-packages/numpy/lib/_datasource.py in open(self, path, mode)
    499             return _file_openers[ext](found, mode=mode)
    500         else:
--> 501             raise IOError("%s not found." % path)
    502 
    503 

OSError: ../Data/UnbackgroundedTXT/500nmGood-0 not found.

In [3]:
plt.matshow(afmdata, origin='lower', cmap = 'viridis')


Out[3]:
<matplotlib.image.AxesImage at 0x1133961d0>

In [4]:
sigma_clip = SigmaClip(sigma=3., iters=10)
bkg_estimator = MedianBackground()
bkg = Background2D(afmdata, (50, 50), filter_size=(3, 3), sigma_clip=sigma_clip, bkg_estimator=bkg_estimator)

In [5]:
plt.matshow(bkg.background, origin='lower', cmap = 'viridis')


Out[5]:
<matplotlib.image.AxesImage at 0x1134dba20>

In [6]:
plt.matshow(afmdata - bkg.background, origin='lower', cmap = 'viridis')


Out[6]:
<matplotlib.image.AxesImage at 0x113521080>

In [7]:
### This is the Backgrounded image shown two frames up. The frame below is super pale because I'm working
### on the histogram normalization

backgrounded = afmdata - bkg.background
plt.matshow(backgrounded, origin = 'lower', cmap = 'viridis')


Out[7]:
<matplotlib.image.AxesImage at 0x110c11dd8>

In [11]:
sigma_clip = SigmaClip(sigma=3., iters=10)
bkg_estimator = MedianBackground()
bkg1 = Background2D(backgrounded, (50, 50), filter_size=(3, 3), sigma_clip=sigma_clip, bkg_estimator=bkg_estimator)

In [12]:
plt.matshow(bkg1.background, origin='lower', cmap = 'viridis')


Out[12]:
<matplotlib.image.AxesImage at 0x11277a438>

In [13]:
plt.matshow(backgrounded - bkg1.background, origin='lower', cmap = 'viridis')


Out[13]:
<matplotlib.image.AxesImage at 0x110777160>

In [ ]:


In [1]:
plt.matshow(afmdata, origin = 'lower', cmap = 'viridis')
plt.title('Raw Data File')


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-90efabe212bb> in <module>()
----> 1 plt.matshow(afmdata, origin = 'lower', cmap = 'viridis')
      2 plt.title('Raw Data File')

NameError: name 'plt' is not defined

In [ ]:


In [ ]: