From 70876327016dbf63a8d582c55b433ad4edc0d15d Mon Sep 17 00:00:00 2001 From: GudniRos Date: Tue, 31 May 2016 22:06:47 -0700 Subject: [PATCH] Fixing name space, updating utils --- SimPEG/NSEM/{NSEM.py => ProblemNSEM.py} | 10 +++++---- SimPEG/NSEM/Utils/dataUtils.py | 29 +++++++++++++------------ SimPEG/NSEM/__init__.py | 4 ++-- 3 files changed, 23 insertions(+), 20 deletions(-) rename SimPEG/NSEM/{NSEM.py => ProblemNSEM.py} (99%) diff --git a/SimPEG/NSEM/NSEM.py b/SimPEG/NSEM/ProblemNSEM.py similarity index 99% rename from SimPEG/NSEM/NSEM.py rename to SimPEG/NSEM/ProblemNSEM.py index d0bd8b77..18a72981 100644 --- a/SimPEG/NSEM/NSEM.py +++ b/SimPEG/NSEM/ProblemNSEM.py @@ -1,9 +1,10 @@ -from SimPEG.EM.Utils import omega, mu_0 +from SimPEG.EM.Utils.EMUtils import omega, mu_0 from SimPEG import SolverLU as SimpegSolver, PropMaps, Utils, mkvc, sp, np from SimPEG.EM.FDEM.FDEM import BaseFDEMProblem from SurveyNSEM import Survey, Data -from FieldsNSEM import Fields1D_ePrimSec, Fields3D_ePrimSec +from FieldsNSEM import BaseNSEMFields, Fields1D_ePrimSec, Fields3D_ePrimSec from SimPEG.NSEM.Utils.MT1Danalytic import getEHfields +import time, sys class BaseNSEMProblem(BaseFDEMProblem): """ @@ -169,7 +170,6 @@ class Problem1D_ePrimSec(BaseNSEMProblem): def __init__(self, mesh, **kwargs): BaseNSEMProblem.__init__(self, mesh, **kwargs) - self.fieldsPair = Fields1D_e # self._sigmaPrimary = sigmaPrimary @property def MeMui(self): @@ -313,7 +313,7 @@ class Problem1D_eTotal(BaseNSEMProblem): # From FDEMproblem: Used to project the fields. Currently not used for NSEMproblem. _solutionType = 'e_1dSolution' _formulation = 'EF' - fieldsPair = Fields1D_eTotal + # fieldsPair = Fields1D_eTotal def __init__(self, mesh, **kwargs): BaseNSEMProblem.__init__(self, mesh, **kwargs) @@ -399,6 +399,8 @@ class Problem1D_eTotal(BaseNSEMProblem): :param np.ndarray (nC,) m: Conductivity model :param np.ndarray (nC,) m_back: Background conductivity model ''' + + self.curModel = m # RHS, CalcFields = self.getRHS(freq,m_back), self.calcFields diff --git a/SimPEG/NSEM/Utils/dataUtils.py b/SimPEG/NSEM/Utils/dataUtils.py index fa97aa9a..b879c044 100644 --- a/SimPEG/NSEM/Utils/dataUtils.py +++ b/SimPEG/NSEM/Utils/dataUtils.py @@ -79,7 +79,7 @@ def plotMT1DModelData(problem,models,symList=None): axM = fig.add_axes([0.075,.1,.25,.875]) axM.set_xlabel('Resistivity [Ohm*m]',fontsize=fontSize) axM.set_xlim(1e-1,1e5) - axM.set_ylim(-10000,5000) + # axM.set_ylim(-10000,5000) axM.set_ylabel('Depth [km]',fontsize=fontSize) axR = fig.add_axes([0.42,.575,.5,.4]) axR.set_xscale('log') @@ -132,24 +132,25 @@ def plotMT1DModelData(problem,models,symList=None): freq = simpeg.mkvc(data1D['freq'],2) res, phs = appResPhs(freq,allData) - stdCol = 'gray' - axRtw = axR.twinx() - axRtw.set_ylabel('Std of log10',color=stdCol) - [(t.set_color(stdCol), t.set_rotation(-45)) for t in axRtw.get_yticklabels()] - axPtw = axP.twinx() - axPtw.set_ylabel('Std ',color=stdCol) - [t.set_color(stdCol) for t in axPtw.get_yticklabels()] - axRtw.plot(freq, np.std(np.log10(res),1),'--',color=stdCol) - axPtw.plot(freq, np.std(phs,1),'--',color=stdCol) + if False: + stdCol = 'gray' + axRtw = axR.twinx() + axRtw.set_ylabel('Std of log10',color=stdCol) + [(t.set_color(stdCol), t.set_rotation(-45)) for t in axRtw.get_yticklabels()] + axPtw = axP.twinx() + axPtw.set_ylabel('Std ',color=stdCol) + [t.set_color(stdCol) for t in axPtw.get_yticklabels()] + axRtw.plot(freq, np.std(np.log10(res),1),'--',color=stdCol) + axPtw.plot(freq, np.std(phs,1),'--',color=stdCol) # Fix labels and ticks - yMtick = [l/1000 for l in axM.get_yticks().tolist()] - axM.set_yticklabels(yMtick) + # yMtick = [l/1000 for l in axM.get_yticks().tolist()] + # axM.set_yticklabels(yMtick) [ l.set_rotation(90) for l in axM.get_yticklabels()] [ l.set_rotation(90) for l in axR.get_yticklabels()] - [(t.set_color(stdCol), t.set_rotation(-45)) for t in axRtw.get_yticklabels()] - [t.set_color(stdCol) for t in axPtw.get_yticklabels()] + # [(t.set_color(stdCol), t.set_rotation(-45)) for t in axRtw.get_yticklabels()] + # [t.set_color(stdCol) for t in axPtw.get_yticklabels()] for ax in [axM,axR,axP]: ax.xaxis.set_tick_params(labelsize=fontSize) ax.yaxis.set_tick_params(labelsize=fontSize) diff --git a/SimPEG/NSEM/__init__.py b/SimPEG/NSEM/__init__.py index 98323827..bf9a8a65 100644 --- a/SimPEG/NSEM/__init__.py +++ b/SimPEG/NSEM/__init__.py @@ -1,5 +1,5 @@ import Utils from SurveyNSEM import Rx, Survey, Data -from FieldsNSEM import Fields1D_e, Fields3D_e -import Problem1D, Problem2D, Problem3D +from FieldsNSEM import Fields1D_ePrimSec, Fields3D_ePrimSec +from ProblemNSEM import Problem1D_ePrimSec, Problem3D_ePrimSec import SrcNSEM \ No newline at end of file