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 n

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 y

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

2013-04-10 Thread Andre' Walker-Loud
s > run) in the 3 rd column. 't' is float and constant for each looping. If you > know what a phase plot is(doesn't matter if you don't), I want to see the > phase plot evolving with time. Thus the need of a time axis and hence plot > with V(velocity-Yaxis), X (

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 preci

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 table,

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 i

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+ variable

[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, an

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 "pyt

Re: [Tutor] OT: Netiquette

2012-09-26 Thread Andre' Walker-Loud
To the python tutor list, One comment I would like to make in light of the current email exchanges is that generally speaking, one of the things I have greatly appreciated about the python user community is how friendly and helpful they have been. This particularly strikes me when I see time a

Re: [Tutor] np array.any() question

2012-09-21 Thread Andre' Walker-Loud
> To summarize, > with a numpy array called a, the OP is getting an error doing: > > (3 < a < 5).any() > >> ... > > I think not. The last expression you give will even return true if one > of the values is > 3 and a DIFFERENT value is < 5. And i suspect the > OP only wants a TRUE if at least

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

2012-07-17 Thread Andre&#x27; 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 > wrote: >> Hi Santosh, >> >> On Jul 17, 2012, at 10:09 PM, Santosh Kumar wrote: >> >>> Here is my script: >>

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

2012-07-17 Thread Andre&#x27; 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. Re

Re: [Tutor] summary stats grouped by month year

2012-05-08 Thread Andre&#x27; Walker-Loud
h a string where a float should be etc') Have fun! Andre On May 8, 2012, at 5:48 PM, questions anon wrote: > On Tue, May 8, 2012 at 4:41 PM, Andre' Walker-Loud > wrote: > Hello anonymous questioner, > > first comment - you may want to look into hdf5 data

Re: [Tutor] summary stats grouped by month year

2012-05-07 Thread Andre&#x27; 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 g

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

2012-05-03 Thread Andre&#x27; 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 hijac

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

2012-02-17 Thread Andre&#x27; 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&#x27; 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 a

Re: [Tutor] Request for advice on Python code

2012-02-13 Thread Andre&#x27; 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&#x27; 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] Pythonic way of concatenation of elements in an array

2012-01-26 Thread Andre&#x27; 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 i

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

2012-01-26 Thread Andre&#x27; 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

Re: [Tutor] databases

2011-09-10 Thread Andre&#x27; 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

Re: [Tutor] databases

2011-09-10 Thread Andre&#x27; 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

Re: [Tutor] databases

2011-09-10 Thread Andre&#x27; 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

[Tutor] databases

2011-09-10 Thread Andre&#x27; Walker-Loud
Hi All, I am completely new to databases as well as using python to access/create databases. I started googling about it and found so much info, I wasn't sure where to begin to answer my first question. So I thought I would query this group by asking a question I am sure has been asked before

Re: [Tutor] reclassify values in an array

2011-09-02 Thread Andre&#x27; 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&#x27; 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 he

Re: [Tutor] select particular directories and files

2011-08-29 Thread Andre&#x27; 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 > wrote: > to have multiple dirs is simple, > >> for dir in glob.glob(MainFolder + '

Re: [Tutor] select particular directories and files

2011-08-29 Thread Andre&#x27; Walker-Loud
x27;*/03/'): > but I received: > TypeError: glob() takes exactly 1 argument (3 given) > > > thanks > > > On Tue, Aug 30, 2011 at 1:40 PM, Andre' Walker-Loud > wrote: > hello, > > yes, I would also try adding a wild card in the dir search >

Re: [Tutor] select particular directories and files

2011-08-29 Thread Andre&#x27; Walker-Loud
error by me. but that still doesn't help me select the > dir 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 > wrote: >

Re: [Tutor] select particular directories and files

2011-08-29 Thread Andre&#x27; 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 2

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

2011-08-10 Thread Andre&#x27; 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 general

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

2011-06-13 Thread Andre&#x27; Walker-Loud
On Jun 13, 2011, at 1:44 PM, Emile van Sebille 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. >>> >>>

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

2011-06-12 Thread Andre&#x27; 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 i

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

2011-05-20 Thread Andre&#x27; 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 .csh

Re: [Tutor] numpy import failure

2011-02-28 Thread Andre&#x27; Walker-Loud
ython.org wrote: >> Date: Sun, 27 Feb 2011 18:58:46 -0800 >> From: Andre' Walker-Loud >> To: Ezra Kahn >> Cc:tutor@python.org >> Subject: Re: [Tutor] numpy import failure >> Message-ID:<75198436-f849-4994-8d48-1726c2ee7...@gmail.com> >> Content-T

Re: [Tutor] numpy import failure

2011-02-27 Thread Andre&#x27; 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 %

Re: [Tutor] specifying precision with scientific notation

2010-10-05 Thread Andre&#x27; Walker-Loud
ientific notation to into this format - I guess by forcing the power of the exponent. 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 > wrote: > Hi Alan, > > The point I can not get to work is > >

Re: [Tutor] specifying precision with scientific notation

2010-10-05 Thread Andre&#x27; Walker-Loud
king for - if I could get it to work. Thanks, Andre On Oct 5, 2010, at 3:43 PM, Alan Gauld wrote: > "Andre' Walker-Loud" wrote > >>> a = 0.00762921383941 >>> ea = 0.000830132912068 >>> a / ea >> 9.190352205653852 >> >> By de

[Tutor] specifying precision with scientific notation

2010-10-05 Thread Andre&#x27; 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] 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 that

[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] creating interactive program with python

2009-05-28 Thread Andre Walker-Loud
Hi Alan, 1) I am trying to trying to figure out how I would set up an interactive python script, however, I am having trouble googling this, since a search for "interactive python" just returns instructions on how to type "python" in a terminal to get an "interactive" session Che

[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 initi

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

[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 inpu

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

2007-10-04 Thread Andre Walker-Loud
ss.Popen()' I thank you in advance. 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 >>

[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 a