from pylab import nx?

Hi All,

A few of the units demos include the lines:

from pylab import nx

...but this import errors for me.

Why is that?

cheers,

Chris

···

--
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk

Chris Withers wrote:

Hi All,

A few of the units demos include the lines:

from pylab import nx

...but this import errors for me.

Not sure if this is relevant, but NX is a frequently used shorthand for the NetworkX graph/network analysis package from Los Alamos National Labs:

https://networkx.lanl.gov/reference/networkx/networkx-module.html

i.e. people do:

import NetworkX as nx

It has a sub-package for drawing networks in pylab (networkx.drawing.nx_pylab). Maybe at some point someone was trying to integrate NetworkX with pylab directly and some tests got left laying around? The NetworkX guys would probably know.

···

--
Zane Selvans
Amateur Human
zane@...1923...
303/815-6866
PGP Key: 55E0815F

Chris Withers wrote:

Hi All,

A few of the units demos include the lines:

from pylab import nx

...but this import errors for me.

Why is that?

If you are referring to scripts in the matplotlib/examples/ subdirectory then you must have a version in which some of those scripts had not been brought up to date with the rest of matplotlib. (Historically, this has often been the case--only a subset of the examples are maintained. Right now, for example, simple3d.py is broken. 3D plotting is itself unmaintained, so there is little incentive to do anything about the example.) In the svn version there are no lines importing nx. This was an abbreviation for the numerix module, which was a compatibility wrapper for the three different numeric packages (Numeric, numarray, and numpy) until numpy was fully developed, rendering Numeric and numarray obsolete.

Eric

···

cheers,

Chris

Eric Firing wrote:

Chris Withers wrote:
  

Hi All,

A few of the units demos include the lines:

from pylab import nx

...but this import errors for me.

Why is that?
    
If you are referring to scripts in the matplotlib/examples/ subdirectory then you must have a version in which some of those scripts had not been brought up to date with the rest of matplotlib. (Historically, this has often been the case--only a subset of the examples are maintained. Right now, for example, simple3d.py is broken. 3D plotting is itself unmaintained, so there is little incentive to do anything about the example.) In the svn version there are no lines importing nx. This was an abbreviation for the numerix module, which was a compatibility wrapper for the three different numeric packages (Numeric, numarray, and numpy) until numpy was fully developed, rendering Numeric and numarray obsolete.
  

Slightly OT, but if matplotlib is participating in any sort of internship projects (Google Summer of Code etc.) that would be a great student project -- to clean up all the examples, removing dead ones, editing for consistency etc.

Cheers,
Mike

Eric Firing wrote:

If you are referring to scripts in the matplotlib/examples/ subdirectory then you must have a version in which some of those scripts had not been brought up to date with the rest of matplotlib.

You should turn them into unit tests as well as examples.
I'm about to try and do this, time permiting, for xlwt (small plug - it's great for generating formatted excel files from raw data, just as xlrd is for extracting data and formatting from excel files, sadly, neither can do charting with excel, which is why I'm learning to love and hate numpy and matplotlib :wink: )

Out of interest, does MPL have unit tests? It should :wink:

cheers,

Chris

···

--
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk

Chris Withers wrote:

Eric Firing wrote:
  

If you are referring to scripts in the matplotlib/examples/ subdirectory then you must have a version in which some of those scripts had not been brought up to date with the rest of matplotlib.
    
You should turn them into unit tests as well as examples.
  

The "backend_driver.py" example runs a number of other examples using a number of different backends. That's been a reasonably successful set of regression and coverage tests. It's not perfect, but it's a start. There are also some lower-level unit tests for frequently-reoccurring bugs in the unit directory.

Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michael Droettboom wrote:

The "backend_driver.py" example runs a number of other examples using a number of different backends. That's been a reasonably successful set of regression and coverage tests. It's not perfect, but it's a start. There are also some lower-level unit tests for frequently-reoccurring bugs in the unit directory.

Indeed, is there any kind of "full unit test" suite that a developer can run when changing things ot make sure they haven't fubarred anything?

cheers,

Chris

···

--
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk

Chris Withers wrote:

Michael Droettboom wrote:

The "backend_driver.py" example runs a number of other examples using a number of different backends. That's been a reasonably successful set of regression and coverage tests. It's not perfect, but it's a start. There are also some lower-level unit tests for frequently-reoccurring bugs in the unit directory.

Indeed, is there any kind of "full unit test" suite that a developer can run when changing things ot make sure they haven't fubarred anything?

backend_driver.py is, AFAIK, the closest thing to that. I recently did a coverage analysis of it (with coverage.py), and it hits something like 98% of the non-error case code, so it's pretty good.

What we don't have is an automated regression test framework to see if the results remain correct. There are a number of reasons why this is a non-trivial task -- there was a thread about that on this list a few months ago. Unfortunately, I can't find it... Maybe someone else remembers the subject line?

Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Hi All,

I have the same issue, is there a fix to this

Michael Droettboom-3 wrote:

···

Eric Firing wrote:

Chris Withers wrote:
  

Hi All,

A few of the units demos include the lines:

from pylab import nx

...but this import errors for me.

Why is that?
    
If you are referring to scripts in the matplotlib/examples/ subdirectory
then you must have a version in which some of those scripts had not been
brought up to date with the rest of matplotlib. (Historically, this has
often been the case--only a subset of the examples are maintained.
Right now, for example, simple3d.py is broken. 3D plotting is itself
unmaintained, so there is little incentive to do anything about the
example.) In the svn version there are no lines importing nx. This was
an abbreviation for the numerix module, which was a compatibility
wrapper for the three different numeric packages (Numeric, numarray, and
numpy) until numpy was fully developed, rendering Numeric and numarray
obsolete.
  

Slightly OT, but if matplotlib is participating in any sort of
internship projects (Google Summer of Code etc.) that would be a great
student project -- to clean up all the examples, removing dead ones,
editing for consistency etc.

Cheers,
Mike

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://www.nabble.com/from-pylab-import-nx--tp16118581p17105429.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

from pylab import nx
...but this import errors for me.

I have the same issue, is there a fix to this

I'm on the run, but let me guess that you
can replace this with

    import numpy as nx

Cheers,
Alan Isaac

···

On Wed, 7 May 2008, New2Python apparently wrote: