Re: [Tutor] Appending an extra column in a data file

2013-04-10 Thread Andre' Walker-Loud
Hi Sayan, This question would be better suited to the matplotlib list. Also, a more precise description of your existing data, and what you hope it would look like would make it easier to help answer your question. Eg., from your description, it is not clear if your existing data is in a

Re: [Tutor] Appending an extra column in a data file

2013-04-10 Thread Andre' Walker-Loud
Hi Sayan, Thank Andre for your prompt answer. No problem. I'll figure out the plotting issue once the dat files are made. So it's the primary concern. For an example I am attaching a dat file herewith. The two columns here are 2 numpy arrays.I want to add a third column, to be precise,

Re: [Tutor] Appending an extra column in a data file

2013-04-10 Thread Andre' Walker-Loud
-Z axis). I hope your first example might help.Though,I think,I need some tweaking to fit to my needs. Regards, Sayan On 10 April 2013 22:38, Andre' Walker-Loud walksl...@gmail.com wrote: Hi Sayan, Thank Andre for your prompt answer. No problem. I'll figure out the plotting

Re: [Tutor] Appending an extra column in a data file

2013-04-10 Thread Andre' Walker-Loud
Hi Sayan, Yup it's exactly what I want! I want many data files,not one...to make an animation out of it. For a data file t is constant. You should not need many data files to make an animation. If you write your loops correctly, you can take a single data file with all the data. If you

Re: [Tutor] Appending an extra column in a data file

2013-04-10 Thread Andre' Walker-Loud
Hi Sayan, Is it that? We can have different plots and hence animation from a single data file.Very good!...if you have some time in your disposal, it will be kind of you to illumine in this matter...may be some useful link will do. I have written this small code from scratch,there's no

Re: [Tutor] release a script with non-standard dependencies

2012-12-19 Thread Andre' Walker-Loud
Hi Rail, I'm attempting to write a script with command-line arguments. Based on some reading I have done online and some advice from this mailing list I'm going to use docopt and schema modules. The problem I'm facing is that I'd like to be able to give this script to anyone who needs it

Re: [Tutor] data analysis with python

2012-11-13 Thread Andre' Walker-Loud
Hi David, I'm trying to use python for analysing data from building energy simulations and was wondering whether there is way to do this without using anything sql like. The simulations are typically run for a full year, every hour, i.e. there are 8760 rows and about 100+ variables

[Tutor] good coding habits/practices

2012-10-18 Thread Andre' Walker-Loud
Hi All, I have a general question. I have never taken a formal programming course. I have learned everything I know from office mates (earlier on) and now mostly Google, as I need it. Most everything I write is only for my own consumption. I write scripts/programs to do science research,

Re: [Tutor] html checker

2012-10-01 Thread Andre' Walker-Loud
Dear Matthew, I don't need to hear how bad my programs are...either you are gonna help or your not...if you have questions about what i have wrote or why i wrote something someway ask...dont just jump to conclusions I forgot to include that i had to write a stack function in a

