def read_op2(self, op2_filename=None, combine=True): """ Starts the OP2 file reading Parameters ---------- op2_filename : str (default=None -> popup) the op2_filename combine : bool; default=True True : objects are isubcase based False : objects are (isubcase, subtitle) based; will be used for superelements regardless of the option """ assert self.ask in [True, False], self.ask self.is_vectorized = True self.log.debug('combine=%s' % combine) self.log.debug('-------- reading op2 with read_mode=1 --------') self.read_mode = 1 self._close_op2 = False # get GUI object names, build objects, but don't read data OP2_Scalar.read_op2(self, op2_filename=op2_filename) # TODO: stuff to figure out objects # TODO: stuff to show gui of table names # TODO: clear out objects the user doesn't want self.read_mode = 2 self._close_op2 = True self.log.debug('-------- reading op2 with read_mode=2 --------') OP2_Scalar.read_op2(self, op2_filename=self.op2_filename) self.combine_results(combine=combine) self.log.info('finished reading op2')
def read_op2( self, op2_filename=None, combine=True, build_dataframe=None, skip_undefined_matrices=False, encoding=None ): """ Starts the OP2 file reading Parameters ---------- op2_filename : str (default=None -> popup) the op2_filename combine : bool; default=True True : objects are isubcase based False : objects are (isubcase, subtitle) based; will be used for superelements regardless of the option build_dataframe : bool (default=None -> True if in iPython, False otherwise) builds a pandas DataFrame for op2 objects skip_undefined_matrices : bool; default=False True : prevents matrix reading crashes encoding : str the unicode encoding (default=None; system default) """ if build_dataframe is None: build_dataframe = False if ipython_info(): build_dataframe = True if encoding is None: encoding = sys.getdefaultencoding() self.encoding = encoding self.skip_undefined_matrices = skip_undefined_matrices assert self.ask in [True, False], self.ask self.is_vectorized = True self.log.debug("combine=%s" % combine) self.log.debug("-------- reading op2 with read_mode=1 (array sizing) --------") self.read_mode = 1 self._close_op2 = False # get GUI object names, build objects, but don't read data OP2_Scalar.read_op2(self, op2_filename=op2_filename) # TODO: stuff to figure out objects # TODO: stuff to show gui of table names # TODO: clear out objects the user doesn't want self.read_mode = 2 self._close_op2 = True self.log.debug("-------- reading op2 with read_mode=2 (array filling) --------") OP2_Scalar.read_op2(self, op2_filename=self.op2_filename) self.finalize() if build_dataframe: self.build_dataframe() self.combine_results(combine=combine) self.log.debug("finished reading op2")
def read_op2(self, op2_filename=None, combine=True, build_dataframe=None, skip_undefined_matrices=False, encoding=None): """ Starts the OP2 file reading Parameters ---------- op2_filename : str (default=None -> popup) the op2_filename combine : bool; default=True True : objects are isubcase based False : objects are (isubcase, subtitle) based; will be used for superelements regardless of the option build_dataframe : bool (default=None -> True if in iPython, False otherwise) builds a pandas DataFrame for op2 objects skip_undefined_matrices : bool; default=False True : prevents matrix reading crashes encoding : str the unicode encoding (default=None; system default) """ if build_dataframe is None: build_dataframe = False if ipython_info(): build_dataframe = True if encoding is None: encoding = sys.getdefaultencoding() self.encoding = encoding self.skip_undefined_matrices = skip_undefined_matrices assert self.ask in [True, False], self.ask self.is_vectorized = True self.log.debug('combine=%s' % combine) self.log.debug('-------- reading op2 with read_mode=1 (array sizing) --------') self.read_mode = 1 self._close_op2 = False # get GUI object names, build objects, but don't read data OP2_Scalar.read_op2(self, op2_filename=op2_filename) # TODO: stuff to figure out objects # TODO: stuff to show gui of table names # TODO: clear out objects the user doesn't want self.read_mode = 2 self._close_op2 = True self.log.debug('-------- reading op2 with read_mode=2 (array filling) --------') OP2_Scalar.read_op2(self, op2_filename=self.op2_filename) self.finalize() if build_dataframe: self.build_dataframe() self.create_objects_from_matrices() self.combine_results(combine=combine) self.log.debug('finished reading op2')
def __init__(self, debug=True, log=None, debug_file=None, mode='msc'): """ Initializes the OP2 object :param debug: enables the debug log and sets the debug in the logger (default=False) :param log: a logging object to write debug messages to (.. seealso:: import logging) :param debug_file: sets the filename that will be written to (default=None -> no debug) """ self.set_mode(mode) make_geom = False assert make_geom == False, make_geom OP2_Scalar.__init__(self, debug=debug, log=log, debug_file=debug_file) self.ask = False
def read_op2(self, op2_filename=None, vectorized=True, combine=True): """ Starts the OP2 file reading :param op2_filename: the op2_filename (default=None -> popup) :param vectorized: should the vectorized objects be used (default=True) :param combine: should objects be isubcase based (True) or (isubcase, subtitle) based (False) The second will be used for superelements regardless of the option (default=True) """ self.log.debug('vectorized=%s combine=%s' % (vectorized, combine)) assert self.ask in [True, False], self.ask self.is_vectorized = vectorized if self.is_vectorized: self.log.info('-------- reading op2 with read_mode=1 --------') self.read_mode = 1 self._close_op2 = False # get GUI object names, build objects, but don't read data OP2_Scalar.read_op2(self, op2_filename=op2_filename) # TODO: stuff to figure out objects # TODO: stuff to show gui of table names # TODO: clear out objects the user doesn't want self.read_mode = 2 self._close_op2 = True self.log.info('-------- reading op2 with read_mode=2 --------') OP2_Scalar.read_op2(self, op2_filename=self.op2_filename) else: self.read_mode = 0 self._close_op2 = True OP2_Scalar.read_op2(self, op2_filename=op2_filename) self.combine_results(combine=combine) self.log.info('finished reading op2')
def __init__(self, debug=True, log=None, debug_file=None, mode='msc'): """ Initializes the OP2 object Parameters ---------- debug : bool; default=False enables the debug log and sets the debug in the logger log : Log() a logging object to write debug messages to (.. seealso:: import logging) debug_file : str; default=None (No debug) sets the filename that will be written to """ self.set_mode(mode) make_geom = False assert make_geom == False, make_geom OP2_Scalar.__init__(self, debug=debug, log=log, debug_file=debug_file) self.ask = False
def __init__(self, debug=True, log=None, debug_file=None, mode='msc'): """ Initializes the OP2 object Parameters ---------- debug : bool; default=False enables the debug log and sets the debug in the logger log : Log() a logging object to write debug messages to (.. seealso:: import logging) debug_file : str; default=None (No debug) sets the filename that will be written to mode : str; default='msc' {msc, nx} """ self.encoding = None self.set_mode(mode) make_geom = False assert make_geom == False, make_geom OP2_Scalar.__init__(self, debug=debug, log=log, debug_file=debug_file) self.ask = False