Saturday, May 21, 2016

Where next -? (May 24, 2016)

Ideas?

What should we talk about?

Example problems involving if then -?  while ( ) ?

anything specific in analysis of data -?


Tuesday, May 17, 2016

May 17, 016 (what we did in class)

We discussed techniques to open and read files - the difference between "space" and "tabs" and "commas" - discussed if then and also "while" ...

What else? (!)

In the pffreadcsv program, I check for "Block" in the first "column"

What if that line does not start with "Block" - ?

I can modify the read as follows

# what if Block is NOT in the first column?
# read the file line by line
nstart = 0
for i in lines:
    nstart = nstart + 1
# the split command splits the line into individual elements as it were -
# so a line that is 1,2,1200,500 will be split into 1 2 1200 and 500 using the comma as a separator
    thisline = i.split(',')
# if I want to look for a line that has 'Block' (because I happen to know the data comes after this line)
    nchars = len(thisline)
    for j in range(nchars):
        if (str(thisline[j]) == 'Block'):
            print ("In your file ", datafile, " Block shows up in line ", nstart, ' at position ', j )
            break;
        else:
            continue

So you can "look" for any character you want on that line ... (!) 

(this makes it a bit more general than what I had)

Saturday, May 14, 2016

Some reminders (!)

Our objective is to make sure that anyone/everyone who is interested in python is able to "program" using python - simple or complex.

A reminder - I do not want to stand and "lecture" - but "do" - and "enable" you do do

I anticipate that there will be many who have never written a program - and many/few who are experts at programming (may even be python!)

I do not consider myself a "programmer" - but an "engineer who has taken to python to help solve problems" (and along the way, picked up some python)

Next week - (unless I hear otherwise) - let us examine reading data files (I have placed some examples) - using "loops" and "if then else" type constructs ...

I am serious when I say "programming is fun" - so bring your questions, doubts - "how to do X" or "how to do Y" and such ...!

If anyone is curious - I expect to get something out of this - a better understanding of some core elements in python and learn through solving problems you all can bring to the table - I may not be able to solve any/all problems on the fly - but I am sure I (and we) can by persisting (!)



Friday, May 13, 2016

How to read an xy data file (actually x, y1, y2) - create an Lineweaver Burke Plot, do analysis

This script reads data, does some calculations - creates a plot

we will go over this in class ...

https://drive.google.com/a/uah.edu/folderview?id=0B8bxiKU6FEY9cmxTblVVYlcwYlU&usp=sharing


How to read a csv file

A "csv" file is a text file -

an example csv file contains data from a "microarray" experiment ...

take a look and see if it makes sense (!) - we can go over this in class

the files are here (python script and the example test.csv file)

https://drive.google.com/a/uah.edu/folderview?id=0B8bxiKU6FEY9cmxTblVVYlcwYlU&usp=sharing

(if the link does not work, please let me know!)

Thursday, May 12, 2016

May 10, 2016 (What we did)

We met in EB 134 (classroom)

I started python - started an example - about doing simple calculations - difference between integer, floating point numbers, characters

What else?

Please remind me (!)

For Tuesday May 17, 2016

1) How to read data from a file?

What else?

I have an example from enzyme kinetics I will place here ... it solves an exam problem I had given - reading in data from a file, doing some calculations

(What I took down in class)

how to read data file

(heard from Josh Peek -
how to read a csv file ...)

(I have an example - I will try and post that example - reading and looping through a csv file)

how to build a graphic display (tic tac toe)

write a program that is like tic tac toe (this will be tough!)

Tuesday, May 10, 2016

Today, someone asked about learning to program games in python. Perhaps the following link will help:
https://pythonprogramming.net/pygame-python-3-part-1-intro/

Monday, May 9, 2016

Where can you get python? (For Windows)

Here are some good python packages (all free for download)

First important question is - 2 or 3? (python 2.X and python 3.X are different in many
ways)

I have been using "2" - but let us start with "3"

(It does not matter which distribution you have OR have installed - need
python along with some commonly used packages like Numpy and Scipy and
Matplotlib (for plots))


Anaconda (python)  (This is anaconda)

Enthought (canopy) (this is canopy)

Stand alone python (stand alone python)

(64 bit OR 32 bit - does not matter)

These packages may require you to be "administrator" on Windoze machines

(If using Apple/Mac - please look for instructions on how to install python - I am told
it is easy - and may already be on the Apple/Mac - )

Welcome to Python for Fun (PFF) (Or Python and Friends)

Programming is indeed fun!

There are many ways to learn Python

1) Download python, start using it

2) Learn from working programs - Here is a site that has several textbook problems worked out using python Textbook Project for Python

3) Read books on python (and try examples from such books)

Think Python

Python Computations in Science and Engineering

4) Upload your program so others can see what you have done (get feedback, improve!)

5) Here is a story of conversion from MatLAB to Python Matlab to Python

6) Do not want to install python anywhere - but still want to use python?  There is a solution (it could cost you some change ...) try this Data Joy for Python

7) A good book/reference for python (on a website, also downloadable) Python for total beginners (it says)