[Tutor] python magazine

2010-03-26 Thread Bala subramanian
Friends, I am sorry if this query is not appropriate to this forum. Is there any online magazine dedicated to python especially its features and How-to's that i can subscribe for. Thanks, Bala ___ Tutor maillist - Tutor@python.org To unsubscribe or ch

[Tutor] set and sets.Set

2010-04-21 Thread Bala subramanian
Friends, Someone please write me the difference between creating set with set() and a sets.Set(). >>> a=set([1,2,3]) >>> b=sets.Set([1,2,3]) >>> print a set([1, 2, 3]) >>> print b Set([1, 2, 3]) Thanks, Bala ___ Tutor maillist - Tutor@python.org To un

[Tutor] circular looping

2010-05-24 Thread Bala subramanian
Friends, I have a list. I have to do some comparison of each item in the list with each other items in the list. from numpy import zeros a=zeros((5,5)) myres=['R', 'N', 'L', 'C', 'M'] DON=['R','N','L'] ; ALL=['R','L','M','S'] for x in myres: for y in myres: if x in DON:

[Tutor] extract a submatrix

2010-07-11 Thread Bala subramanian
Friends, Excuse me if this question is not appropriate for this forum. I have a matrix of size 550,550. I want to extract only part of this matrix say first 330 elements, i dnt need the last 220 elements in the matrix. is there any function in numpy that can do this kind of extraction. I am quite n

Re: [Tutor] extract a submatrix

2010-07-12 Thread Bala subramanian
slicing as suggested by Eike. Thank you, Bala On Mon, Jul 12, 2010 at 1:17 PM, Dave Angel wrote: > > > Bala subramanian wrote: > >> Friends, >> Excuse me if this question is not appropriate for this forum. I have a >> matrix of size 550,550. I want to extract only pa

[Tutor] searching for multiple strings in line.starswith()

2010-07-19 Thread Bala subramanian
Friends, I have to extract the line from a file that does not contain a set of strings in the start of the line, i wrote the following code. for index, line in enumerate(myvar.split('\n')): if line.startswith('') not in ['#Cluster','#Centroid','#End']: line=line.split() print l

[Tutor] problem with subprocess

2010-07-30 Thread Bala subramanian
Dear Friends, I have to do a series of job in a remote machine. I put each job in a text file called 'job' as and wrote the following code that can read each line in the text file and execute the job. I login to the machine and run the script as 'python job.py'. But when i logout from the machine

Re: [Tutor] problem with subprocess

2010-07-30 Thread Bala subramanian
Thank you so much. I could see the job running with nohup after logout. Bala On Fri, Jul 30, 2010 at 3:49 PM, Hugo Arts wrote: > On Fri, Jul 30, 2010 at 2:36 PM, Bala subramanian > wrote: > > Dear Friends, > > > > I have to do a series of job in a remote machine. I

[Tutor] module for clustering

2010-10-29 Thread Bala subramanian
Friends, I have X and Y points and i want to cluster these points in 2D space, Kindly suggest if there is any module that is loaded with python to do that or any other package for the same. Thanks, Bala ___ Tutor maillist - Tutor@python.org To unsubscr

[Tutor] extracting a column from many files

2009-02-19 Thread Bala subramanian
Dear friends, I want to extract certain 6 different columns from a many files and write it to 6 separate output files. I took some help from the following link http://mail.python.org/pipermail/tutor/2004-November/033475.html to write one column from many input files to a particular output file.

Re: [Tutor] extracting a column from many files

2009-02-19 Thread Bala subramanian
8 PM, Kent Johnson wrote: > On Thu, Feb 19, 2009 at 5:41 AM, Bala subramanian > wrote: > > Dear friends, > > > > I want to extract certain 6 different columns from a many files and write > it > > to 6 separate output files. I took some help from the following link >

Re: [Tutor] extracting a column from many files

2009-02-23 Thread Bala subramanian
> > > file1: > 1a1 1b1 1c1 1d1 1e1 1f1 > 2a1 2b1 2c1 2d1 2e1 2f1 > 3a1 3b1 3c1 3d1 3e1 3f1 > > file2: > 1a2 1b2 1c2 1d2 1e2 1f2 > 2a2 2b2 2c2 2d2 2e2 2f2 > 3a2 3b2 3c2 3d2 3e2 3f2

[Tutor] overwriting input file

