Re: [Tutor] set current working dir

2015-03-16 Thread Ben Finney
Rajbir Singh writes: > i need to know how i can set current working dir in an executing > phython using os module Why must it be using the ‘os’ module? It's generally a bad idea to assume you need a specific module to provide the solution; better to describe what you need to do, and not assume w

Re: [Tutor] passing dictionaries through a file

2015-03-16 Thread Ben Finney
"Doug Basberg" writes: > I would like to pass the contents of a dictionary from one program to > another through a file. The term for this in programming is “serialisation”, in the sense that a specific series of bits will represent the Python value, and you want to convert to and from that seri

Re: [Tutor] set current working dir

2015-03-16 Thread Oscar Benjamin
On 16 March 2015 at 18:29, Rajbir Singh wrote: > > i need to know how i can set current working dir in an executing phython > using os module If you explain why you want to do that then it may be that there is a better way to achieve what you want. It's usually not necessary to change the current

Re: [Tutor] passing dictionaries through a file

2015-03-16 Thread Oscar Benjamin
On 16 March 2015 at 20:39, Doug Basberg wrote: > > I would like to pass the contents of a dictionary from one program to > another through a file. So, what is the elegant way to pass a dictionary by > file? My early learning about Python seems to indicate that only ascii is > easily passed in fi

Re: [Tutor] passing dictionaries through a file

2015-03-16 Thread Alan Gauld
On 16/03/15 20:39, Doug Basberg wrote: I would like to pass the contents of a dictionary from one program to another through a file. So, what is the elegant way to pass a dictionary by file? The elegant way may be not to use a file. A Python dictionary usually converts easily to JSON format wh

Re: [Tutor] set current working dir

2015-03-16 Thread Alan Gauld
On 16/03/15 18:29, Rajbir Singh wrote: i need to know how i can set current working dir in an executing phython using os module try os.chdir('/some/path/here') -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo

[Tutor] set current working dir

2015-03-16 Thread Rajbir Singh
i need to know how i can set current working dir in an executing phython using os module ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] passing dictionaries through a file

2015-03-16 Thread Doug Basberg
I would like to pass the contents of a dictionary from one program to another through a file. So, what is the elegant way to pass a dictionary by file? My early learning about Python seems to indicate that only ascii is easily passed in files. I am using Python 2.7.4 now. Should I be learning o

Re: [Tutor] Fitting data to error function

2015-03-16 Thread Oscar Benjamin
On 16 March 2015 at 22:22, Colin Ross wrote: > > Yes, thank you, they were suppose to both be E_out. Hi Colin, I'm not sure if that means that your problem is fixed or not but I thought I would point something out that helps in fixing this kind of problem. You're using ipython which has an exce

Re: [Tutor] Fitting data to error function

2015-03-16 Thread Danny Yoo
On Mon, Mar 16, 2015 at 3:22 PM, Colin Ross wrote: > Yes, thank you, they were suppose to both be E_out. > > And to answer your last question, I do not. Can you please explain? The article: http://en.wikipedia.org/wiki/Unit_testing may help. As a brief intro: we treat each interesting fun

Re: [Tutor] Fitting data to error function

2015-03-16 Thread Colin Ross
Yes, thank you, they were suppose to both be E_out. And to answer your last question, I do not. Can you please explain? On Mon, Mar 16, 2015 at 7:19 PM, Danny Yoo wrote: > On Mon, Mar 16, 2015 at 2:55 PM, Colin Ross > wrote: > > What I am trying to do is calculate the non-colinear autocorrel

Re: [Tutor] Fitting data to error function

2015-03-16 Thread Danny Yoo
On Mon, Mar 16, 2015 at 2:55 PM, Colin Ross wrote: > What I am trying to do is calculate the non-colinear autocorrelation: > > G(t_d) = \int_{-\infty}^{+\infty} |E(t)|^2 * |E(t - t_d)|^2 dt > > So I need to loop through an array of t_d values (len = 376) and calculate > G(t_d) for as many t values

Re: [Tutor] Fitting data to error function

2015-03-16 Thread Colin Ross
What I am trying to do is calculate the non-colinear autocorrelation: G(t_d) = \int_{-\infty}^{+\infty} |E(t)|^2 * |E(t - t_d)|^2 dt So I need to loop through an array of t_d values (len = 376) and calculate G(t_d) for as many t values as possible to eliminate sampling issues. Colin On Mon, Mar

Re: [Tutor] Fitting data to error function

2015-03-16 Thread Colin Ross
HI Danny, Here is a simplified version: import numpy as np import pylab from pylab import * import matplotlib.pyplot as plt import scipy from scipy.integrate import quad from scipy.fftpack import fft, ifft, fftfreq #