资源说明:Pythonic setup tools for Matlab
Contents: 1.) About 2.) Setup + Install 3.) Intended audience 4.) Development history 5.) License 6.) Contact ________________________________________________________________________________ 1.) About ________________________________________________________________________________ This is a collection of tools meant to shoehorn the way Matlab works into a more Python-ic behavior. Setuplab provides the ability to write code like: >> from speclab.orthopoly import jacobi % imports the sub-package jacobi % variable 'jacobi' is created >> import speclab.orthopoly as opoly % imports orthopoly1d into variable opoly >> from speclab.orthopoly.jacobi.quad import gauss_quadrature as gq % imports gauss_quadrature into variable gq >> from speclab.orthopoly.jacobi.quad import * % imports ALL functions from the % specified submodule. The "from" function does nasty things using "assignin" statements, which will cause errors if Matlab's optimizer flags one of your functions as a static workspace and then you try to dynamically create variables using "import" and "from". The objects that are imported to the specified variables depend on how your init__.m files are written (see the setup+installation section). ________________________________________________________________________________ 2.) Setup + Install ________________________________________________________________________________ Installation is simple, but must be done *every* time Matlab is started: (1) add the setuplab directory to your global MATLAB path. (2) run "setuplab" at the Matlab command prompt Both can be done via a startup.m file to automate this. Setuplab does not actually do anything unless some explicit calls are made to setuplab functions. Once called, setuplab does two things: - crawls through parallel directories ("packages") and searches for "init__.m" files in those directories. If it does not find one, the directory is ignored. If it does find such a file, it runs the file and stores the output in the field of a struct with fieldname equal to the directory name. - adds package directories to the MATLAB path as specified in each package's init__.m file. This crawl must be performed every time MATLAB is started, or when the user invokes the 'clear all' or 'clear functions' statements. For an example of an init__.m file, look at labtools, shapelab, or speclab. Consider the following scenario: 1.) You boot up Matlab 2.) You run some setuplab statement 3.) You make some changes to one of your Pythonic packages or to setuplab 4.) You attempt to use the setuplab handles to access the newly defined functions. You will notice that when attempting #4, the old definitions (before you made new changes) will be the only versions of the function Matlab sees. The reason for this is that when Matlab creates an anonymous function (which is how setuplab works), it takes a snapshot of the function *when you create the handle*. If something is updated after the handle is created, Matlab doesn't check for this. To force Matlab to revamp all the handles, you'll have to force a reinitialization of setuplab -- restart MATLAB or 'clear all'. ________________________________________________________________________________ 3.) Intended audience ________________________________________________________________________________ This module is for use primarily in tandem with another Pythonic Matlab package, e.g. Speclab. It is not really meant to be stand-alone, unless you want to use it for your own development. ________________________________________________________________________________ 4.) Development history ________________________________________________________________________________ If you'd like the whole development history for this collection, you'll need the version control system "git". You can clone the repo with the command: git clone git://github.com/cygnine/setuplab.git You may navigate a web browser to http://www.github.com/cygnine/setuplab and github will show a pretty GUI of the development history and included files. You can also download a tarball directly from github of each repo, but the tarball won't have the history. ________________________________________________________________________________ 5.) License ________________________________________________________________________________ These Matlab files are released under the MIT License. See the LICENSE file in this directory. Basically do what you want, and don't sue me. And give me credit if any is due. ________________________________________________________________________________ 6.) Contact ________________________________________________________________________________ Any comments/suggestions/improvements are welcome. Akil Narayan akil@purdue.edu
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。