Fri 16 May 23:06:54 CEST 2025
This commit is contained in:
parent
fc2237aed0
commit
cea974c335
|
@ -3,6 +3,9 @@
|
||||||
"""
|
"""
|
||||||
simulation.py
|
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.
|
Created by Miguel Molero on 2013-09-30.
|
||||||
Copyright (c) 2013 MMolero. All rights reserved.
|
Copyright (c) 2013 MMolero. All rights reserved.
|
||||||
"""
|
"""
|
||||||
|
@ -81,7 +84,7 @@ class Simulation:
|
||||||
self.t = self.dt*np.arange(0,self.TimeSteps)
|
self.t = self.dt*np.arange(0,self.TimeSteps)
|
||||||
|
|
||||||
def create_numericalModel(self, scenario):
|
def create_numericalModel(self, scenario):
|
||||||
|
print("Creating numerical simulation model (material labeled)")
|
||||||
#Spatial Scale
|
#Spatial Scale
|
||||||
Pixel_mm = float(scenario.Pixel_mm)
|
Pixel_mm = float(scenario.Pixel_mm)
|
||||||
|
|
||||||
|
@ -91,6 +94,20 @@ class Simulation:
|
||||||
self.Im = imresize(scenario.Iabs, self.Rgrid, interp='nearest')
|
self.Im = imresize(scenario.Iabs, self.Rgrid, interp='nearest')
|
||||||
self.MRI, self.NRI = np.shape(self.Im)
|
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):
|
def rotate_model(self, theta, scenario):
|
||||||
Theta = theta * (180.0/np.pi) - 270.
|
Theta = theta * (180.0/np.pi) - 270.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user