#!/usr/bin/env python

# Copyright (C) 2008-2011 University of Maryland
# All rights reserved.
# See LICENSE.txt for details.
# Author: Christopher Metting

"""
This script starts the DiRefl Direct Inversion Reflectometry application.
"""

import os
import sys

# Normally the inversion package will be installed, but if it is not installed,
# augment sys.path to include the parent directory of the package.  This
# assures that the module search path will include the package namespace and
# allows the application to be run directly from the source tree, even if the
# package has not been installed.
try:
    import osrefl
except:
    this_dir_path = os.path.dirname(os.path.abspath(__file__))
    if os.path.basename(this_dir_path) == 'osrefl':
        sys.path.insert(1, (os.path.dirname(this_dir_path)))
    else:
        print """\
        *** To run this script, either install the inversion package or
        *** place this module in the top-level directory of the package."""

if __name__ == "__main__":
    #import osrefl.examples.AuFit
    #osrefl.someplace.AuFit.main()
    print os.path.join('examples', 'AuFit.py')
    execfile(os.path.join('examples', 'AuFit.py'))

@@ -181,31 +181,27 @@
 the 
-Di
+Os
 Refl 
-Direct Inversion
+Off-Specular
  Ref
@@ -1013,167 +1013,306 @@
     
-#import osrefl.examples.AuFit%0A    #osrefl.someplace.AuFit.main()%0A    print os.path.join('examples', 'AuFit.py')%0A    execfile(os.path.join('examples', 'AuFit.py')
+if len(sys.argv) == 1:%0A        file = os.path.join('examples', 'AuFit.py')%0A    else:%0A        file = sys.argv%5B1%5D%0A%0A    try:%0A        f = open(file)%0A        f.close()%0A    except:%0A        print %22*** Script not found:%22, file%0A        sys.exit()%0A%0A    print %22Executing script%22, file, %22...%5Cn%22%0A    execfile(file
 )%0A

add command line parameter to specify script to execute