Tuesday, October 31, 2017

11 minute documentary on fusion

My research lab at Columbia University as well as one of my professors, Gerald Navratil, is featured heavily is this well produced 11 minute documentary on fusion.




As a related aside, I recently watched a much longer documentary (about 1.5 hours) on fusion called Let There Be Light. I've included the trailer to that documentary below.

LET THERE BE LIGHT Official Trailer from EyeSteelFilm on Vimeo.

Thursday, October 26, 2017

Efficient Travel Packing and Organization

I've been traveling for years now by plane and have worked out a system that allows me to travel simply (with few belongings) and in an organized manner.  I occasionally bump into someone who hasn't figured out their own system, and this has inspired me to write this quick blog entry.  My method consists of 1) a simple packing philosophy, and 2) gear for staying organized and minimal.

My packing philosophy

The packing philosophy below, to be frank, is easy and likely a no-brainer.  
  1. Pack only what you need.  Then, try and leave even more behind.  Do you really need a 4 pairs of pants?  Or can you get by with the one you're wearing on the plane and a spare in your bag?  Do you think you'll actually read all 3 of those books?  Empty your wallet of all your junk and cards you won't be using.  Too many people over prepare this way (which I am often very guilty of as well), but it adds a lot of stuff you won't need.
  2. Pack only 1 carry-on bag and 1 personal bag.  I hate waiting for luggage after a long flight as well as lugging around huge suitcases.  Therefore I've stopped checking bags whenever I can avoid it.  If you pack smart and efficiently, you can do multiweek trips, even international, without checking a bag.  I've done this on a number of occasions and never regretted it.  If you find that you have too much stuff to fit into these two bags, refer to point 1 as you thoroughly scrutinize everything you are bringing. 
  3. Everything in your bag needs a home.  Try to find a sub-container or small bag to organize all of your loose things in your bags. 

Gear 

The gear and how you use it is the key to my packing strategy. 
  1. Packing cubes.  I love these packing cubes as they keep everything very well organized and somewhat more compressed than otherwise.  The nice ones I have are from eagle creek but likely any brand will work.  I use a larger one for shirts and pants (ideally only a single pair) and a smaller one for socks, underwear, belt (if needed), ties (if needed), etc.  
  2. Soft case, rugged, duffel bag.  I shared the bag I bought, but others will work likely just as well.  The duffel is nice because it fits underneath the seat in front of me on the airplane even if I overstuff the bag.  The soft exterior allows it easily conform to the area under the seat or in the overhead bin.  
  3. Collapsible hiking daypack.  These packs are great for your carry on and for daytrips whenever you put down temporary roots.  They can hold a fair amount of stuff and collapse down to almost nothing when empty.  I'll often put it in my duffel bag (fully loaded or empty) to reduce my number of bags to one if space permits.   I have an orange one for high visibility for things like hiking.  
  4. Quick dry underwear and socks.  When doing particularly light travel where you may not have convenient access to a washing machine, I like bringing these because I can wash them in the sink and let them dry overnight.  
  5. Folding garmet bag.  This works pretty well for my suit, nice shirts and pants.  While I haven't mastered the art of folding my clothes in this to prevent wrinkles (others claim this is doable), it does pack really well and fits inside my duffel bag. 
  6. Mesh storage bags.  These are great for organizing smaller accessories.  
    • I use one of the larger ones for organizing my toiletries.  The TSA can see through it so they don't get upset, it can breath so it doesn't build up moisture and smell later on, and you can wash it if it gets soiled.  Include a toothbrush cover as well.  Also consider small and durable containers for various bathroom liquids/soaps. 
    • I use another one for my electronics accessories (phone charger, usb cables, backup battery, spare headphones, etc.)
I've also been experimenting with various compression sacks or rollup vacuum bags.  While I'm not quite ready to swear by them like I do the gear above, they are worth considering.  They certainly compress your clothes well.  When I do use them, I tend to use them for dirty clothes.  This has the added benefit of keeping your clean clothes from smelling like your dirty ones. 

Thursday, October 19, 2017

Installing MDSplus on Ubuntu 16.04 for python

I lost a remarkable amount of time trying to get MDSplus operating on my new install of Ubuntu 16.04, and I thought I would share what worked for me.  Of note, I only need the client side MDSplus functions for python.  I tested this operation on a completely completely clean/new install of Ubuntu 16.04. 

