/[escript]/trunk/downunder/test/python/run_inversion_gravmag_2d.py
ViewVC logotype

Diff of /trunk/downunder/test/python/run_inversion_gravmag_2d.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/downunder/test/python/inversion_gravmag_2d.py revision 5285 by sshaw, Tue Jun 10 02:16:18 2014 UTC trunk/downunder/test/python/run_inversion_gravmag_2d.py revision 5288 by sshaw, Tue Dec 2 23:18:40 2014 UTC
# Line 1  Line 1 
1    from __future__ import print_function
2  ##############################################################################  ##############################################################################
3  #  #
4  # Copyright (c) 2003-2014 by University of Queensland  # Copyright (c) 2003-2014 by University of Queensland
# Line 31  from esys.escript import unitsSI as U Line 31  from esys.escript import unitsSI as U
31  from esys.weipa import saveSilo  from esys.weipa import saveSilo
32    
33  try:  try:
34        import esys.ripley
35        HAVE_RIPLEY = True
36    except ImportError:
37        HAVE_RIPLEY = False
38        
39    try:
40      WORKDIR=os.environ['DOWNUNDER_WORKDIR']      WORKDIR=os.environ['DOWNUNDER_WORKDIR']
41  except KeyError:  except KeyError:
42      WORKDIR='.'      WORKDIR='.'
43    
44    @unittest.skipIf(not HAVE_RIPLEY, "Ripley module not available")
45  class Test_MagneticInversion(unittest.TestCase):  class Test_MagneticInversion(unittest.TestCase):
46      def test_2D_inversion(self):      def test_2D_inversion(self):
47          logging.getLogger('inv.MinimizerLBFGS').setLevel(logging.CRITICAL)          logging.getLogger('inv.MinimizerLBFGS').setLevel(logging.CRITICAL)
# Line 98  class Test_MagneticInversion(unittest.Te Line 105  class Test_MagneticInversion(unittest.Te
105          g, chi = inv.getCostFunction().getForwardModel(inv.DENSITY).getSurvey(0)          g, chi = inv.getCostFunction().getForwardModel(inv.DENSITY).getSurvey(0)
106          B, chi = inv.getCostFunction().getForwardModel(inv.SUSCEPTIBILITY).getSurvey(0)          B, chi = inv.getCostFunction().getForwardModel(inv.SUSCEPTIBILITY).getSurvey(0)
107    
108          saveSilo(os.path.join(WORKDIR, 'results_joint_2d'),  #        saveSilo(os.path.join(WORKDIR, 'results_joint_2d'),
109                   density=rho_new, density_ref=rho_ref,  #                 density=rho_new, density_ref=rho_ref,
110                   susceptibility=k_new, susceptibility_ref=k_ref,  #                 susceptibility=k_new, susceptibility_ref=k_ref,
111                   g_data=g, B_data=B, chi=chi)  #                 g_data=g, B_data=B, chi=chi)
112    
113  if __name__ == '__main__':  if __name__ == '__main__':
114      run_tests(__name__, exit_on_failure=True)      run_tests(__name__, exit_on_failure=True)

Legend:
Removed from v.5285  
changed lines
  Added in v.5288

  ViewVC Help
Powered by ViewVC 1.1.26