2009-02-25 Thread Bala subramanian
Hello all, query 1) How should i overwrite the input file I want to open 5 files one by one, do some operation on the lines and write the modified lines on the same file (overwritting). Can some please tell me how to do it. pat1=" R" pat2="U5" pat3="A3" from sys import argv files=argv[1:] for nam

[Tutor] learning new features of python

2009-02-26 Thread Bala subramanian
Dear Friends, Is there any website/tutorial that explains new features that are constantly getting embedded in python. This would be helpful for python lovers to grow with python and adopt new styles of codes. Just for an example, i read in Mark Luts "learning python" book, the various forms of ex

[Tutor] concatenating files

2009-02-27 Thread Bala subramanian
Hai, I have file1.dat,file2.dat...file 300.dat in one directory. I want to concatenate all the files in a single file (total.dat) with a string "END" separating the file contents. my total.dat should be file1.dat contents END file2.dat contents END file300.dat. now i have another 400

[Tutor] statistics with python

2009-03-20 Thread Bala subramanian
Dear python friends, someone kindly suggest me packages, modules and documentation resources (especially) to i) plot graphs using python. ii) statistical analysis using python. Thanks in advance, Bala ___ Tutor maillist - Tutor@python.org http://m

[Tutor] dynamically creating list

2009-03-23 Thread Bala subramanian
Dear Friends, I have a text output file from a program that does clustering. Now i have to parse the text output file to separate data points belonging to each cluster. I am thinking to design the algo. in the following way. i) ask the user the text output file ii) ask the user for the number of

[Tutor] swapping lines between files

2009-03-23 Thread Bala subramanian
Dear Friends, Thanks for your replies for my previous mail. I have two files as follows. file 1 file2 200 1 3.55 210 2 4.55 242 3 1.22 248 4 3.10 25651.11 Now i have to replace 1,2,3,4,5 in *file

[Tutor] returning values from function.

2009-03-23 Thread Bala subramanian
Friends, I wrote the following code to create two different list. One containing data points of all clusters and another containing list of individual cluster data points. The script is as follows. #!/usr/bin/env python from sys import argv # STEP 1: a) ACCUMULATING ALL DATA POINTS IN AND A LIST

[Tutor] text editor and debugger for python

2009-03-24 Thread Bala subramanian
Friends, I do the scripting in Linux. I use vi editor to code. It is not very convenient for me. Kindly suggest me a best free *text editor* ( i can code and debug the code simultaneously ) *for python* based on your experience. Thanks Bala ___ Tutor ma

[Tutor] printing files

2009-03-26 Thread Bala subramanian
Friends, My files are like below file1 file2 RemarkRemark --- --- I have huge number of such files. I want to concatenate all files in one huge file. I could do it with a script. But i want to omit the first l

[Tutor] plotting with python

2009-03-27 Thread Bala subramanian
Friends, I am not sure if this forum is appropriate to ask question about a particular package. After getting suggestions from some of you for python based plotting, I have just started with matplotlib. I am bit confused with the relation between matplotlib and pylab. In the matplotlib homepage, e

[Tutor] installation of scipy

2009-03-30 Thread Bala subramanian
Friends i installed scipy in fedora10 using yum. when i import stats module in it, i got the following warning. someone pls englihten me on this. >>> from scipy import stats /usr/lib/python2.5/site-packages/scipy/sparse/linalg/dsolve/linsolve.py:20: DeprecationWarning: scipy.sparse.linalg.dsolve.u

[Tutor] curve fitting

2009-07-29 Thread Bala subramanian
Friends, I wish to do some curve fitting with python by defining my own equations. Could someone please give some guidance or examples on doing the same. Thanks, Bala ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] python assignments

2008-04-17 Thread Bala subramanian
Dear friends, I covered few introductory books on python. B4 going for an advanced book, i want to take up small, small assignments and try to solve with python. Can someone please suggest me any url where i can have assignments and solutions. Thanks, Bala

[Tutor] creating a regularly placed fields in a line

2012-04-25 Thread Bala subramanian
Friends, I wrote a small piece of code (given below). The aim is to take each line in a file, split the fields, replace the first four fields and then write the new lines in a output file. The input and output are given in the attached file. The output contains fields which are irregularly placed d

[Tutor] extracting lines between patterns.

2012-05-14 Thread Bala subramanian
Friends, Could someone please give some hint on how to extract lines between two patterns in a file. I use the re module to compile my patterns but not able to figure out how i can use these patterns to extract the lines lying in between. Thanks, Bala __

Re: [Tutor] extracting lines between patterns.

