ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 31 Jan 2013 00:38:17 -0600How to import 3rd party modules into SAGE?http://ask.sagemath.org/question/9754/how-to-import-3rd-party-modules-into-sage/In SAGE, I can import math or numpy from within a script, but I'm unable to import stuff located in, for example, /usr/lib/python2.7/dist-packages/. How could I fix that?
Thanks in advance.FaustoThu, 31 Jan 2013 00:38:17 -0600http://ask.sagemath.org/question/9754/Structuring and naming moduleshttp://ask.sagemath.org/question/9219/structuring-and-naming-modules/I'm starting a new research project, and I'm confused about the best way to organize everything.
I'll need to write a few functions that compute invariants on Graphs, but the trick is that each function needs to call lots of smaller functions that compute bounds for the invariant, and then choose the min/max of these bounds and return it. I'd like the smaller functions to be "plug and play," so that other people on the project can come up with new bounds computers, drop them in the folder, and have them automatically used.
Currently, my file structure looks like this:
<pre>
project/
__init__.py
project.py
bounds/
__init__.py
boundcomputer1.py
boundcomputer2.py
...
</pre>
If I start a Sage session and <code>attach project.py</code>, the code seems to work correctly.
If I do <code>sage -t project.py</code>, it complains about not being able to find the <code>bounds</code> module.
Also, how do I get the functions in <code>project.py</code> to show up under a <code>project</code> namespace, so that I can type <code>project.compute_invariant()</code>, where <code>compute_invariant()</code> is a function defined inside <code>project.py</code>?
I'm happy to take any advice on best practice for a project like this.patronicsWed, 08 Aug 2012 10:17:21 -0500http://ask.sagemath.org/question/9219/