Thanks, guys, for the tips.  Yes, that harrison.py script I grabbed is
dated 1999(!), so no wonder it had some deprecated dependencies
(Numeric & LinearAlgebra).  Curious, tho, that two Python installs of
mine (one in Debian and another in Vista) handled the originals just
fine.

I also figured out the gnuplot issue.  I was running SAGE on the
VMWARE virtual machine, so my browser was on a different machine.  The
script generated gnuplot would show up in the VMWARE machine, and
never on my browser.

So, I've installed SAGE in a full Debian install I have (also VMWARE),
and the gnuplot stuff works as expected: pops up a plot on the machine
running SAGE.

On the whole, I'd have to say the compatibility with native Python
scripts is not bad.

Thanks again for the tips.

  -  Cronin

On Jan 8, 2:40 pm, mabshoff <michael.absh...@mathematik.uni-
dortmund.de> wrote:
> On Jan 8, 12:03 pm, ztnews <cronin.vin...@gmail.com> wrote:
>
> Hi,
>
> > Forgive me if this is too obvious.  I'm still evaluating/learning the
> > basics of SAGE
>
> No problem, this is what a support group is for :)
>
> > Just how compatible is SAGE with Python?  By which I mean, should I be
> > able to just "drop-in" an existing/working python script and have it
> > run, or should I expect some modifications will be required?  And if
> > so, what's the major things I need to keep an eye out for?
>
> One thing is that you need to deal with some numerical types, i.e.
>
> sage: j=numpy.complex(0,1)
> sage: RealNumber=float
> sage: Integer=int
>
> Seehttp://www.math.washington.edu/~jkantor/Numerical_Sage/node3.html
> for more info on that.
>
>
>
> > I've looked in the documents, particularly "Coding in Python for Sage"
>
> >http://www.sagemath.org/doc/prog/node15.html
>
> > I'll illustrate by example.  I found a Python script that does a
> > physics calculation (band structure of silicon)
>
> >http://www.wag.caltech.edu/home/rpm/projects/tight-binding/harrison.py
>
> > or see here for a discussion of the script:
>
> >http://www.wag.caltech.edu/home/rpm/projects/tight-binding/
>
> > I've successfully run harrison.py (without modification) using both
> > linux and windows-based python installations.  But under SAGE (I've
> > installed the latest vmware version) required a little diddling to get
> > it (mostly) running.
>
> > Two points. 1) This script calls for modules "Numeric" and
> > "LinearAlgebra"
>
> > from Numeric import *        # Make sure that NumPy is in your
> > from LinearAlgebra import eigenvalues
>
> Numeric is the predecessor to NumPy which is in Sage. Nunmeric used to
> be at least an optional spkg for Sage, but I am not sure if it still
> works. Installing Numeric should be possible, but AFAIK this is
> seriously outdated code.
>
> > both of which failed in SAGE.  A couple minor modifications and I got
> > past those points.  I suspect these are deprecated, but still the
> > Python installations handled the script without mods.
>
> You probably have either Numeric or an older numpy installed, but I am
> not an expert about the finer details of what numeric code works with
> that numpy release (if at all)
>
> > 2) The other thing that failed was the system call to gnuplot at the
> > end of the script.  I can imagine that would be hard make work in a
> > SAGE-notebook environment, and I haven't managed that.
>
> Do you have gnuplot installed? If so what are the failures? Did the
> gnuplot part of script work with the pure Python env?
>
> > Now, my point here is not that I need that script to run,
> > particularly.  My question is about compatibility.  Have I missed
> > something about how to execute a Python script with the minimum of
> > modifications?
>
> Without going into specifics Sage ships a subset of what the usual
> distributions ship for python modules, but adds some unusual ones that
> aren't in every distribution. You can install pretty much any Python
> module by running
>
>  ./sage -sh
>  cd into unpacked python module directory
>  python setup.py install
>
> There might be problems with dependencies and so on, but for most pure
> Python code this should work really well.
>
> > Thanks for your time.  BTW, SAGE is really impressive.
>
> :)
>
> Cheers,
>
> Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to