I once worked at a place that had beer at work… it was great and we never really had any issues with it. In fact I’d say it served as a great way to bring together a group of, seemingly, misfits.
To add a label to the colorbar in your current figure, just use:
t = colorbar('peer',gca);
set(get(t,'ylabel'),'String', 'Colorbar Label Text Here');
where t is just a handle.
Just because you aren’t an engineer working inside a large corporation known for engineering that doesn’t mean you shouldn’t work like an engineer when it comes to documenting your open source projects.
I caught a great talk by Amanda Wozniak at the Open Hardware Summit about project design. While the talk used the development of an Arduino servo controller as an example of documenting your process, I think what was presented could be applied to the design process in general.
When we talk about open (source) hardware it would seem that CAD files and a bill of materials is enough for anyone to understand and adapt your design— but that’s not really the case. Schematics and a list of components doesn’t say anything about what you were thinking when you were designing your project. Stupidity or brilliance may be lurking in there but it’s not so easy for someone else to reverse engineer your thoughts.
It doesn’t matter if you are working on one aspect of an integrated project or if you are a solo hardware hacker you should have the same approach to documenting your design. Inside of private (closed) projects there is a great deal of documentation behind corporate walls that you may get a chance to see if you sign non-disclosure agreements. Just because a project is closed doesn’t mean that there isn’t any documentation, it’s just not available to you. In the end, an engineer on a large, closed corporate project ends up having to do more paperwork justifying components and commenting on liability issues. We get a break in this regard when working on projects that aren’t commercial.
This design and documentation process is straightforward:
- An idea!
- Ask questions surrounding your idea;
- Design & record your rationale;
- Review what you’ve done;
- Make it and test it.
but that’s not all… you need to evaluate your design:
- Does it work?
- Did you address the questions (see step 2)?
Now repeat steps 2—7 until you are ready to unleash your design onto the world.
This thinking can be applied to both hardware and software projects. Documenting your design rationale is overlooked and important step in truly open-sourcing your project. Even if you aren’t an engineer, you are when it comes to documenting your projects!
Install ipython/python v2.6:
sudo port -v install py26-ipython
This is probably going to take a good two or three hours, depending on what your system. If you have a pretty minimal set of macports packages, count on this taking around 3 hours on a macbook pro (circa 2010).
sudo port install py26-matplotlib
“python_select” is deprecated, so just use “select” to select the appropriate python version to add to your path:
sudo port select python python26
Install wxpython. This required to drive the graphical backend (i.e., when using the “show()” command). You can get around this by using the MacOSX backend, but if you have time go ahead and install this (it’ll probably take an hour or more):
sudo port install py26-wxpython
To get images to show you need to set the appropriate backend. Edit your matplotlibrc configuration file. It should be located at:
If it doesn’t exist, go ahead and make it and edit (using textmate):
Make sure the following line is added to the configuration file, using MacOSX as the backend seems to work fine.
backend : MacOSX # Use macosx as the plotting backend.
I used this since I was waiting for wx-python to compile. More information about various settings in the configuration file can be found here.
More information about setting up pylab with macports is available from here.
Test your installation!
Fire up pylab:
and generate a sin plot:
x = arange(0,10,0.2)
y = sin(x)
If a plot shows up you have Numpy installed and MacOSX is a functional backend.
Have a beer!
Papers has been a pretty good app for dealing with all the PDFs I get from journals. I originally used google scholar to get BibTex article metadata but it leaves something to be desired. So I started using Web of Science to search for articles and match papers. It works great… when I am within a network that has a subscription! But what about when I am at home? I have access through a proxy server but papers doesn’t seem to acknowledge this as an option.
Lo and behold, Harvard medical school has instruction on how to set this up.
In short, for Papers versions <2, you just need to append the address contained in gatewayurl.txt with your EZproxy address.
For instance, change:
to include the url of your EZproxy server:
You can find gatewayurl.txt in:
Users/username/Library/Application Support/Papers/PlugIns/SearchEngines /WOSSearchEngine.searchengine/Contents/Resources/
Wondering where Vegemite is to be found in New York City?
UPDATE: Looks like Morton William’s has it too… at least at the Morty’s on 23rd St @ 2nd Ave—and it’s a bit cheaper than Kalustyans.
I have found it in Manhattan at Kalustyans–
$8.99 $13.99 for a 150 220 gram glass jar:
123 Lexington Ave (bet. 28th & 29th Sts.)
New York, NY 10016
(212) 685-3451 ?
The practical application of discharging a capacitor in an RC circuit is a tradeoff between the time it takes to safely discharge a circuit and the amount of power dissipated in the resistor. The voltage across the plates of a capacitor decreases exponentially with time during discharge, , where the capacitors time constant is defined as:
It is generally assumed that a capacitor is “fully” discharged after 10 time constants (10*RC). For instance, a 3500 microfarad capacitor with a 20 kohm resistor has a time constant of 70 seconds. It should be fully discharged in ~12 minutes. Supposing that the capacitor initially has 400 volts across the plates, the voltage after 10*RC is 18 millivolts. This is found by solving the equation above; or can be approximated by (400 volts)*(0.37^10), since each time constant reduces the voltage by 63 %.
The second factor to consider is the power dissipated across the resistor. To safely discharge a capacitor the power dissipated by the resistor must be within its limits. The power dissipated by a resistor is:
Thus for the RC circuit mentioned above the resistor must be capable of dissipating:
Consider this before placing a standard 1/4 W resistor across that high voltage capacitor!
The inner product (mtimes, in matlab speak):
C = A*B;
is a neat way to get the sum of the product of two vectors. It may come naturally to those who often work with matrices, but I usually work with array operations (i.e. .*), so this is a neat “trick.”
The inner product of a row-vector and a column-vector, gives a scalar that is equal to the sum of the products over the respective indexes:
The inner product of two vectors is equivalent to the summation of the product of the respective indices. Alas, there is a caveat! If there are any NaNs in either vector, the resulting scalar will be reported as NaN by matlab. So, to get around this, just convert any NaN in your the to 0. You can also easily convert NaNs to zeroes in a matrix with the same code because matlab can specify matrix elements with linear indexing.
The matlab code to replace NaNs with zeroes for any matrix, or vector, A is simply:
A(isnan(A)) = 0;