Re: [Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Andre' Walker-Loud
Hi Santosh, On Jul 17, 2012, at 10:09 PM, Santosh Kumar wrote: Here is my script: name = raw_input(What's your name? ) if name == Santosh: print Hey!! I have the same name. elif name == John Cleese or Michael Palin: print I have no preference about your name. Really!! else:

Re: [Tutor] Why isn't my simple if elif script not working?

2012-07-17 Thread Andre' Walker-Loud
On Jul 17, 2012, at 10:29 PM, Alexandre Zani wrote: On Tue, Jul 17, 2012 at 10:21 PM, Andre' Walker-Loud walksl...@gmail.com wrote: Hi Santosh, On Jul 17, 2012, at 10:09 PM, Santosh Kumar wrote: Here is my script: name = raw_input(What's your name? ) if name == Santosh

Re: [Tutor] summary stats grouped by month year

2012-05-08 Thread Andre' Walker-Loud
Hello anonymous questioner, first comment - you may want to look into hdf5 data structures http://www.hdfgroup.org/HDF5/ and the python tools to play with them pytables - http://www.pytables.org/moin h5py - http://code.google.com/p/h5py/ I have personally used pytables more - but not for any

Re: [Tutor] summary stats grouped by month year

2012-05-08 Thread Andre' Walker-Loud
, 2012 at 4:41 PM, Andre' Walker-Loud walksl...@gmail.com wrote: Hello anonymous questioner, first comment - you may want to look into hdf5 data structures http://www.hdfgroup.org/HDF5/ and the python tools to play with them pytables - http://www.pytables.org/moin h5py - http

Re: [Tutor] How to exit this loop in the interpreter

2012-05-03 Thread Andre' Walker-Loud
Hi Greg, I'm new to python, is schooling a python-developer thing? Whether I ask for help at forums, IRC or here, someone schools me. Should I stick with Java? No, the python mailing list is for the most part, very friendly and helpful (in my experience). Mark's message that you not hijack

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-17 Thread Andre' Walker-Loud
import numpy as np Vhel_fdiff3 = np.array([abs(Vmatch3_1 - Vmatch3_2), abs(Vmatch3_1 - Vmatch3_3), abs(Vmatch3_3 - Vmatch3_2)]) your_answer = Vhel_fdiff3.max(axis=0) or import numpy as np a = np.array([Vmatch3_1-Vmatch3_2, Vmatch3_1-Vmatch3_3, Vmatch3_3- Vmatch3_2]) print

Re: [Tutor] finding a maximum between the absolute difference of several columns

2012-02-16 Thread Andre' Walker-Loud
Hi Elaina, Vhel_fdiff3=[] for i in xrange(len(Vmatch3_1)): Vhel_fdiff3.append(max([abs(Vmatch3_1[i] - Vmatch3_2[i]),abs(Vmatch3_1[i] - Vmatch3_3[i]),abs(Vmatch3_3[i] - Vmatch3_2[i])])) #print Vhel_fdiff3 #appending writes a list, but numpy which makes the with_ work needs an

Re: [Tutor] Request for advice on Python code

2012-02-13 Thread Andre' Walker-Loud
Hi Elaina, just reading your question (and responses). There is an issue with what you wrote in the email, which may help. for row in dat: gcoords=ICRSCoordinates(dat['ra-drad'],dat['dec-drad'],radians=True).convert(GalacticCoordinates) This line is identical to the one that broke

Re: [Tutor] Lists/raw_input

2012-02-06 Thread Andre' Walker-Loud
Hi Michael, I bet there is a better way (which I would like to see), but here is what I have come up with for my own uses. ints = [] u_in = False while u_in == False: try: u_input = raw_input('please enter 5 integers, space separated\n ') for n in

Re: [Tutor] Why do you have to close files?

2012-01-26 Thread Andre' Walker-Loud
Exercise 17, extra credit 6 Learn python the hard way: Find out why you had to do output.close() in the code. Code: output.close() input.close() I don't get it. If you don't close input and output it works exactly the same as if you would close them, so why do you have to do

Re: [Tutor] Pythonic way of concatenation of elements in an array

2012-01-26 Thread Andre' Walker-Loud
Hi Steven, (5) When assembling strings from substrings, never use repeated concatenation using + as that can be EXTREMELY slow. Use str.join to build the string in one assignment, instead of multiple assignments. Your code shown above is *very* inefficient and will be PAINFULLY slow if m

Re: [Tutor] databases

2011-09-10 Thread Andre' Walker-Loud
What type of databases? sql server, mysql, sqllite? Hi James, well this already helps. I don't even know. Do I have to know ahead of time? Or is there a general database package that can open a databases without knowing there format? Thanks, Andre

Re: [Tutor] databases

2011-09-10 Thread Andre' Walker-Loud
package that can open a databases without knowing there format? The Python DB API is pretty good at covering all the common databases but sadly everyone has some slight variances so you do need to know which product you will be using. As an example the SQLite package that comes in the

Re: [Tutor] databases

2011-09-10 Thread Andre' Walker-Loud
You might look at http://www.sqlalchemy.org/, since it works with most databases. However if you are new on databases, I think you should start learning databases basics, choose a database management system (DBMS) that fit your needs and learn as much as you can about that specific DBMS.

Re: [Tutor] reclassify values in an array

2011-09-02 Thread Andre' Walker-Loud
thank you for all of the resonses, I have attempted all of the suggestions. It is a numpy array so I can try another list if you would prefer but I thought I would show the error anyway. the error I am receiving is ValueError: The truth value of an array with more than one element is

Re: [Tutor] reclassify values in an array

2011-08-31 Thread Andre' Walker-Loud
Hi anonymous questioner, Like Alan, I suspect you are using numpy as import numpy as N there is probably a numpy email list where this would be more appropriate (personally I don't object, but I don't want to speak for all the subscribers). the 2nd attempt is closer to the right answer. To

Re: [Tutor] select particular directories and files

2011-08-29 Thread Andre' Walker-Loud
Dear Anonymous Questioner, I am not sure how the Windows environment works, but in linux, I would replace for ncfile in glob.glob('.nc'): with for ncfile in glob.glob('*.nc'): ie, add the wild card '*' character to grab all files which end in '.nc' Andre On Aug 29,

Re: [Tutor] select particular directories and files

2011-08-29 Thread Andre' Walker-Loud
and files! Could it be because I am trying to select folders within other folders to then get a file from each of those folders? On Tue, Aug 30, 2011 at 1:30 PM, Andre' Walker-Loud walksl...@gmail.com wrote: Dear Anonymous Questioner, I am not sure how the Windows environment works

Re: [Tutor] select particular directories and files

2011-08-29 Thread Andre' Walker-Loud
at 1:40 PM, Andre' Walker-Loud walksl...@gmail.com wrote: hello, yes, I would also try adding a wild card in the dir search for dir in glob.glob(MainFolder + '01\*'): to check if this is helps, in an interpreter (rather than script) try dirs = glob.glob(MainFolder + '\01\*'): print

Re: [Tutor] select particular directories and files

2011-08-29 Thread Andre' Walker-Loud
Hello anonymous questioner, ok, thanks for your help Andre your welcome. hope you continue enjoying python. Andre On Tue, Aug 30, 2011 at 2:37 PM, Andre' Walker-Loud walksl...@gmail.com wrote: to have multiple dirs is simple, for dir in glob.glob(MainFolder + '*/01/') + glob.glob

Re: [Tutor] numpy.mean across multiple netcdf files

2011-08-11 Thread Andre' Walker-Loud
Hello Anonymous Questioner, First - you will probably be told this isn't the correct email list for this question - this is a general python tutorial list, while your question is numpy specific, so if this doesn't help, you should probably look to another email list. There are a couple

Re: [Tutor] [OT] Re: Floating Point Craziness

2011-06-13 Thread Andre' Walker-Loud
On Jun 13, 2011, at 1:44 PM, Emile van Sebille em...@fenx.com wrote: On 6/12/2011 1:55 PM Andre' Walker-Loud said... Hi Alan, * Or you just get used to the fact that some numbers are not exact in floating point. This got me thinking. How many decimal places do you need to accurately

Re: [Tutor] [OT] Re: Floating Point Craziness

2011-06-12 Thread Andre' Walker-Loud
Hi Alan, * Or you just get used to the fact that some numbers are not exact in floating point. This got me thinking. How many decimal places do you need to accurately, say, aim a laser somewhere in a 180 degree arc accurately enough to hit a dime on the surface of the moon? Here is a

Re: [Tutor] Making a script part of the terminal

2011-05-20 Thread Andre' Walker-Loud
Hi Michael, You have to do three (four) things. 1 - make a directory where you want your executables to live (after you have created them) on my machine, I copy everything to /usr/local/walkloud/bin/ which requires sudo, but you can put them anywhere in your $PATH 2 - in your .tcshrc or

Re: [Tutor] numpy import failure

2011-02-28 Thread Andre' Walker-Loud
Andre Thanks again for your responses. I am using MS Windows 7, and it turns out there was a problem with build and re-installing EPD fixed it. I appreciate the help, I am so new at this, I don't know if things aren't working because it is me, or because something else is wrong (I feel

Re: [Tutor] numpy import failure

2011-02-27 Thread Andre' Walker-Loud
Hi Ezra, Are you using Mac OSX or LINUX or ... If you have a preexisting python installation, it may be that when you launch python, it loads the older version, and not the new EPD version. When you launch python, what do you see? For example, on my Mac OSX, launched from Terminal, I get %

[Tutor] specifying precision with scientific notation

2010-10-05 Thread Andre' Walker-Loud
Hi All, I want to print scientific numbers with a specified number of decimal places. However, I want the number printed to be dynamically determined by the data. Example: a = 0.00762921383941 ea = 0.000830132912068 a / ea 9.190352205653852 By default, I will print the uncertainty (ea)

Re: [Tutor] specifying precision with scientific notation

2010-10-05 Thread Andre' Walker-Loud
On Oct 5, 2010, at 3:43 PM, Alan Gauld wrote: Andre' Walker-Loud walksl...@gmail.com wrote a = 0.00762921383941 ea = 0.000830132912068 a / ea 9.190352205653852 By default, I will print the uncertainty (ea) with two significant digits. In this example, the central value is about 10 times

Re: [Tutor] specifying precision with scientific notation

2010-10-05 Thread Andre' Walker-Loud
. Thanks, Andre On Oct 5, 2010, at 6:39 PM, Wayne Werner wrote: On Tue, Oct 5, 2010 at 7:51 PM, Andre' Walker-Loud walksl...@gmail.com wrote: Hi Alan, The point I can not get to work is fmt = %.%de + %.1e % n else: when I try this, I get (python 2.6.5, OS X 10.6) n = 3; fmt

[Tutor] optional sys.argv parsing

2009-10-29 Thread Andre Walker-Loud
Hi All, I have a simple question. I am writing a little program that will make some plots of data files. I want to have optional args to pass, for example to specify the plot ranges. I have never written a script/ code that takes optional args (but I have used plenty) - so I am feeling

Re: [Tutor] optional sys.argv parsing

2009-10-29 Thread Andre Walker-Loud
Hi Sander, On Thu, 2009-10-29 at 17:30 -0400, Andre Walker-Loud wrote: I have a simple question. I am writing a little program that will make some plots of data files. I want to have optional args to pass, for example to specify the plot ranges. I have never written a script/ code

[Tutor] creating interactive program with python

2009-05-28 Thread Andre Walker-Loud
Hi All, I am thinking of creating a data analysis suite with python, and I want it to be interactive - ie the program asks the user (me) for input, like which data file to use, how many parameters to minimize, etc. There are a few features I want it to have, like graphing, both the

[Tutor] python precision output?

2007-12-06 Thread Andre Walker-Loud
Hi there, I am using python to do some scripting. In particular, I am using it to run some jobs which require precision inputs. I do this by having python write an input file, which I then feed to some other program. The problem I am having is getting python to write number into this

Re: [Tutor] python precision output?

2007-12-06 Thread Andre Walker-Loud
if you want accuracy and are willing to sacrifice the total range of numbers that Python's IEEE754 double-precision floats give you, then use the decimal.Decimal class instead -- better precision, smaller range. however, if you wish to stick with floats, use the string format operator and

[Tutor] using python to execute from Dir A in Dir B

2007-10-04 Thread Andre Walker-Loud
Hi All, lets say I am in Dir A (out of my control because I have submitted a job to a queuing system) and I have a python script which is running in this directory - the one I submitted to the queue what I need to do is have my python script run another executable, but it must do it from

Re: [Tutor] using python to execute from Dir A in Dir B

2007-10-04 Thread Andre Walker-Loud
. Cheers, Andre On Oct 4, 2007, at 5:13 PM, Alan Gauld wrote: Andre Walker-Loud [EMAIL PROTECTED] wrote If I were using CSH, I could do all this very simply by having these lines in my script ### .csh file cd /scratch my_exe.csh The best answer is to use subprocess as Kent