password-free ssh and writing executable bash scripts

First, a tangentially related note on password-free ssh and writing executable bash scripts.  By example… I wanted to quickly login to the login node for the research computing cluster at Rice University (all names/addresses have been changed).  Here’s how one would have to login the hard way:

Matty@HomeComp~$ ssh Matty@Cluster.rice.edu

then you’d have to enter your password. Here’s how to skip the step of entering your password every time [link].

After I set up pwd-free ssh, I wrote the following bash script:

#! bin/bash
# filename: sshCluster
# script to login to Matty@cluster.rice.edu automatically
ssh Matty@cluster.rice.edu

Then at the command line:

~/$ chmod +x sshCluster

Then you should be able to simply type

~/$ sshCluster

at the command line to login.

Posted in computing, shortcut keys | Comments Off on password-free ssh and writing executable bash scripts

Some notes on reconstruction algorithms and “choosing the right parameter”

First, somewhat unrelated, here are some Acrobat Reader shortcuts.  I’m especially excited about Alt + <– and Alt + –> to go backward or forward a “view”.  So for example, in a paper with internal hyperlinks to the citations as they come up, if you click to go to the citations section and check the citation, you can hit “Alt + <–” to go back to the place where you clicked the link.

As for “the right parameter” and some notes on recon algos.  I finally understood the “Bregman iteration,” which I would sum up as iterations of solver solutions.  So it’s almost like a meta-solver.  But taken all together, Bregman iterations wrap around well-known recovery algorithms such as spgl1 and fpc implementations.  There’s also orthogonal matching pursuit, gspr, l1-magic, and more.  Here are some supporting and related papers from the osher/yin and co. teams:

On the convergence of an active set method for l1 Minimization

relates to fpc_as, the latest iteration of fpc– fpc =fixed point continuation, as = active set

Fast Linearaized Bregman iteration for compressive sensing and sparse denoising

Linearlized seems to mean using the TV norm, but I really don’t know right now.

Bregman iterative algorithms for l1-minimization with applications to compressed sensing

What I would call the main paper for implementing Bregman iterations using any basis pursuit-type problem (BP, BPDN, LASSO, etc) solvers.

Candes, wakin, and Boyd at Stanford cite the above paper, as they provide what looks to be an improvement, or at least a similar but alternate method for updating reconstruction parameters: Enhancing Sparsity by Reweighted l1 minimization (preprint 2009).  Also related, and including some phase diagrams to illustrate, we have Maleki and Donoho with Optimally tuned iterative reconstruction algorithms for compressed sensing.  The accompanying website devoted to disseminating the results and methods including code, figures, and simulation parametersof that work is here.  In the paper they cite the importance of and strive for “promoting reproducible computational research (final paragraph p. 9).”  They also point out that the use of phase transitions is much more illuminating and useful than proofs of restricted isometry properties, and much more flexible and accessible for engineers (and scientists!).  I totally agree, it’s why I’m using them myself.

Posted in compress(ed/ive) sensing, mathematics, shortcut keys, signal processing | Comments Off on Some notes on reconstruction algorithms and “choosing the right parameter”

Microscopy Lamp

For my microscope system I need me some white light.  At first I went with a high power LED from thorlabs, and instead of paying some hundreds of dollars for their driver, I built one myself for much less.  The central element was the current regulator, the 1000mA, externally dimmable “buck puck” from luxeon star LEDs, along with a wiring harness for easy interfacing with the wiring from the Thorlabs LED.  At that time there were no 4-pin female mounted LED mating connectors on the thorlabs site, so I just chopped the connector off that would go to the TL driver and connected it to the wires from the wiring harness attached to the buckpuck.

This compact light works quite well for brightfield illumination, but not as well for darkfield illumination with an annulus.  Another approach to darkfield involves using an axicon, which is a lens that creates a ring through diffraction, whereas an annulus simply blocks a central region of the beam, creating the darkfield ring to be sent to the back aperture of the objective lens in the case of epi- (or back-) illumination.  Haven’t checked other vendors, but thorlabs axicons sell for more than $1,000, so a more affordable approach would be preferable.  But currently it seems the light from the annulus with only the high power LED is too weak, less than 1W.  So it’s time to look at other lighting options.

