Scientific Programming Study Group

Notes from Jan 21 and 27, 2010 Scientific Programming Study Group

Jim Emery is a member of Kansas City’s STEM2 society. He has started a Scientific Programming Study Group recently at the CCCKC hackerspace. STEM2 is a group that promotes Science, Technology, Engineering and Mathematics. The topic is based on his document titled “Scientific Calculating, Programming and Writing” which can be found at the Stem2 web site.

Using Python

Jim chose the Python language for these sessions. It is a powerful language with many features that make scientific computing easier.

Finding documentation on Python:

Getting Started in Linux

Since I’m using Ubuntu Linux, Python is already installed. To work through Jim’s examples I need to create the following new directories in my home folder “/vthompson“.

  • /bin
  • /tmp
  • /src

The next step is to open a command window and adjust the $PATH variable so any programs placed in the /bin folder can be found. First, keyin the command echo $PATH to see how this environment variable is already defined.

PATH Environment Variable

PATH Environment Variable

From the picture above, we see the /bin directory shows up in in several places. Surprisingly, the directory I just created in my home directory already shows up. How did this happen? The answer can be found in the hidden shell script also found in my home directory,  vthompson/.profile. It contains the following code segment that automatically places a home directory’s /bin path as the first one in the PATH list.

# set PATH so it includes user’s private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH=”$HOME/bin:$PATH”
fi

A good place to find more information is the Ubuntu Documentation page on Environment Variables. Also, for more information about shell scripts check out the Beginners Bash Scripting page. Another helpful document if you’re just starting to work with the command line is this CategoryCommandLine document.

Purpose of the /bin Directory

Linux is designed as a multi user operating system. While your desktop or laptop computer may not be used by other people logging into different accounts, using the home directory’s /bin folder prevents our special programs from interfering with someone else’s computer usage habits.

Now, its time to populate the /bin directory with files from the STEM2 software listing. The files we need are linux.zip and py.zip. Download and unzip the contents into /bin.

Trying a Sample Program

From Jim’s book, Chapter 6 on Graphing and Programmable Calculators, I’m trying the square root sample. I’ve created a /src directory to place my program source code into. Here is the sample program written using the gedit editor:

Squareroot Source Code

Squareroot Source Code

And the resulting screen shot of the program:

Squareroot Example Python Program

Squareroot Example Python Program

Other Python Notes:

About SomeoneKnows
(c) 2010 Vince Thompson

Learning Alibre CAD – Day 18

2.8.2009 (Sunday) –  Day 18 –

It’s A Dual Monitor Day

Today is a day for using two computer screens at the same time as I work through tutorials on Alibre. At our Robotic Labyrinth builder’s meeting Saturday, Richard Brull showed me a 3D part model that he designed using the Alibre Design System and suggested I give it a try. I have been dreading drawing the plans out with my usual Computer Aided Design (CAD) tools.

This is an exciting tool! Normally I avoid time locked demo versions of software but Alibre gives me a full version for 30 days then allows me to run the Alibre Design Xpress forever. At least the time I invest now learning their product is not all lost when the evaluation mode expires. I do have to hurry though, my favorite feature is part of their Professional Version upgrade.

Over the last year I’ve tried using QCad and an older version of AutoSketch I bought at a garage sale to lay out my sheet metal projects. They work and have improved my accuracy and precision when building small projects. I don’t have CNC milling machines but instead build using simpler tools like a drill press and band saw. My projects have come out fitting together pretty well because of the templates and patterns I’ve made using CAD.

I have fallen in love with Alibre’s SheetMetal workspace feature. This is going to be great for laying out the aluminum sheets for our labyrinth game platform’s top and bottom skins. We can model the foam core of the composite and design the close out end pieces to fit right into place. The close out pieces are dependent on the exact thickness of the foam and Alibre’s parametric design feature can easily adjust our design if the actual thickness of the material we receive is different from what was planned. Each of the pieces can be modeled separately then brought together as an assembly.

The metal bending feature takes care of the additional length needed just as the real bends are made.  The designs can then be unfolded as a flat pattern used for cutting and drilling holes. Better yet, this can go directly to CNC equipment like a water jet for a precision fit.

Robotics Summer Camp For Kids

Robotics workshop mini-sumos built from scratch

Robotics workshop mini-sumo's built from scratch

Last year I created a summer camp for kids session at the Kansas City Metropolitan Community College’s Blue River campus. The kids ranged in age from about 12 to 16 years old. We built mini sumo robots from scratch including cutting, drilling, and folding our chassis and then etched and soldered our own circuit boards. The best compliment I heard from the kids was:

“I thought this would be some lame class where the instructor sets down a kit then goes off for coffee and comes back about an hour later. This class is exactly what I wanted”.

Mini sumo robot

Mini sumo robot

The complement was from a kid who’s hydrogen experiment blew up his basement. This was a fun session for me too.

Many possibilities for incorporating Alibre into these sessions include:

  • Creating a digital model of our robot
  • Design our chassis and digitally folding the sheet metal.
  • Unfold the design to reveal our construction plans
  • Model our jig assembly used to bend the chassis

A Reflection Of My Identity

People tend to identify who we are by what we do for a living. Throughout the last 20 years I was an independent contractor writing custom software for clients using MicroStation CAD systems. So my first choice in CAD was Bentley System’s MicroStation, simply because I’ve used it for so long and know it best. As Bentley’s Corporate policies changed, the markets began closing for resellers of MicroStation so my clients began going out of business one by one. Then Bentley began shipping programming opportunities overseas. Their licensing for software developers evolved into a fee of over $2,000 per year until I couldn’t justify that expense any longer. Clients stopped calling, my software license expired, traveling stopped, billing stopped, coding programs stopped, cell phone service stopped and one of the hardest things to come to terms with, it seemed my identity stopped too.

Last Monday with the donation of warehouse space I realized the responsibility of being accessible for this project. Even though I’m unemployed and volunteering my time, I borrowed some money to have a cell phone while spending so much time away from the house. I have lost a few slips of paper I was keeping notes on so I spent more money than I should on refill pages for my Franklin Planner. Then today working through the Alibre tutorials I had a brief sense of who I once was triggered by a phone,  a planner, and a CAD system. Even if the cell phone doesn’t work after the end of the month and the CAD program looses its nice features in 30 days it was a nice moment reflecting on who I once was. I feel for the thousands of people who are loosing their jobs now and ultimately the identity they’ve become to know too.

Read on, check out: Day[19] = 2.09.2009
Yesterday, check out: Day[17] = 2.7.2009
Or start from the beginning: Day[0] = 1.21.2009

About SomeoneKnows

Follow

Get every new post delivered to your Inbox.