Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4 add visualization functionality for morphology checker #7

Merged
Binary file added NRSS/cmap/infinitydouble_cmap.npy
Binary file not shown.
11 changes: 9 additions & 2 deletions NRSS/morphology.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from .checkH5 import check_NumMat
from .reader import read_material, read_config
from .writer import write_opts, write_hdf5
from .visualizer import morphology_visualizer

import numpy as np
import xarray as xr
import sys
Expand Down Expand Up @@ -287,7 +289,7 @@ def config(self, dict1):
warnings.warn(f'Key {key} not supported')

@classmethod
def load_morph_hdf5(cls, hdf5_file):
def load_morph_hdf5(cls, hdf5_file, create_cy_object=False):
with h5py.File(hdf5_file, 'r') as f:
if 'Euler_Angles' not in f.keys():
raise KeyError('Only the Euler Angle convention is currently supported')
Expand All @@ -309,7 +311,7 @@ def load_morph_hdf5(cls, hdf5_file):
psi=psi,
NumZYX=Vfrac.shape)

return cls(numMat, materials=materials, PhysSize=PhysSize)
return cls(numMat, materials=materials, PhysSize=PhysSize, create_cy_object=create_cy_object)

def load_config(self, config_file):
self.config = read_config(config_file)
Expand Down Expand Up @@ -487,6 +489,11 @@ def check_materials(self, quiet=True):
if not quiet:
print('All material checks have passed')

def visualize_materials(self, *args,**kwargs):
return morphology_visualizer(self, *args,**kwargs)
visualize_materials.__doc__ = morphology_visualizer.__doc__


def validate_all(self, quiet=True):
self.check_materials(quiet=quiet)
input_check = self.inputData.validate()
Expand Down
Loading
Loading