Flashlamps seem like both the most affordable and also a widely used option.  Here’s one vendor: interlight.biz.  I’ve seen xenon flashlamps used scientific applications, maybe because the xenon spectrum is a little bit flatter than the others (spectrum link is to jpeg found in wikipedia article on “flashlamps“.

Posted in microscopy, Optics | Comments Off on Microscopy Lamp

SUG@R – grid computing at Rice

Grid computing, with some effort, can result in huge gains in computing power per unit time.  Its most straightforward use is to run one single script with many different parameters.  Here are some essential documents from the Rice IT website:

Queue Policy: 16 jobs can be running for a user at any given time because 16 is the number of cores one user can use at a time.  There seems to be no maximum to the number of jobs one can submit at a time.  The SUG@R scheduler takes care of the rest.

Useful Links Outside Rice

UNIX:

vim – how to indent multiple lines (see visual one with keystrokes! I didn’t understand the others.)

vim – setting preferences in .vimrc file (doesn’t show up in home directory on ls)

vim – search (find) and replace

.pbs commands

— commit multiple jobs it’s probably better than writing a script to submit many jobs, plus qdel, qalter, and the others will work on job arrays as a whole.

Matlab on clusters:

High Performance Computing (australia)

Posted in computing | Comments Off on SUG@R – grid computing at Rice

hyperlinks and alphabetized lists in latex

There are so many things to learn and not quite as many ways to record what it is you’ve learned. There’s not many things more frustrating than the feeling “I knew a thing some time ago, but now I’ve forgot” and feeling helpless to ever get it back. For this reason I’ve resolved to do a better job documenting what I’ve learned and been working on. That’s what this blog is all about, but a blog isn’t the best place for mathematics or keeping track of citations. It also doesn’t seem natural to make a printout of a blog either. But getting word processor features into LaTeX is a chore sometimes.  Below are how to put hyperlinks into latex documents and also how to create alphabetized lists in latex.  For me I want alphabetized lists to make a reference sheet for myself and hyperlinks so that I can seamlessly access my references as I’m reading.

\usepackage{hyperref}

hyperref is the standard for adding hyperlinks to a pdf, and it’s super easy.  You can make internal links to within the pdf:

we use \hypperref[mainlemma]{lemma \ref*{mainlemma}}

\usepackage{hyperref}

or you can link to outside sources either displaying the actual site location or an alternate:

\url{http://www.wikibooks.org}
\href{http://www.wikibooks.org}{wikibooks home}

\usepackage{datatool}

the datatool example below can be taken directly into your tex editor and compiled to generate an alphabetized definition list.  Will definitely be good for making reference sheets.  I took it from this site on LaTeX community.  This is also a good example of the power of latex that shows what a little creativity could do.  Also datatool itself seems like a powerful method for reading in data or arrays to be displayed in the pdf.

\documentclass{article}

\usepackage{datatool}

\newcommand{\sortitem}[2]{%
  \DTLnewrow{list}%
  \DTLnewdbentry{list}{label}{#1}%
  \DTLnewdbentry{list}{description}{#2}%
}

\newenvironment{sortedlist}%
{%
  \DTLifdbexists{list}{\DTLcleardb{list}}{\DTLnewdb{list}}%
}%
{%
  \DTLsort{label}{list}%
  \begin{description}%
    \DTLforeach*{list}{\theLabel=label,\theDesc=description}{%
      \item[\theLabel] \theDesc
    }%
  \end{description}%
}

\begin{document}

\begin{sortedlist}
  \sortitem{banana}{A yellow fruit}
  \sortitem{pear}{An oddly shaped fruit}
  \sortitem{apple}{A roundish fruit}
\end{sortedlist}

\end{document}
Posted in computing, LaTeX | Comments Off on hyperlinks and alphabetized lists in latex

cygwin, bash, mingw, open source matlab for windows. And SUG@R at Rice

It’s been years since I submitted a job to a computer cluster, and I’ve since purchased a Windows 7 machine, and have a Windows 7 machine in my office, Windows XP in my lab… Right now we’re testing out how well different reconstruction algorithms work, and how changing the parameters of reconstruction lead to differences in reconstruction speed and quality.  We can change some parameters manually and run the recons locally.  However for a full-scale comparison over all parameters we need much more power.  Thus I’ve embarked on two parallel projects: 1. Get a nice bash shell on Windows 7.  2. Set up an account on the Rice grid, SUG@R: Shared University Grid @ Rice and remember how to submit jobs/write up job requests.  A related goal is to get Python going on my x86-64 bit Windows machine.  And even though I really love matlab, I want to make sure I can survive without it if there’s a project that would be better off without it, e.g., if you want some web crawling or other “web 2.0” functionality.  I mean I don’t think matlab has many dom parsing tools… Matlab does have dom parsing tools OF COURSE. Anyway, matplotlib and numpy together are the open source equivalent.  I think the plots look better straight out of the box and the plotting commands are very smooth.  The Python shell gives (almost) the same interactive environment as the Matlab command line.  Plus I think numpy simply wraps fast linear algebra algorithms in C, so the speed is at least comparable.  Here’s how the first part is going:

At first I installed Cygwin, which allows for easy installation of a bash scripting shell and automatically grabs whatever packages, e.g. Python, numpy, vim, and many many many more, the user wants.  This all convinced me, so I went with it.  However the packages that Cygwin grabs seem to not necessarily be compatible with my 64 bit system.    Primarily I was getting an error message that numpy  couldn’t build because Python.h was not compiling.  I was building from the tarball because although I had added the home python directory, C:\Python, to my %PATH environment variable, the numpy .exe for windows (32 bit) was claiming that Python 2.7 was not on the “windows registry”.  After thoroughly confusing myself trying to figure out wtf the windows registry is, I decided to try installing an unofficial 64 bit release of numpy, which worked!  The 64-bit numpy installer was able to recognize Python 2.7 on my %PATH, and afterwards numpy and matplotlib were working normally.  So probably the problems compiling and the recognition problem were related and the problem has to do with 32 vs. 64 bit.  But really understanding all that is beyond me right now…

So the next step was to run Python from the command line in Cygwin.  At this point I realized that Cygwin was holding on to its own environment variables and executables, including Python.  According to Cygwin, I was still on Python 2.6 and it knew nothing of my victories over numpy and matplotlib.  Luckily I still had MinGW installed from a similar previous foray, so I brought up its bash shell and it was completely up to date with the changes I’d made to my Windows environment.  Needless to say I will be getting rid of Cygwin… or maybe keep it around but forget about it.

Next: cluster computing!!!!

Posted in computing | Comments Off on cygwin, bash, mingw, open source matlab for windows. And SUG@R at Rice

Circulant Matrices, Gabor Frames, Weyl-Heisenberg groups, and the Fourier Transformm

In signal processing the marks of great physicist-mathematicians of the early 20th century and beyond are everywhere.  Apparently when Gabor authored his seminal paper (cited by 4087 according to google scholar), he was building on the foundations of laid by Weyl, and others besides, in his Theory of Groups and Quantum Mechanics.  More can be found in the intro to this book, Gabor Analysis and Algorithms: Theory and Applications, by Hans G. Feichtinger and Thomas Strohmer.  I also found this paper that has an interesting introduction, which should be compared with Aldrovani’s discussion (in his book Special Matrices of Mathematical Physics) of Weyl-Heisenberg groups, which says that “The duality between U and V leads to a deep and rich structure standing behind the Quantum Mechanics of simple systems.”  U and V are NxN matrices, U is the first-order permutation matrix, and V has the N roots of unity on its diagonal.  Aldrovanialso advises (p. 82), “The relation of matrices to Fourier transformations is obscured by our inclination to look at them as sets of rows and columns. … It is actually only a convenient convention, and comes from the preferred use of a special (“canonical”) basis in matrix space.  Other bases, in particular that formed by Weyl’s [or Gabor if it’s ‘information’ ..mt] operators, give the prominent role to the diagonals.  Matrix product acquires a new aspect and many a Fourier-related property come to the fore.”  Furthermore, by this tact, “We shall see how a matrix space can be made into a differential manifold, and how a natural symplectic (phase space) setup turns up.”

A google search turned up this site that got me started down this path of inquiry [link].  I got to that by checking deeper into work by Holger Rauhut, there’s a pdf of his slides with motivation and coverage of topics along these lines, and also this thorough paper Compressive Sensing, which looks like a very nice review with new insight.

It’s very exciting to start to see the connection between these various branches of mathematics, physics, information theory.  More to come on those topics…

Posted in compress(ed/ive) sensing, mathematical physics, mathematics, signal processing | Comments Off on Circulant Matrices, Gabor Frames, Weyl-Heisenberg groups, and the Fourier Transformm

More on lasers

Looking more at lasers, specifically for a 532 nm diode-pumped solid state laser, I’ve found two companies, Coherent and Klastech, that claim to solve the “green noise” problem with these.  I didn’t know there was a problem!  But apparently when various laser cavity modes interact with atomic electron state modes, the result can be a noisy mess.  Klastech’s solution is based on a Fox-Smith interferometer, and from what I can tell Coherent’s solution depends on using a semiconductor for the 532 nm lasing material so that the relaxation time is faster than the cavity travel time for the photons, thus avoiding any of the unwanted interference that might happen in a harmonic crystal.

Klastech also claims that their design leads to “inherently single frequency” operation.  They claim <1MHz linewidth, which is ~2E-9 of the frequency (~5.6E14).

One other note, I found another series of useful entries from RP Photonics’s Encyclopedia of Laser Physics and Technology, more on the M^2 beam factor, one of many quantitative measures of laser beam quality.  RP explains it as how close a beam is to being diffraction-limited.  The closer a beam is to being diffraction-limited, the easier/more accurately it can be focused down, and similarly the lower the beam divergence.  Beam divergence is how fast the beam expands “far from the beam waist,” or in other words far from the focal point.  Makes some sense, but how do you take account of, say, the focal length of the lens that’s being used to create the beam waist in the first place?  Here’s an article by Siegman with more insight on the subject of beam quality: Defining, measuring, and optimizing laser beam quality.

Finally, some methods for calculating and measuring M^2.

Posted in Lasers, Optics | Comments Off on More on lasers

Learning about lasers

Right now I’m shopping for a laser.  Will it be a CVI Melles-Griot, or a Klastech, or Coherent, or Newport spectra physics, or what?  The truth is I know very little about lasers, but I’m learning by necessity, which is one thing that’s great about research.

I’m interested in a DPSS 532 nm laser, where a 808 nm diode laser pumps an Nd:YAG (standing for Neodynium doped Yttrium Aluminun Garnet) crystal, where electronic transitions give rise to 1064 nm light most intensely.  The 1064 light is selected out then sent through a frequency doubling crystal.  Coatings and filters get rid of the remaining 808 and 1064 light.

Another thing I was needing to know was “what does the M^2 value mean?” regarding beam quality.  I found out that, roughly, it is how similar a beam profile is to a Gaussian.  It’s the ratio of the beam parameter product (BPP) of the beam to the minimum possible beam parameter product, that of a Gaussian beam, which wavelength/pi.  Thus an ideal TEM00 single-mode 532 would have M^2 = 1.  Thus since I’m interested in imaging with this laser by expanding the beam and want to take a nice slice of gaussian frosting to send to the objective, the Klastech with M^2 = 1.05  seems fit for the job.  Cheers to Jim Doty for that and other good suggestions.

All for now… next posts hopefully will include raman spectroscopy of graphene, compressive sensing phase transitions, matlab, more laser stuff, something on high powered led options…

Lastly just found this blog ProfHacker while looking for info on having access to zotero bibs through WordPress blogs…he’s got info on that.  Also one of his latest posts was on establishing a web presence, which happens to be one of my new year’s resolutions.

From "Encyclopedai of Laser Physics and Technology"

Sam's LaserFAQ

Posted in Lasers, Optics | Comments Off on Learning about lasers