mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
PEP8 adherence
This commit is contained in:
parent
c97d046bc6
commit
fbd0e5e4c5
2 changed files with 17 additions and 13 deletions
|
|
@ -6,6 +6,7 @@ from .error import _error_handler
|
|||
|
||||
import numpy as np
|
||||
|
||||
|
||||
class _Position(Structure):
|
||||
"""Definition of an xyz location in space with underlying c-types
|
||||
|
||||
|
|
@ -179,7 +180,8 @@ class _Slice(Structure):
|
|||
self.basis_ = basis
|
||||
return
|
||||
|
||||
raise ValueError("{} of type {} is an invalid plot basis".format(basis, type(basis)))
|
||||
raise ValueError("{} of type {} is an"
|
||||
" invalid plot basis".format(basis, type(basis)))
|
||||
|
||||
@hRes.setter
|
||||
def hRes(self, hRes):
|
||||
|
|
@ -194,7 +196,7 @@ class _Slice(Structure):
|
|||
self.level_ = level
|
||||
|
||||
def __repr__(self):
|
||||
out_str = "-----\n"
|
||||
out_str = "-----\n"
|
||||
out_str += "Plot:\n"
|
||||
out_str += "-----\n"
|
||||
out_str += "Origin: {}\n".format(self.origin)
|
||||
|
|
@ -210,19 +212,20 @@ class _Slice(Structure):
|
|||
return self.__repr__()
|
||||
|
||||
|
||||
_dll.openmc_id_map.argtypes= [POINTER(_Slice),POINTER(c_int32)]
|
||||
_dll.openmc_id_map.argtypes = [POINTER(_Slice), POINTER(c_int32)]
|
||||
_dll.openmc_id_map.restype = c_int
|
||||
_dll.openmc_id_map.errcheck = _error_handler
|
||||
|
||||
|
||||
def id_map(slice_view):
|
||||
"""
|
||||
Generate a 2-D map of (cell_id, material_id). Used for in-memory image generation.
|
||||
Generate a 2-D map of (cell_id, material_id). Used for in-memory image
|
||||
generation.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
plot : An openmc.capi.plot._Slice object describing the slice of the model to
|
||||
be generated
|
||||
plot : An openmc.capi.plot._Slice object describing the slice of the model
|
||||
to be generated
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -230,7 +233,8 @@ def id_map(slice_view):
|
|||
of OpenMC property ids with dtype int32
|
||||
|
||||
"""
|
||||
img_data = np.zeros((slice_view.vRes, slice_view.hRes, 2), dtype=np.dtype('int32'))
|
||||
print("Calling openmc id map")
|
||||
_dll.openmc_id_map(POINTER(_Slice)(slice_view), img_data.ctypes.data_as(POINTER(c_int32)))
|
||||
img_data = np.zeros((slice_view.vRes, slice_view.hRes, 2),
|
||||
dtype=np.dtype('int32'))
|
||||
_dll.openmc_id_map(POINTER(_Slice)(slice_view),
|
||||
img_data.ctypes.data_as(POINTER(c_int32)))
|
||||
return img_data
|
||||
|
|
|
|||
|
|
@ -403,9 +403,9 @@ def test_load_nuclide(capi_init):
|
|||
|
||||
|
||||
def test_id_map(capi_init):
|
||||
expected_ids = np.array([[(3,3), (2,2), (3,3)],
|
||||
[(2,2), (1,1), (2,2)],
|
||||
[(3,3), (2,2), (3,3)]], dtype = 'int32')
|
||||
expected_ids = np.array([[(3, 3), (2, 2), (3, 3)],
|
||||
[(2, 2), (1, 1), (2, 2)],
|
||||
[(3, 3), (2, 2), (3, 3)]], dtype='int32')
|
||||
|
||||
# create a plot object
|
||||
s = openmc.capi.plot._Slice()
|
||||
|
|
@ -413,7 +413,7 @@ def test_id_map(capi_init):
|
|||
s.height = 1.26
|
||||
s.vRes = 3
|
||||
s.hRes = 3
|
||||
s.origin = (0,0,0)
|
||||
s.origin = (0.0, 0.0, 0.0)
|
||||
s.basis = 'xy'
|
||||
s.level = -1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue