diff --git a/src/SimNDT/core/simulation.py b/src/SimNDT/core/simulation.py index d7ebb5f..c21bea2 100644 --- a/src/SimNDT/core/simulation.py +++ b/src/SimNDT/core/simulation.py @@ -3,6 +3,9 @@ """ simulation.py +"Numercial" Material grid: Simulation.Im derived from scenario.Iabs in create_numericalModel, + just a resizing of Iabs (labeled material matrix) + Created by Miguel Molero on 2013-09-30. Copyright (c) 2013 MMolero. All rights reserved. """ @@ -81,7 +84,7 @@ class Simulation: self.t = self.dt*np.arange(0,self.TimeSteps) def create_numericalModel(self, scenario): - + print("Creating numerical simulation model (material labeled)") #Spatial Scale Pixel_mm = float(scenario.Pixel_mm) @@ -91,6 +94,20 @@ class Simulation: self.Im = imresize(scenario.Iabs, self.Rgrid, interp='nearest') self.MRI, self.NRI = np.shape(self.Im) + def update_numericalModel(self, scenario, Im, Iabs): + print("Updating numerical simulation model (material labeled)") + #Spatial Scale + Pixel_mm = float(scenario.Pixel_mm) + if Im is not 0: + self.Im = Im + self.MRI, self.NRI = np.shape(self.Im) + if Iabs is not 0: + scenario.Iabs = Iabs + Mp = np.shape(scenario.Iabs)[0]*1e-3/Pixel_mm/self.dx + self.Rgrid = float(Mp/np.shape(scenario.Iabs)[0]) + self.TapGrid = np.around(scenario.Tap * self.Rgrid) + self.Im = imresize(scenario.Iabs, self.Rgrid, interp='nearest') + self.MRI, self.NRI = np.shape(self.Im) def rotate_model(self, theta, scenario): Theta = theta * (180.0/np.pi) - 270.