Changeset 129
- Timestamp:
- 03/27/09 14:32:08 (7 years ago)
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/examples/example12.py
r126 r129 53 53 return x,y 54 54 55 # draw the plot 56 def plot_frame(label=None): 57 pylab.close() 58 pylab.suptitle("fitting noisy 5th-order polynomial coefficients") 59 pylab.xlabel("x") 60 pylab.ylabel("f(x)") 61 return 62 55 63 # plot the polynomial 56 64 def plot_data(evalpts,datapts,style='k.'): … … 62 70 x,y = data(params) 63 71 plot_data(x,y,style) 72 pylab.legend(["Data","Fitted"]) 64 73 return 65 74 … … 77 86 x,datapts = noisy_data(target) 78 87 79 # plot observed and target data 88 # plot observed data 89 plot_frame() 80 90 plot_data(x,datapts) 81 plot_solution(target)82 91 83 92 # generate cost function … … 92 101 93 102 # plot solution versus target coefficients 94 plot_solution(solution ,'r-')103 plot_solution(solution) 95 104 getch() 96 105 -
mystic/setup.py
r125 r129 1 1 #!/usr/bin/env python 2 2 # 3 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 # 5 # Patrick Hung & Mike McKerns, Caltech 6 # (C) 1998-2009 All Rights Reserved 7 # 8 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 9 # 3 # Michael McKerns 4 # mmckerns@caltech.edu 10 5 11 from distutils.core import setup 6 # check if easy_install is available 7 try: 8 # import __force_distutils__ #XXX: uncomment to force use of distutills 9 from setuptools import setup 10 has_setuptools = True 11 except ImportError: 12 from distutils.core import setup 13 has_setuptools = False 12 14 13 setup( 14 name="mystic", 15 version="0.1a1", 16 author="Mike McKerns, Patrick Hung" 17 maintainer="Mike McKerns", 18 maintainer_email="mmckerns@caltech.edu", 19 license="BSD", 20 platforms=["any"], 21 description="Interactive Inversion Analysis Framework", 22 classifiers=( 23 "Intended Audience :: Developers", 24 "Programming Language :: Python", 25 "Development Status :: 2 - Pre-Alpha", 26 "Topic :: Physics Programming"), 15 # build the 'setup' call 16 setup_code = """ 17 setup(name='mystic', 18 version='0.1a1', 19 description='a simple interactive inversion analysis framework', 20 author = 'Mike McKerns, Patrick Hung', 21 maintainer = 'Mike McKerns', 22 maintainer_email = 'mmckerns@caltech.edu', 23 license = 'BSD', 24 platforms = ['any'], 25 url = 'http://mmckerns.github.io/~mmckerns', 26 classifiers = ('Intended Audience :: Developers', 27 'Programming Language :: Python', 28 'Development Status :: 2 - Pre-Alpha', 29 'Topic :: Physics Programming'), 27 30 28 packages=['mystic','mystic.models'], 29 package_dir={'mystic':'mystic','mystic.models':'models'}, 31 packages = ['mystic','mystic.models'], 32 package_dir = {'mystic':'mystic','mystic.models':'models'}, 33 """ 30 34 31 scripts=[]) 35 # add dependencies 36 numpy_version = '>=1.0' 37 matplotlib_version = '>=0.91' 38 if has_setuptools: 39 setup_code += """ 40 install_requires = ('numpy%s'), 41 """ % numpy_version 42 43 # close 'setup' call 44 setup_code += """ 45 scripts=[]) 46 """ 47 48 # exec the 'setup' code 49 exec setup_code 50 51 # if dependencies are missing, print a warning 52 try: 53 import numpy 54 import matplotlib 55 except ImportError: 56 print "\n***********************************************************" 57 print "WARNING: One of the following dependencies is unresolved:" 58 print " numpy %s" % numpy_version 59 print " matplotlib %s (optional)" % matplotlib_version 60 print "***********************************************************\n" 32 61 33 62 … … 35 64 pass 36 65 37 # End of file66 # end of file
Note: See TracChangeset
for help on using the changeset viewer.