2012-05-14 Thread Bala subramanian
er wrote: > On Mon, 2012-05-14 at 09:31 +0200, Bala subramanian wrote: > > Friends, > > Could someone please give some hint on how to extract lines between two > > patterns in a file. I use the re module to compile my patterns but not > able > > to figure out how i ca

Re: [Tutor] List Indexing Issue

2012-05-14 Thread Bala subramanian
Hi, I would suggest you to use the biopython package. It has a PDB parser with which you can extract any specific information like atom name, residue, chain etc as you wish. Bala On Wed, May 9, 2012 at 3:19 AM, Jerry Hill wrote: > On Tue, May 8, 2012 at 4:00 PM, Spyros Charonis > wrote: > > Hel

[Tutor] removing sq. of items.

2012-05-23 Thread Bala subramanian
Friends, While iterating through each list item and printing/writing it, why does the sq. brackets get printed/written to the file. Just a small eg.code is given below. >>>N=100 >>> myl=range(1,100+1) >>> new=[myl[i:i+15] for i in range(0, len(myl),15)] >>> for x in new: print x Thanks, Bala

Re: [Tutor] removing sq. of items.

2012-05-23 Thread Bala subramanian
Hi, I infact want write each of the item in the sliced list to a file. On Wed, May 23, 2012 at 11:59 AM, Sarma Tangirala wrote: > > > On 23 May 2012 15:21, Bala subramanian wrote: > >> Friends, >> While iterating through each list item and printing/writing it, why does

[Tutor] passing global variable as argument.

2012-07-16 Thread Bala subramanian
Friends, I want to define a function that can populate an array by taking its name (which is defined globally). I defined two empty arrays as follows and a function that can populate the array. REF_F1=np.array([]) REF_F2=np.array([]) # populating the given array def ref(ln,REF_F1): global REF

Re: [Tutor] passing global variable as argument.

2012-07-16 Thread Bala subramanian
On Mon, Jul 16, 2012 at 5:06 PM, Steven D'Aprano wrote: > Bala subramanian wrote: > >> Friends, >> I want to define a function that can populate an array by taking its name >> (which is defined globally). I defined two empty arrays as follows and a >> function tha

[Tutor] suggestion for an editor

2012-07-19 Thread Bala subramanian
Friends, At present i write programs using vi editor. I am interested to change to something else. My specific need is that i want to select a portion/small segment of my program (for eg. a nested loop) and then monitor processing time it takes for that portion while i run the program. By this i ho

[Tutor] checking input parameters

2012-08-31 Thread Bala subramanian
Friends, I use the following way to check for the input parameters. I would like to know if there is a any better way to show or describe the script usage. So when the user just runs it without any input params., the program shd not execute but just shows the documentation. from sys import argv if

[Tutor] index of elements in numpy array

2012-09-13 Thread Bala subramanian
Friends, I have a 2D matrix (a numpy array) and i am looping over each row in the matrix. I would like to know how i can find the index of each element in a while looping a row. Is there any function in numpy. Thanks -- C. Balasubramanian ___ Tutor mai

Re: [Tutor] index of elements in numpy array

2012-09-14 Thread Bala subramanian
d1.index(x). So i would like to know how can achieve the same with numpy array. Thanks once again, Bala On Fri, Sep 14, 2012 at 12:39 AM, Dave Angel wrote: > On 09/13/2012 04:16 PM, Bala subramanian wrote: >> Friends, >> I have a 2D matrix (a numpy array) and i am looping over eac

[Tutor] combining c and python

2012-09-17 Thread Bala subramanian
Friends, I code in python and so far able to write simple scripts for my needs. Now i want to try the combination of c and python. 1) could someone please suggest me some good documentation on how python and C can be combined. Some tutorials with simple examples. 2) If i know that a specific part

[Tutor] 1d to 2d array creation

2012-10-01 Thread Bala subramanian
Friends, I have an 1d array like a=[1, 1, 2, 2, 2, 3, 3, 1, 1, 1], i have to convert it to 2d array for plotting as follows. The 2d array is filled by a[colum index] to obtain the new array shown below. [ [ 1., 1., 0., 0., 0., 0., 0., 1., 1., 1.], [ 0., 0., 2., 2., 2., 0., 0., 0.

Re: [Tutor] serial to parallel

2012-11-05 Thread Bala subramanian
2 at 11:46 AM, Bala subramanian wrote: > Friends, > I use a python package to analyse molecular trajectories. For those > not familiar, I have described the the problem below. > I have two trajectories A,B. Each trajectory has a collection of > frames. A frame is a numpy array.