Tuesday, March 19, 2013

Snapshot tool using Adobe Acrobat on a secured file

When attempting to use the snapshot tool (camera icon) to select parts of a .pdf for a journal club paper today, I ran into an error. The highlight square would appear, but the area would not get copied to the clip board, so I could not paste it into my presentation. I had downloaded the paper from the journal's website, and it had some security enabled that resulted in it saying "(SECURED)" in the title bar, next to the .pdf's name:


The problem occurred in both Adobe Acrobat and Reader. To fix it, I clicked on the lock icon in the left menu (Security Settings) and then clicked "Permission Details" (see above screenshot).
This opened the "Document Properties" dialogue box to the "Security" tab. Here I chose "No Security" from the drop down "Security Method" menu (see screenshot below), click OK, and voila--the snapshot tool worked!


Monday, March 11, 2013

Smooth lines become jagged when saved from matplotlib

I just learned about a very important parameter when saving .pdf or .svg files of figures with many small axes:

import matplotlib.pyplot as plt
plt.rc('path',simplify=False)
or...
plt.rc('path',simplify_threshold=.0001)

Matplotlib (pyplot) tries to intelligently downsample the points that make up lines in order to save space, but when you have very small subplots this results in jagged lines. By either turning off this path.simplify feature, or decreasing the threshold, those lines will be smoother.

Tuesday, February 12, 2013

Make any matplotlib figure look like an XKCD comic!

This cool Python script came in very handy while preparing slides for my last group meeting, thanks, Jake Vanderplas!

http://jakevdp.github.com/blog/2012/10/07/xkcd-style-plots-in-matplotlib/ 

And thanks, of course, to my favorite web comic, xkcd.com

Thursday, January 10, 2013

Setting up Measurement Computer USB-1208FS in MATLAB 2012b

Along with the usual Instacal installation requirement to get the USB-1208FS recognized by the computer, run MATLAB as Administrator (right-click on MATLAB icon, choose 'Run as administrator'), then run the command

daqregister('mcc')

at the MATLAB command prompt.

(This is described in the MATLAB solution 1-5SAEJ8.)

Thursday, December 6, 2012

Plotting strokelitude wing tracking data on fmf frames

I have been working on a Python script to save movies in which strokelitude wingstroke tracking data are plotted on original frames from an .fmf movie. My current version is below.


Load strokelitude data from .bag file into Python

Here is a script I've been using to load the strokelitude data contained in a .bag file. It should be easy to convert it to load data from other ros topics.


Tuesday, December 4, 2012

Using Github for Windows

I have started using the Github Windows GUI for using git on Windows, and so far I am very impressed. Github has made it very easy to download (clone) an entire directory tree of code files to a new computer, something I have to do more often that I would like. Git is an incredibly powerful tool for version control, and I really do not scratch the surface of its functionality. An important thing to remember for a novice user is that it is best to make sure you are working with the newest version of the repository before you start making edits on any given computer. Otherwise merging the edits from different computers (or users) can be hard. This can be accomplished by opening the github GUI before editing any files and clicking 'sync.'

Note: If, when setting up your repository, you accidentally included files that you did not want to have git follow, you can use this command:
git rm --cached <filename> 
by going to tools>open a shell here in the github GUI. You may also have to include a new line in your .gitignore file...

When you inevitably (in my experience) get an error message along the lines of "failed to sync this branch" with options to "open shell to debug" or "cancel," choose the former, and typing
git push
or
git pull 
depending on if you are trying to upload (push) or download (pull) changes from github.com will sometimes work.