.mat file processing in Python

Note:

Only a small fraction of this is wx-related, but...

(I make such data processing in MatLAB.)

I highly suggest you do that in Python+numpy+scipy instead, but for the moment:

                -selecting the path of the files process and the file i
want to process

wx.FileDialog

The .mat files contain several variables:

There is a python package for reading .mat files -- some googling will
find it for you.

Then you will want numpy for actually working with the data.

you can generate various controls in wxPython for this -- look at the
wxPythonDemo, and see what makes the most sense for your use.

- I want to check if each value is within the limits specified by me
(minimum and maximum given in interactively mode from the interface- for
example a textbox) and show me status of comparison: passed (if all values
are in range) or failed (if one or more values are out of range) + the
values that are out of limits

again, widgets for getting this from users are there in wx -- the
actual checking you'll want numpy for.

- after comparison, the results should be saved in a template( excel file)
which I want to complete in the interface with the name of the person who
makes the"test", time, file name, name of the variable / variables, and for
variables specify status: passed / failed, and for „ failed” specify the
values that came out of limits

hopefully ou can use plain *.csv files -- in which case there is the
csv mod;le for reading/writing them, and/or numpy has savetext() which
will write csv files from numpy arrays.

-I want to do graphics (plots) of variation of values in time, and there
should be a different colored line on both sides of the graph to be one line
with different color-the lines mark the boundaries of values

I recommend Matplotlib for this -- it can be embedded in a wx app.
Check out wxmpl for a way to make that easy and nice.

-I want to save these graphics in. jpeg or . png format, and integrated
these graphics in the excel template

matplotlib support png (you really don't want to use jpeg for this)

As for Excel, I think there is a package for directly manipulating
Excel files, but I wouldn't even try -- it is simply NOT a good
interchange format...

HTH,
  -Chris

···

On Thu, May 30, 2013 at 12:42 AM, Romila Ana-Maria <romila.anamaria@gmail.com> wrote:

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Hi,

Just to build on Chris’ answer…

···

On 30 May 2013 21:27, Chris Barker - NOAA Federal wrote:

Note:

Only a small fraction of this is wx-related, but…

On Thu, May 30, 2013 at 12:42 AM, Romila Ana-Maria

romila.anamaria@gmail.com wrote:

(I make such data processing in MatLAB.)

I highly suggest you do that in Python+numpy+scipy instead, but for the moment:

            -selecting the path of the files process  and  the file i

want to process

wx.FileDialog

The .mat files contain several variables:

There is a python package for reading .mat files – some googling will

find it for you.

You will find scipy.io.loadmat suitable for your needs.

Then you will want numpy for actually working with the data.

you can generate various controls in wxPython for this – look at the

wxPythonDemo, and see what makes the most sense for your use.

  • I want to check if each value is within the limits specified by me

(minimum and maximum given in interactively mode from the interface- for

example a textbox) and show me status of comparison: passed (if all values

are in range) or failed (if one or more values are out of range) + the

values that are out of limits

again, widgets for getting this from users are there in wx – the

actual checking you’ll want numpy for.

  • after comparison, the results should be saved in a template( excel file)

which I want to complete in the interface with the name of the person who

makes the"test", time, file name, name of the variable / variables, and for

variables specify status: passed / failed, and for „ failed” specify the

values that came out of limits

hopefully ou can use plain *.csv files – in which case there is the

csv mod;le for reading/writing them, and/or numpy has savetext() which

will write csv files from numpy arrays.

Using xlrd (to read) and xlwt (to write) Excel file is not much more painful than writing csv files. I use these two libraries all the time and they are immensely powerful. If you are on Windows, you may also consider the win32com package to directly communicate with Excel.

-I want to do graphics (plots) of variation of values in time, and there

should be a different colored line on both sides of the graph to be one line

with different color-the lines mark the boundaries of values

I recommend Matplotlib for this – it can be embedded in a wx app.

Agreed. By far the best 2D plotting library around.

Check out wxmpl for a way to make that easy and nice.

-I want to save these graphics in. jpeg or . png format, and integrated

these graphics in the excel template

matplotlib support png (you really don’t want to use jpeg for this)

As for Excel, I think there is a package for directly manipulating

Excel files, but I wouldn’t even try – it is simply NOT a good

interchange format…

Again, I agree in principle but it mostly depends to whom you distribute your results (or from whom you get them). I have to deal with Excel-based data all the time and I got used to it, even though I will never, ever forget this:

http://www.marketwatch.com/story/88-of-spreadsheets-have-errors-2013-04-17

Excel is a very powerful spreadsheet tool, but it’s way too easy to make mistakes exactly because of this.

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://www.infinity77.net

-------------------------------------------------------------

def ask_mailing_list_support(email):

if mention_platform_and_version() and include_sample_app():
    send_message(email)
else:

    install_malware()
    erase_hard_drives()

-------------------------------------------------------------