Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#15 more duck typing

Core (6)
Jan Strube

I noticed that at least in the CloudXD classes, PAIDA uses the types library.
This is very inconvenient for use with numpy arrays.
For example, the following diff shows how to make use of duck typing in Cloud1D.
Index: paida/paida_core/
RCS file: /cvsroot/paida/paida/paida/paida_core/,v
retrieving revision 1.15
diff -r1.15
< if isinstance(data1, types.ListType) and (data2 == None) and (data3 == None):
> if hasattr(data1, '__iter__') and (data2 == None) and (data3 == None):

This can easily be extended to the other methods as well. The reason is that it will be easier to integrate with numpy/scipy.

Oh, and something else:
Maybe I'm the only one who thinks so, but could the creation of threads and the gui initialization be moved to the PlotterFactory? Or at least out of the default library.
I use paida mainly for histogramming of data, and hardly use the plotting at all. In fact, most of the time I work remotely.
So I have to import the guiselector and choose the batch backend to prevent paida from opening a window every time I want to inspect a file.


  • Koji Kishimoto
    Koji Kishimoto

    Logged In: YES
    Originator: NO

    Thanks for your patch!
    I've checked new files into CVS.

    When you work remotely, simply passing "--gui=batch" argument to command line has any trouble?

  • Koji Kishimoto
    Koji Kishimoto

    • labels: --> Core
    • milestone: --> Improvement
    • assigned_to: nobody --> korry
  • Jan Strube
    Jan Strube

    Logged In: YES
    Originator: YES

    Thanks for the update.
    There's no problem in principle with --gui=batch, but I would have to do it _every_ time.
    Maybe it's not a big deal. I can just import the gui selector before importing paida.

    I'm really doing most of the plotting in matplotlib at the moment.
    That isn't really paida's fault, but the AIDA API for plotting is way too verbose for my taste. I think it shows its Java background.
    Maybe paida could get a better API added, something more pythonic, like matplotlib that supports the shorthand pylab interface, but underneath everything is done OO.
    That way people with AIDA background could still use it and interoperate with the AIDA file format, but people with a preference for Python don't have to be so verbose.

    Well, don't worry. I'm not suggesting anything here, just thinking out loud. I'm sure I'll send more patches as my analysis (hopefully) progresses.