From e990ef4fee080d95f07d3d74b41a142eebdf56e2 Mon Sep 17 00:00:00 2001 From: Martin Genet <martin.genet@polytechnique.edu> Date: Tue, 11 Dec 2018 12:26:28 +0100 Subject: [PATCH] New box structure in generate images --- generate_images.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/generate_images.py b/generate_images.py index 75da713..7e772b6 100644 --- a/generate_images.py +++ b/generate_images.py @@ -103,6 +103,10 @@ class Image(): # structure if (structure["type"] == "no"): self.I0_structure = self.I0_structure_no + if (structure["type"] == "box"): + self.I0_structure = self.I0_structure_box + self.Xmin = structure["Xmin"] + self.Xmax = structure["Xmax"] elif (structure["type"] == "heart"): if (images["n_dim"] == 2): self.I0_structure = self.I0_structure_heart_2 @@ -201,6 +205,13 @@ class Image(): i[0] = 1. if (g is not None): g[:] = 1. # MG 20180806: gradient is given by texture; here it is just indicator function + def I0_structure_box(self, X, i, g=None): + if numpy.greater_equal(X, self.Xmin) and numpy.less_equal(X, self.Xmax): + i[0] = 1. + else: + i[0] = 0. + if (g is not None): g[:] = 0. # MG 20180806: gradient is given by texture; here it is just indicator function + def I0_structure_heart_2(self, X, i, g=None): self.R = ((X[0]-self.L[0]/2)**2 + (X[1]-self.L[1]/2)**2)**(1./2) if (self.R >= self.Ri) and (self.R <= self.Re): -- GitLab