Skip to content

Commit

Permalink
Merge pull request #110 from pshriwise/vind-attrs-fix
Browse files Browse the repository at this point in the history
Moving the llc,urc paramaters to the ViewParams class
  • Loading branch information
kkiesling authored Feb 10, 2023
2 parents 4f353cc + 27678bc commit 8102d24
Showing 1 changed file with 33 additions and 32 deletions.
65 changes: 33 additions & 32 deletions openmc_plotter/plotmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,38 @@ def __init__(self, origin=(0, 0, 0), width=10, height=10):
self.basis = 'xy'
self.color_overlaps = False

@property
def llc(self):
if self.basis == 'xy':
x = self.origin[0] - self.width / 2.0
y = self.origin[1] - self.height / 2.0
z = self.origin[2]
elif self.basis == 'yz':
x = self.origin[0]
y = self.origin[1] - self.width / 2.0
z = self.origin[2] - self.height / 2.0
else:
x = self.origin[0] - self.width / 2.0
y = self.origin[1]
z = self.origin[2] - self.height / 2.0
return x, y, z

@property
def urc(self):
if self.basis == 'xy':
x = self.origin[0] + self.width / 2.0
y = self.origin[1] + self.height / 2.0
z = self.origin[2]
elif self.basis == 'yz':
x = self.origin[0]
y = self.origin[1] + self.width / 2.0
z = self.origin[2] + self.height / 2.0
else:
x = self.origin[0] + self.width / 2.0
y = self.origin[1]
z = self.origin[2] + self.height / 2.0
return x, y, z

def __eq__(self, other):
return repr(self) == repr(other)

Expand Down Expand Up @@ -902,37 +934,6 @@ def getColorLimits(self, property):
else:
return self.data_minmax[property]

@property
def llc(self):
if self.basis == 'xy':
x = self.origin[0] - self.width / 2.0
y = self.origin[1] - self.height / 2.0
z = self.origin[2]
elif self.basis == 'yz':
x = self.origin[0]
y = self.origin[1] - self.width / 2.0
z = self.origin[2] - self.height / 2.0
else:
x = self.origin[0] - self.width / 2.0
y = self.origin[1]
z = self.origin[2] - self.height / 2.0
return x, y, z
@property
def urc(self):
if self.basis == 'xy':
x = self.origin[0] + self.width / 2.0
y = self.origin[1] + self.height / 2.0
z = self.origin[2]
elif self.basis == 'yz':
x = self.origin[0]
y = self.origin[1] + self.width / 2.0
z = self.origin[2] + self.height / 2.0
else:
x = self.origin[0] + self.width / 2.0
y = self.origin[1]
z = self.origin[2] + self.height / 2.0
return x, y, z


class PlotView:
"""Setup the view of the model.
Expand Down Expand Up @@ -967,7 +968,7 @@ class PlotView:

attrs = ('view_ind', 'view_params', 'cells', 'materials', 'selectedTally')
plotbase_attrs = ('level', 'origin', 'width', 'height',
'h_res', 'v_res', 'basis', 'color_overlaps')
'h_res', 'v_res', 'basis', 'llc', 'urc', 'color_overlaps')

def __init__(self, origin=(0, 0, 0), width=10, height=10, restore_view=None,
restore_domains=False):
Expand Down

0 comments on commit 8102d24

Please sign in to comment.