|
|
Up |
|
|
  |
|
|
  |
Author: Fredrik LundhFredrik Lundh
Date: Jul 23, 2008 05:55
maurizio wrote:
> thank you for your answer
> actually i've to do some statistics (maximum,minimum,mean,standard
> deviation,....) of a file of data in which each column is a particular
> type of data. (the file is a tab separated value).
> I was trying to do this by using python (usually i work with fortran or
> bash, but i'm learning python), that the reason why i tried to use numpy.
As I implied, you can do all this in standard Python "by hand", but
numpy/scipy can definitely make things easier. There's a dependency
cost here (your program needs one or more extra libraries to work), but
if that's no problem in your environment, I'd recommend that approach.
The scipy add-on contains a bunch of things for file i/o; see
http://www.scipy.org/doc/api_docs/SciPy.io.html
for an overview. Since you're reading text files, the "array_import"
module seems to be what you need:
http://www.scipy.org/doc/api_docs/SciPy.io.array_import.html
There are active user communities for both numpy and scipy that can help
you sort out any remaining issues; for details, see:
http://www.scipy.org/Mailing_Lists
|
| Show full article (1.16Kb) |
|
| |
no comments
|
|
  |
Author: Fredrik LundhFredrik Lundh
Date: Jul 23, 2008 04:44
Fredrik Lundh wrote:
>> cl cl -EHsc -MD -I \python25\include test.cc \python25\libs\python25.lib
cut and paste error there: the "cl cl" should be just one "cl", of course.
and just for the record/google, if I
1) don't include the header file, I get
test.cc(5) : error C3861: 'Py_Initialize': identifier not found, even
with argument-dependent lookup
2) attempt to undef the __cplusplus macro, I get
test.cc(1) : warning C4117: macro name '__cplusplus' is reserved,
'#undef' ignored
3) cut and paste declarations from the header files to my own file
instead of including the files, ignoring the extern "C" part, I get
test.obj : error LNK2019: unresolved external symbol "int __cdecl
Py_Finalize(void)" (?Py_Finalize@@YAHXZ) referenced in function _main
which looks pretty similar to the errors posted earlier.
|
| |
|
no comments
|
|
  |
Author: Fredrik LundhFredrik Lundh
Date: Jul 23, 2008 03:34
leo davis wrote:
> I''m trying achieve the following by running python programs
>
> -login to a website
> -automate filling up web forms
|
| |
|
no comments
|
|
  |
Author: mauriziomaurizio
Date: Jul 23, 2008 03:20
thank you for your answer
actually i've to do some statistics (maximum,minimum,mean,standard
deviation,....) of a file of data in which each column is a particular
type of data. (the file is a tab separated value).
I was trying to do this by using python (usually i work with fortran or
bash, but i'm learning python), that the reason why i tried to use numpy.
Fredrik Lundh wrote:
> maurizio
> wrote:
>
>> i tryed to use the module max of numpy,
>> the problem is that i don't know how to put the column...
|
| Show full article (2.61Kb) |
|
1 Comment |
|
  |
Author: Fredrik LundhFredrik Lundh
Date: Jul 23, 2008 02:44
maurizio wrote:
> i tryed to use the module max of numpy,
> the problem is that i don't know how to put the column of the file in an
> array.
> (i'm new in phyton).
> anyway if you think there is a better way.....
What kind of file is it? Did you pick numpy because you want to do
matrix operations (beyond just finding a maximum value), or was it just
the first thing you stumbled upon when researching the problem?
A simple pattern for finding the maximum value in a file, using only
plain Python code, is:
max_value = ... some very small value ...
for line in file:
value = ... extract value from line ...
if value > max_value:
max_value = value
If it's not obvious what "some very small value" is, given the range of
data you're working with, you can do
|
| Show full article (2.06Kb) |
|
no comments
|
|
  |
Author: Michiel OvertoomMichiel Overtoom
Date: Jul 23, 2008 02:40
Maurizio wrote...
> the problem is that i don't know how to put the column of the file in an
> array. (i'm new in phyton).
Give us an example of how your file looks, and what you want to
extract from it, so that we don't have to guess.
Greetings,
|
| |
|
no comments
|
|
  |
Author: Fredrik LundhFredrik Lundh
Date: Jul 23, 2008 02:22
> In my work I have from time-to-time had to pick up and maintain
> scripts (generally shell/Python stuff) which non-professional programmers
> have written. It's never what you would call a "pleasant" task.
|
| |
|
no comments
|
|
  |
Author: mauriziomaurizio
Date: Jul 23, 2008 02:07
i tryed to use the module max of numpy,
the problem is that i don't know how to put the column of the file in an
array.
(i'm new in phyton).
anyway if you think there is a better way.....
Fredrik Lundh wrote:
> maurizio
> wrote:
>
>> which is the best way for the calculation of the maximum value in
>> a column of a file?
>
> what approach have you tried, and what happened when you tried it?
>
>
>
>
>
|
| |
|
no comments
|
|
  |
|
|
  |
Author: Stef MientkiStef Mientki
Date: Jul 23, 2008 01:58
hello,
I'm looking for a way to remove duplicate code.
The problem is this:
In all my modules I've version information,
containing version information, date, author, testconditions etc,
something like this:
Version_Text = [
[ 0.2, '10-02-2008', 'Stef Mientki',
'Test Conditions:', (1,2),
_(0, """
- scaling and offset is set for each individual signal
- Time history window for 1 signal with min/max display
- set attributes for all signals at once
""") ],
|
| Show full article (1.05Kb) |
|
2 Comments |
|
|
|
|
|
|