def toNumpy(self, regexp, dtypes): import numpy as np try: return np.fromregex(StringIO(self.data), regexp, dtypes) except TypeError: from PyFoam.ThirdParty.six import BytesIO, b return np.fromregex(BytesIO(b(self.data)), regexp, dtypes)
def __callCaseReport(self,region=None,level=3,**kwargs): """Helper function that does the actual calling of CaseReport and returning of the HTML-formatted output""" s=StringIO() if region!=None: level=level+1 CaseReport(args=[self.path], region=region, file=s, headingLevel=level, **kwargs) return HTML(publish_parts(s.getvalue(), writer_name='html', settings_overrides={ "initial_header_level":level, "doctitle_xform":False })['html_body'])
def toNumpy(self, regexp, dtypes): """Assume that the unparsed data contains line-wise data and transform it to a numpy-array. @param regexp: regular expression where the groups correspond to the dtypes, @param dtypes: list with dtypes""" import numpy as np try: return np.fromregex(StringIO(self.data), regexp, dtypes) except TypeError: from PyFoam.ThirdParty.six import BytesIO, b return np.fromregex(BytesIO(b(self.data)), regexp, dtypes)