What worked for me

The instructions on MDSplus's website [1] are fairly accurate so please read those as well. 

Start by opening the following file with gedit using the terminal command:

$ sudo gedit /etc/apt/sources.list

and copy/paste and save the following file at the bottom

deb http://www.mdsplus.org/dist/Ubuntu16/repo MDSplus stable

Next, enter the following commands

$ wget http://www.mdsplus.org/dist/mdsplus.gpg.key
$ sudo apt-key add mdsplus.gpg.key

$ sudo apt-get update
$ sudo apt-get install mdsplus-python


It should now be installed.  To check the python MDSplus functions, open pythin with:

$ python

and then type:

>>> import MDSplus

Note the capitalization of MDSplus.  Assuming no error is thrown, your install is working. 

(Optional) Another way to check the install, you can type the following commands:

$ sudo apt-get install python-pip
$ sudo easy_install mdsplus


and make sure that MDSplus is correctly installed. 

References

[1] http://www.mdsplus.org/index.php/Latest_Ubuntu/Debian_Packages

Wednesday, September 7, 2016

Limit Swith Mount for CNC's

Just created my second Instructable where I show off my design for a limit switch mount for those generic limit switches off of ebay.  Click above to see the design.

The advantage of the design is that it can accommodate the generic limit switch in a number of configurations.  The mount plate can also break into smaller pieces to accommodate geometric constraints of your CNC. 







Friday, July 22, 2016

Laser cut game token, super easy!

I created simple game tokens for any table top game that may need them.  Red turned out to not have the best contrast with the rastered image so I may try again with a different color at a later date. 


See my instructable for more details:

http://www.instructables.com/id/Laser-Cut-Game-Tokens-Super-Easy/

Monday, June 1, 2015

Retrofitting an analog power supply with a digital meter



Intro

I bought an old an HP 6294A DC power supply from the Dayton Ham fest back in 2013.  The guy I bought it from promised that it worked fine, and I took it home for pretty cheap.  The supply did work, but the dual voltage/current meter on the front didn't.  It was surprisingly hard to find a replacement meter, and it was going to be very expensive.  Instead, I continued to use the supply (with an attached multimeter). I recently came across a cheap digital display, and I decided to swap it in.  

The meter

The meter.  DROK 100V, 10A, internal shunt.  ~$12 from amazon.  Probably could have found it cheaper elsewhere.

DROK® Small Digital Amperemeter Voltmeter Multimeter 0.28" DC 100V 10A Car Voltage Ampere Meter 2in1 with Built-in Shunt Red/Blue 2-color LED Display 12V 24V Motorcycle Battery Monitoror
DROK meter


DROK meter with wire colors explained.  The two small wires (black and red) power the meter.  The meter power can be any DC supply from 4.5 to 30V.  The three larger wires (red, yellow, black) are the inputs for the meter.  

DROK wiring schematic.  The red wire is the voltage sense and attaches the high voltage side of the load.  The yellow wire is the negative side of the load.  The black wire connects to the HP Power supply common.  

The Supply

As it turns out, the HP 6294A DC power supply is a purely analog DC power supply.  This means that there are NO convenient 5V, 12V, etc. rails to tap into for the meter.  Therefore, I had to use a wall wart (see below) to power the meter.

Safety

Before I did ANYTHING, I unplugged the supply from the wall and gave the capacitors (there was one really big one) time to discharge.   

The Install


I pulled out the old meter, and soldered in the new meter using the wiring diagram I showed before.  The wires that connected to the old meter were useless for the new meter.  Therefore, I enclosed the exposed wire ends with electrical tape so they wouldn't accidentally touch something.  

A closer look.  

I wired the wall wart with a stiff piece of copper wire to the AC input of the supply.  I twisted the wire with pliers until taunt and then soldered everything together.  The wall wart was quite secure.  

I tapped a hole and added a screw through the top plate of the supply to clamp the meter in place. 

The Final Product

Both the volt meter and current meter work!
The downside to this build is that the meter stays lit even when the supply is turned off.  This is because the wall wart is attached to the AC input of the supply.  Oh well.  There are certainly worse problems to have.  

Wednesday, April 1, 2015

