On 11 April 2013 13:25, Albert-Jan Roskam wrote:
>
>
>>> Cool. This solves a problem it had with contextlib.nested some time ago.
>>> (sorry for kinda hijacking this thread, but..)
>>> Would it be safe (both __exit__ calls are guaranteed to be made) to use
>>> code like this (if it worked, that i
>> Cool. This solves a problem it had with contextlib.nested some time ago.
>> (sorry for kinda hijacking this thread, but..)
>> Would it be safe (both __exit__ calls are guaranteed to be made) to use
>> code like this (if it worked, that is!)?
>
> Partly because it doesn't work I really can't f
On 11 April 2013 12:24, Albert-Jan Roskam wrote:
>
>
>> Subject: Re: [Tutor] Appending an extra column in a data file
>>
>> On Wed, Apr 10, 2013 at 5:49 PM, Oscar Benjamin
>> wrote:
>>>> fin = open('old.dat')
>>>> fout = ope
> Subject: Re: [Tutor] Appending an extra column in a data file
>
> On Wed, Apr 10, 2013 at 5:49 PM, Oscar Benjamin
> wrote:
>>> fin = open('old.dat')
>>> fout = open('new.dat', 'w')
>>>
>>> wit
On Wed, Apr 10, 2013 at 5:49 PM, Oscar Benjamin
wrote:
>> fin = open('old.dat')
>> fout = open('new.dat', 'w')
>>
>> with fin, fout:
>> for line in fin:
>
> This has the same problems as contextlib.nested: An error raised while
> opening 'new.dat' could prevent 'old.dat' from b
On 10 April 2013 22:17, eryksun wrote:
>
> But I think it's more readable to break up a long line like this:
>
> fin = open('old.dat')
> fout = open('new.dat', 'w')
>
> with fin, fout:
> for line in fin:
This has the same problems as contextlib.nested: An error raised while
op
On 10 April 2013 21:45, Albert-Jan Roskam wrote:
>
>
>> Subject: Re: [Tutor] Appending an extra column in a data file
>>
>
>
>> The file you attached is a space-delimited text file. If you want to
>> add a third column with the value '1.0' on every
On Wed, Apr 10, 2013 at 4:45 PM, Albert-Jan Roskam wrote:
>
>> with open('old.dat') as fin, open('new.dat', 'w') as fout:
>
> Is that Python 3.x?
It's the same syntax as an import statement such as the following:
import numpy as np, matplotlib as mpl
A downside with this is the inability to
> Subject: Re: [Tutor] Appending an extra column in a data file
>
> The file you attached is a space-delimited text file. If you want to
> add a third column with the value '1.0' on every row you can just do:
>
> with open('old.dat') as fin, open(
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
On 10 April 2013 19:48, Sayan Chatterjee wrote:
> Hi Andre,
>
> I figured it out. Need not reply of np.savetxt for storing array simply
> f.wite() is doing fine.
>
> while i < 999:
> print i
> fo.write('{0:f} {1:f} {2:f}\n'.format(pp_za[i], pv_za[i],t))
> i = i + 1
>
> Eager to know
Thanks Oscar figured it out...:)
On 11 April 2013 00:17, Oscar Benjamin wrote:
> On 10 April 2013 17:58, Sayan Chatterjee
> wrote:
> > Thank Andre for your prompt answer.
> >
> > I'll figure out the plotting issue once the dat files are made. So it's
> the
> > primary concern.
> > For an examp
Hi Andre,
I figured it out. Need not reply of np.savetxt for storing array simply
f.wite() is doing fine.
while i < 999:
print i
fo.write('{0:f} {1:f} {2:f}\n'.format(pp_za[i], pv_za[i],t))
i = i + 1
Eager to know that single file thing though!
Sayan
On 10 April 2013 23:52, Saya
On 10 April 2013 17:58, Sayan Chatterjee wrote:
> Thank Andre for your prompt answer.
>
> 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 th
Hi Andre,
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 'get it to
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
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.
the solution you have just mentioned i.e np.array([t,pp_za,pv_za]) is
giving the following error:
Traceback (most recent call last):
File "ZA_Phase_Plot.py", line 38
Hi Alan,
Sorry for the ambiguity I have created.
I have added the snippet of code just in the previous mail and also the
sample data in the text file. Have you had a look on them?
I am copy pasting it in this email:
Hi Andre,
Well,this is the concerned snippet of the code:
while *t < 1*:
Hi Sayan,
> Well,this is the concerned snippet of the code:
>
>
> while t < 1:
>
>
> pp_za = pp_init + t*K*np.sin(K*pp_init)
>
> # Periodic Boundary Condition
>
> for i in range(0,999):
>
> if pp_za[i] < 0:
> pp_za[i] = 2 - abs(pp_za[i])
> if pp_za[i] > 2:
> pp
On 10/04/13 16:44, Sayan Chatterjee wrote:
I have some data files with numpy arrays stored in it in 2 columns. I
Can you define what that means?
All files on a computer are data files in some sense.
They exist as text files or binary files. If they are text files then
the content of your arra
Hi Andre,
Well,this is the concerned snippet of the code:
while *t < 1*:
pp_za = pp_init + t*K*np.sin(K*pp_init)
# Periodic Boundary Condition
for i in range(0,999):
if pp_za[i] < 0:
pp_za[i] = 2 - abs(pp_za[i])
if pp_za[i] > 2:
pp_za[i] = pp_za[i] % 2
pv_za = +K*
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
Thank Andre for your prompt answer.
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, I want to print
a parameter value
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,
24 matches
Mail list logo