#!/usr/bin/env python # coding: utf-8 # # Measuring Plasmon Resonance Shift in Gold Nanoparticles in Water # ### Objective # From the bundled dataset, `aunps_water()`, we measure the surface plasmon resonance shift when adding gold nanoparticles to water, then adding the protein, Bovine Serum Albumin. # ### Environment Setup # Configure notebook style (see NBCONFIG.ipynb), add imports and paths. The **%run** magic used below **requires IPython 2.0 or higher.** # In[1]: #%run NBCONFIG.ipynb get_ipython().run_line_magic('pylab', 'inline') # #### Step 1: Import some Data from csv # In[2]: from skspec.data import aunps_water ts = aunps_water() ts.iloc[0:5, 0:5] # In[3]: ax = ts.plot() ts.reference = 0 ts.varunit = 's' ts.baseline.T.plot(color='k', ls='--', ax=ax) ts.reference.T.plot(color='magenta', ls = '--', ax=ax); # In[4]: ts = ts.nearby[400:700] ts.sub_base() ts.norm = 'a' ts.plot(cbar=True) # In[5]: aunps = ts.nearby[400:700] aunps.plot(kind='waterfall', cmap='seismic', cbar=True) aunps.name='SPR peak of nanoparticles' # ### Let's cut out curves based on the value of their max values. If the max absorbance is less than 0.10 absorbance units. # In[6]: mask = aunps.max() > 0.1 aunps_cut = aunps[aunps.columns[mask]] aunps_cut.plot(); # ### Plasmon Resonance Shift # In[7]: aunps_cut.idxmax().plot(title='SPR shift vs. time') plt.ylabel('Peak Wavelength (nm)') # ### Adding some noise to the spectra # As an excercise, we can add some noise to the spectra, # In[8]: noise = np.random.rand( *aunps_cut.shape ) aunps_noisy = aunps_cut + 0.035*noise aunps_noisy.plot(kind='spec3d', color='k'); # ### Two-Dimensional Correlation Spectroscopy # We merely demo how to visualize the 2D synchronous correlation spectrum of our data. # In[9]: from skspec.correlation import Corr2d from skspec.data import aunps_water get_ipython().run_line_magic('pylab', 'inline') ts = aunps_water().nearby[:600].as_norm('a').as_varunit('s') cspec = Corr2d(ts) cspec.async.plot(contours=128,cbar=True); # ### Spectral gui # In[10]: from skspec.interact import SpectraModel, SpectraGui specmodel = SpectraModel(spec=aunps) gui = SpectraGui(model=specmodel) gui # In[12]: gui.tight_layout() #Formats gui layout #
#
# # #
# #
# #
# #
# # #
# #
# #
# #
# #
# #
# #
# #
# # #

This notebook is free for redistribution. If citing, please reference as:

# - *Hughes, A. (2012). [A Computational Framework for Plasmonic Nanobiosensing](https://www.researchgate.net/publication/236672995_A_Computational_Framework_for_Plasmonic_Nanobiosensing). Python in Science Conference [SCIPY].* # # #

Questions or Feedback?

# # * skspec@groups.google.com # * hugadams@gwmail.gwu.edu # * twitter:
@hughesadam87 # * Mark Reeves Biophysics Group # # # # #

References:

# # * [1] : **REF 1** # * [2] : **REF 2** # # # # # #

Related:

# # * skspec: Exploratory Spectral Data Analysis # * pyparty: Image Analysis of Particles # * Lorena A. Barba (GWU Engineering) # * xray: extended arrays for scientific datasets # # # #

Notebook styling ideas:

# # * Louic's web blog # * Plotly # * Publication-ready the first time: Beautiful, reproducible plots with Matplotlib # #
#