Hi,
I have this script
import numpy as np
import random as rnd
from math import *
import matplotlib.pyplot as plt
folder = '../NOBACKUP/heavi3/'
pre = '10'
dat = '.dat'
snshot = '4189'
d = 0.02
d2 = d/2.0
tot = 156
half = 78
points = 3375000
BxN = np.zeros((tot,tot,tot))
ByN =
think the problem is that Fortran write 4bytes at the beginning and at
the end of each file.
I found a way to remove the first 4 bytes but not the last.
Do you have any suggestion?
Thanks
On Mon, Jul 13, 2015 at 2:08 PM, Gabriele Brambilla
gb.gabrielebrambi...@gmail.com wrote:
The second
The second method seem to work.
But how can I know which dtype in Python corresponds to REAL in fortran?
Thanks
On Mon, Jul 13, 2015 at 11:29 AM, Laura Creighton l...@openend.se wrote:
In a message of Mon, 13 Jul 2015 11:14:36 -0400, Gabriele Brambilla writes:
Hi,
I have problems reading
Hi,
I have problems reading unformatted fortran output (binary) with python.
I have a code in fortran where I write data on a file inside a cycle:
write(11) x,y,z,BA01(i,j,k,1),BA01(i,j,k,2),1
BB01(i,j,k,1),BB01(i,j,k,2),2 BE01(i,j,k,1),3
EC01(i,j,k,1),EC01(i,j,k,2),4
I solved the issue.
If I need more help I'll send another email.
thanks
GB
On Mon, Jul 13, 2015 at 3:32 PM, Gabriele Brambilla
gb.gabrielebrambi...@gmail.com wrote:
Hi,
sorry for the confusion I understood that the Real(8) I'm using correspond
to dtype float64 in Python.
With the second
oh yes! I had a problem inside the file name! (I had a lot of file to open
and I changed the one I was looking at!the one I was trying to open has a
wrong filename...)
Sorry for the misunderstanding.
Gabriele
2014-06-06 3:05 GMT-04:00 Peter Otten __pete...@web.de:
Gabriele Brambilla wrote
Hi,
I'm trying to use glob to read a file of which I don't know the complete
name (but only some parts).
fiLUMOname = 'Lsum_' + period + '_' + parts[2] + '_' + parts[3] + '_' +
parts[4] + '_*.dat'
aaa = glob.glob(fiLUMOname)
print(aaa)
fiLUMO = open(aaa[0], 'r')
where period, and the
-- Forwarded message --
From: Gabriele Brambilla gb.gabrielebrambi...@gmail.com
Date: 2014-06-05 22:15 GMT-04:00
Subject: Re: [Tutor] glob and file names
To: Peter Romfeld peter.romfeld...@gmail.com
thanks,
it works.
Gabriele
2014-06-05 22:10 GMT-04:00 Peter Romfeld
No,
I wanted to say that Peter method works!
Thanks anyway and sorry for the html.
Gabriele
sent from Samsung Mobile
Il giorno 05/giu/2014 23:14, Dave Angel da...@davea.name ha scritto:
Gabriele Brambilla gb.gabrielebrambi...@gmail.com Wrote in message:
(missing because you posted in html
Hi,
I'm trying to convert a string to a float. It seems a basic thing but I
don't know why I'm getting this erroris
Traceback (most recent call last):
File phresREADER.py, line 27, in module
tra = float(stri)
ValueError: could not convert string to float:
My file has this line
solved, sorry for the disturb
http://stackoverflow.com/questions/23344345/strings-not-converting-to-float-as-expected/23344830#23344830
bye
Gabriele
2014-04-28 11:13 GMT-04:00 Gabriele Brambilla
gb.gabrielebrambi...@gmail.com:
Hi,
I'm trying to convert a string to a float. It seems
the new simulation with it
thanks
Gabriele
2014-04-12 6:21 GMT-04:00 Peter Otten __pete...@web.de:
Gabriele Brambilla wrote:
Ok guys, when I wrote that email I was excited for the apparent speed
increasing (it was jumping the bottleneck for loop for the reason peter
otten outlined).
Now
Ok, i just run Peter's code and it seems really faster...I hope to don't
mistake this time!
Thanks
Gabriele
sent from Samsung Mobile
Il giorno 12/apr/2014 08:22, Gabriele Brambilla
gb.gabrielebrambi...@gmail.com ha scritto:
Ok guys,
I'm not expert about profile but help me to look
))
zsel = x[sel]
result = my_inter(np.log10(zsel))
kap[sel] = 10**result
2014-04-12 9:34 GMT-04:00 Gabriele Brambilla gb.gabrielebrambi...@gmail.com
:
Ok, i just run Peter's code and it seems really faster...I hope to don't
mistake this time!
Thanks
Gabriele
sent
I think I have Cython already installed with Anaconda.
How it works?
Thanks
Gabriele
2014-04-11 8:16 GMT-04:00 Albert-Jan Roskam fo...@yahoo.com:
From: Gabriele Brambilla gb.gabrielebrambi...@gmail.com
To: Danny Yoo d...@hashcollision.org
Cc: python
Hi Danny,
I'm quiet impressed.
the program takes near 30 minutes instead of more than 8 hours!
this is the profile:
Fri Apr 11 09:14:04 2014restats
19532732 function calls in 2105.024 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall
] += www
count = count + 1
when I exit here the MYMAP matrix has all the cells = 0.
Now I will try to fiugre it out why.
Thanks
Gabriele
2014-04-11 9:20 GMT-04:00 Gabriele Brambilla gb.gabrielebrambi...@gmail.com
:
Hi Danny,
I'm quiet impressed.
the program takes near 30
ok, it seems that the code don't enter in this for loop
for gammar, MYMAP in zip(gmlis, MYMAPS):
I don't understand why.
Thanks
Gabriele
2014-04-11 9:56 GMT-04:00 Gabriele Brambilla gb.gabrielebrambi...@gmail.com
:
Hi, I'm sorry but there is a big problem.
the code is producing empty
dko += 1
count = count + 1
Now I will tell you how much it takes.
Thanks
Gabriele
2014-04-11 10:05 GMT-04:00 Gabriele Brambilla
gb.gabrielebrambi...@gmail.com:
ok, it seems that the code don't enter in this for loop
for gammar, MYMAP in zip(gmlis, MYMAPS
0.0004.8300.000 polyint.py:30(__init__)
thanks
Gabriele
2014-04-11 10:18 GMT-04:00 Gabriele Brambilla
gb.gabrielebrambi...@gmail.com:
ok
modifying the for in this way (zipping an array of matrix drive it crazy)
it works
dko=0
for gammar in gmils
Yes,
but I want to make a C extension to run faster a function from
scipy.interpolate (interp1d)
It woulldn't change anything?
thanks
Gabriele
2014-04-11 14:47 GMT-04:00 Alan Gauld alan.ga...@btinternet.com:
On 11/04/14 09:59, Peter Otten wrote:
Gabriele Brambilla wrote:
Anyway I would
I forget the reply all
-- Forwarded message --
From: Gabriele Brambilla gb.gabrielebrambi...@gmail.com
Date: 2014-04-11 16:03 GMT-04:00
Subject: Re: [Tutor] improving speed using and recalling C functions
To: Peter Otten __pete...@web.de
you are right.
probably
can I do to speed it up?
Thanks
Gabriele
sent from Samsung Mobile
Il giorno 11/apr/2014 17:00, Danny Yoo d...@hashcollision.org ha
scritto:
On Fri, Apr 11, 2014 at 1:01 PM, Gabriele Brambilla
gb.gabrielebrambi...@gmail.com wrote:
Yes,
but I want to make a C extension to run faster
Hi,
I have a program that is reading near 60 elements from a file.
For each element it performs 200 times a particular mathematical operation
(a numerical interpolation of a function).
Now these process takes near 8 hours.
Creating a C function and calling it from the code could improve the
Hi,
2014-04-10 13:05 GMT-04:00 Martin A. Brown mar...@linux-ip.net:
Hi there Gabriele,
: I have a program that is reading near 60 elements from a
: file. For each element it performs 200 times a particular
: mathematical operation (a numerical interpolation of a function).
: Now
I'm trying to profile it adding this code:
import cProfile
import re
import pstats
cProfile.run('re.compile(foo|bar)', 'restats')
p = pstats.Stats('restats')
p.strip_dirs().sort_stats('name')
p.sort_stats('time').print_stats(10)
but where I have to add this in my code?
because I obtain
Thu
Hi,
I get this result:
Thu Apr 10 17:35:53 2014restats
21071736 function calls in 199.883 seconds
Ordered by: internal time
List reduced from 188 to 10 due to restriction 10
ncalls tottime percall cumtime percall filename:lineno(function)
1 149.479 149.479
but main is the program that contains everything.
I used the profile in this way:
import cProfile
import pstats
def mymain():
#all the code
#end of main indentation
cProfile.run('mymain()', 'restats', 'time')
p = pstats.Stats('restats')
p.strip_dirs().sort_stats('name')
sure.
def mymain():
def LEstep(n):
Emin=10**6
Emax=5*(10**10)
Lemin=log10(Emin)
Lemax=log10(Emax)
stepE=(Lemax-Lemin)/n
return (stepE, n, Lemin, Lemax)
if __name__ ==
Hi Danny,
I followed your suggestion.
Tomorrow morning I will run this new version of the code.
Now using a sample of 81 elements (instead of 60) the profile returns:
Thu Apr 10 23:25:59 2014restats
18101188 function calls in 1218.626 seconds
Ordered by: internal time
I answer in the text
2014-03-11 9:32 GMT-04:00 ALAN GAULD alan.ga...@btinternet.com:
CC'ing the list
Please use ReplyAll when responding.
--
*From:* Gabriele Brambilla gb.gabrielebrambi...@gmail.com
*To:* Alan Gauld alan.ga...@btinternet.com
*Sent:* Tuesday
Hi,
in the next days I will receive a c++ code that I would like to run in
python (http://docs.python.org/2/extending/index.html).
It should be self consistent (no extraroutines).
I want to be ready to use it... Has someone some C++ code examples
available that I can try to run easily before
, Mar 03, 2014 at 08:00:52PM -0500, Gabriele Brambilla wrote:
Hi,
I'm doing a sum in a for loop:
www is the quantity I add.
MYMAP[i, j, k] = MYMAP[i, j, k] + www
MYMAP is a numpy array
I have strong reasons to think that in this operation happens some
numerical error...Have you
Hi,
Is possible on python to running scripts from the command prompt (I'm using
python on windows) and in the end saving all the variables and continue the
analysis in the interactive mode? (the one that you activate typing python
in the command prompt?)
Or to use python in the interactive mode
Hi,
I'm wondering how I can (if I can) make a for loop in which I don't use all
the elements.
for example
a100 = list(range(100))
for a in a100:
print(a)
it print out to me all the numbers from 0 to 99
But if I want to display only the numbers 0, 9, 19, 29, 39, ...(one every
10
Excuse me for the bad english:
not a random float numbers but random float numbers
Gabriele
2014-02-17 11:13 GMT-05:00 Gabriele Brambilla
gb.gabrielebrambi...@gmail.com:
No sorry,
it's because my problem is not so simple:
imagine that in a100 contains not integer sorted in a good way
at how to define your own iterators.
Regards
2014-02-17 17:05 GMT+01:00 Gabriele Brambilla
gb.gabrielebrambi...@gmail.com:
Hi,
I'm wondering how I can (if I can) make a for loop in which I don't use
all
the elements.
for example
a100 = list(range(100))
for a in a100
2014 16:05, Gabriele Brambilla
gb.gabrielebrambi...@gmail.com wrote:
Hi,
I'm wondering how I can (if I can) make a for loop in which I don't use
all
the elements.
for example
a100 = list(range(100))
for a in a100:
print(a)
it print out to me all the numbers from
...@gmail.com:
On 17 February 2014 16:13, Gabriele Brambilla
gb.gabrielebrambi...@gmail.com wrote:
No sorry,
it's because my problem is not so simple:
imagine that in a100 contains not integer sorted in a good way but a
random
float numbers.
How could I display only one item every 10?
for n
:
RuntimeWarning: overflow encountered in multiply
xa *= self.N
and when I search the maximum and the minimum in a matrix it has returned
me two nan values.
Gabriele
2014-02-03 Jerry Hill malaclyp...@gmail.com:
On Mon, Feb 3, 2014 at 2:17 PM, Gabriele Brambilla
gb.gabrielebrambi...@gmail.com
: (nan, nan)
Thanks
Gabriele
2014-02-02 Alan Gauld alan.ga...@btinternet.com:
On 02/02/14 02:11, Gabriele Brambilla wrote:
sometimes when I try to run a program in Python I obtain some errors.
How are you running the program?
doubly clicking in a file manager/explorer?
Running from an OS
No, i'm not using lowlevel stuff...which part of the script do you want to
see?
thanks
Gabriele
2014-02-03 Peter Otten __pete...@web.de:
Gabriele Brambilla wrote:
an example of errors that I obtain is: I build a matrix (SciPy array)
using the same data.
I search for the maximum
Hi,
sometimes when I try to run a program in Python I obtain some errors.
The strange thing is that sometimes when I run it a second time or when I
turn off the pc and I restart later to try to make it works it gives
different errors.
How could I avoid this problem? I think that it is because it
Hi,
I'm very new to Python (just 5 days!)
is there a possibility to write an interactive script?
in the sense that:
- you run your script and it do some things that you don't want to type
everytime you run the program
- but at a certain step I want that it ask me question like which column
of
to simplify the question:
does a command like cin in C++ or scanf in C exist??
thanks
Gabriele
2014-01-31 Gabriele Brambilla gb.gabrielebrambi...@gmail.com:
Hi,
I'm very new to Python (just 5 days!)
is there a possibility to write an interactive script?
in the sense that:
- you run your
Hi,
how could I read float numbers if the data format is like this (using
readline):
1.0551951.26758123387023-0.314470329249235
-0.293015360064208 6.157957619078221.92919102133526
13.07804596303782.15175351758512e6
the numbers aren't equally spaced
thanks to everyone, I've used David's method.
Gabriele
2014-01-29 Mark Lawrence breamore...@yahoo.co.uk
On 29/01/2014 02:09, Gabriele Brambilla wrote:
Hi,
how could I read float numbers if the data format is like this (using
readline):
1.0551951.26758123387023
47 matches
Mail list logo