Vulcan-CFD MATLAB files

I've written a number of MATLAB files to assist my work in Vulcan-CFD.  Below, I've listed the code for each of these files.


Convert Plot3D files to Plot2D

clc; close all; clear all;

% input
d='C:\Users\John\Documents\Pointwise\backwardStepEx';
filename='backwardStepEx_rev1.x';


%% read in 2D(x=m,y=n,z=1) data
cd(d)
inputFile=filename;
outputFile=[filename(1:end-2) '_Plot2D.x'];
A0 = importdata(inputFile);  %raw data
A=A0;  %raw data to be trucated

% number of blocks in data
numBlocks=A(1);

% grab matrix sizes from the header
for i = 1:numBlocks
    m(i)=A(2+(i-1)*3);
    n(i)=A(3+(i-1)*3);
end

% throw away header info from A
A=A(2+numBlocks*3:end);

% grab x and y data from A and ignore z
for i = 1:numBlocks
    N=m(i)*n(i);
    x{i}=A(1:N);
    A=A(N+1:end);
    y{i}=A(1:N);
    A=A(N+1:end);
    A=A(N+1:end); %delete z
end

% set origin to bottom left.  
xmin=x{1}(1);
ymin=y{1}(1);
for i = 1:numBlocks
    for j=1:length(x{i})
        if xmin > x{i}(j);
            xmin = x{i}(j);
        end
        if ymin > y{i}(j);
            ymin = y{i}(j);
        end
    end
end
for i = 1:numBlocks
    x{i}(:)=x{i}(:)-xmin;
    y{i}(:)=y{i}(:)-ymin;
end
%% plot data
% figure; hold on
% colors=['brkgc'];
% for i = 1:numBlocks
%     plot(x{i},y{i},[colors(i),'+'])
% end


%% write 2D(x=m,y=n) data (with the single z value stripped out)
fileID = fopen(outputFile,'w');

% write number of blocks
fprintf(fileID,[num2str(numBlocks) '\r\n']);

% write matrix sizes for each block
for i = 1:numBlocks
    fprintf(fileID,[num2str(m(i)), '\t', num2str(n(i)), '\r\n']);
end

% write x and y data for each block
for i = 1:numBlocks
    p=x{i};
    for k=1:2
        if k==1
            p=x{i};
        else
            p=y{i};
        end
        
        while(length(p)>=4)
    %         fprintf(fileID,[num2str(p(1)), '\t', num2str(p(2)), '\t', num2str(p(3)), '\t',num2str(p(4)), '\r\n']);
            fprintf(fileID,'%1.15e\t%1.15e\t%1.15e\t%1.15e\r\n',p(1),p(2),p(3),p(4));
            p=p(5:end);
        end
        if p~=0
            for j=1:length(p)
                fprintf(fileID,'%1.15e\t', p(j));
            end
            fprintf(fileID,'\r\n');
        end
    
    end
end

fclose('all');

beep


Add Zeros to Time History Files

% The time_merge script with Vulcan-CFD puts writes the files names with numbers that are not padded with zeros.  (E.g.  file_7.f instead of file_0007.f).  Tecplot, however, has trouble determining the correct file order when importing if the buffer zeros are not present.  This code adds the buffer zeros.
clc; close all; clear variables;

cd(uigetdir)
% cd('\\crunch6\John\circleVortexShedding\Time_files\Plot3d_files')
% read in all files with a *.f extension
firstFileList = dir('*.f');

% this next section of code further filters the list of files without a
% single '_' character.  
j=1;
for i=1:length(firstFileList)
    if length(findstr(firstFileList(i).name,'_'))==1
        secondFileList(j)=firstFileList(i);
        j=j+1;
    end
end

files=secondFileList;

n=length(files);
m=length(num2str(n));


for i=1:n
    oldname=files(i).name;
    % find number between the '_' and '.' characters
    num=oldname(findstr(oldname,'_')+1:findstr(oldname,'.')-1);
    
    % buffer with zeros
    while length(num)<m
        num=['0',num];
    end
    
    %rename file
    newname=[oldname(1:findstr(oldname,'_')),num,'.f'];
    if strcmp(oldname,newname)==0
%     dos(['rename "' oldname '" "' newname '"']); % (1)
        movefile(oldname,newname);
    end
end