Changeset 129


Ignore:
Timestamp:
03/27/09 14:32:08 (7 years ago)
Author:
mmckerns
Message:

added releases branch;
added a bit more doc to example12;
modified setup.py to work with setuptools

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • mystic/examples/example12.py

    r126 r129  
    5353    return x,y 
    5454 
     55# draw the plot 
     56def 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  
    5563# plot the polynomial 
    5664def plot_data(evalpts,datapts,style='k.'): 
     
    6270    x,y = data(params) 
    6371    plot_data(x,y,style) 
     72    pylab.legend(["Data","Fitted"]) 
    6473    return 
    6574 
     
    7786    x,datapts = noisy_data(target) 
    7887 
    79     # plot observed and target data 
     88    # plot observed data 
     89    plot_frame() 
    8090    plot_data(x,datapts) 
    81     plot_solution(target) 
    8291 
    8392    # generate cost function 
     
    92101  
    93102    # plot solution versus target coefficients 
    94     plot_solution(solution,'r-') 
     103    plot_solution(solution) 
    95104    getch()  
    96105 
  • mystic/setup.py

    r125 r129  
    11#!/usr/bin/env python 
    22# 
    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 
    105 
    11 from distutils.core import setup 
     6# check if easy_install is available 
     7try: 
     8#   import __force_distutils__ #XXX: uncomment to force use of distutills 
     9    from setuptools import setup 
     10    has_setuptools = True 
     11except ImportError: 
     12    from distutils.core import setup 
     13    has_setuptools = False 
    1214 
    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 
     16setup_code = """ 
     17setup(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'), 
    2730 
    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""" 
    3034 
    31     scripts=[]) 
     35# add dependencies 
     36numpy_version = '>=1.0' 
     37matplotlib_version = '>=0.91' 
     38if has_setuptools: 
     39    setup_code += """ 
     40      install_requires = ('numpy%s'), 
     41""" % numpy_version 
     42 
     43# close 'setup' call 
     44setup_code += """     
     45      scripts=[]) 
     46""" 
     47 
     48# exec the 'setup' code 
     49exec setup_code 
     50 
     51# if dependencies are missing, print a warning 
     52try: 
     53    import numpy 
     54    import matplotlib 
     55except 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" 
    3261 
    3362 
     
    3564    pass 
    3665 
    37 # End of file 
     66# end of file 
Note: See TracChangeset for help on using the changeset viewer.