lib/transient.py
def import_file(self, filepath, cleanData=True, key_parameter=None, description=None, silent=True, **kwargs):
        """
        Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.
        :param filepath
            path to file
        :param cleanData:
            run the cleanData method, including fltering, baseline removal, setting timezero and others.
        :param key_parameter
            sets the key parameter
        :param description
            brief description of this transient, for file naming
        :param silent
            if true, doesnt print anything, set to False for debugging
        :param **kwargs
            all keyord args passed are set as attributes of this class instance. (use to overwrite parameters.

        """

        try:  # if it finds the file requested...
            ext = os.path.splitext(filepath)[-1].lower()
            basename = os.path.basename(filepath)
            if ext == '.mat':
                try:
                    self.import_file_mat(filepath)
                except TypeError:
                    print('Ignored incorrect matlab file: {}'.format(filepath))
                #
                # if basename.lower() != 't-cal.mat':
                #     self.import_file_mat(filepath)
                # else:
                #     print('Ignored t-cal.mat')
            elif ext == '.txt':
                self.import_file_csv(filepath)
            else:
                print("Invalid format. Couldn't import file: " + filepath)
            # self.importMetadata()
            if key_parameter is not None:
                self.key_parameter = key_parameter
            if description is not None:
                self.description = description
            self.give_name()

            for attr,val in kwargs:
                setattr(self,attr,val)

            if not silent:
                print('Imported {0} as {1}'.format(basename, self.name))
            if cleanData and len(self.raw_time) != 0:
                self.clean_data()
        except TypeError as err:
            print(err)

        except FileNotFoundError:
            print('File ' + filepath + ' not found')

        Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.
        :param filepath
            path to file
        :param cleanData:
            run the cleanData method, including fltering, baseline removal, setting timezero and others.
        :param key_parameter
            sets the key parameter
        :param description
            brief description of this transient, for file naming
        :param silent
            if true, doesnt print anything, set to False for debugging
        :param **kwargs
            all keyord args passed are set as attributes of this class instance. (use to overwrite parameters.

        
Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.
:param filepath
path to file
:param cleanData:
run the cleanData method, including fltering, baseline removal, setting timezero and others.
:param key_parameter
sets the key parameter
:param description
brief description of this transient, for file naming
:param silent
if true, doesnt print anything, set to False for debugging
:param **kwargs
all keyord args passed are set as attributes of this class instance. (use to overwrite parameters.
Imports a file . mat or . csv using self . import_file_mat () and self . import_file_csv methods respectively . : param filepath path to file : param cleanData : run the cleanData method including fltering baseline removal setting timezero and others . : param key_parameter sets the key parameter : param description brief description of this transient for file naming : param silent if true doesnt print anything set to False for debugging : param ** kwargs all keyord args passed are set as attributes of this class instance . ( use to overwrite parameters .
def import_file(self, filepath, cleanData=True, key_parameter=None, description=None, silent=True, **kwargs):
        try:  
            ext = os.path.splitext(filepath)[-1].lower()
            basename = os.path.basename(filepath)
            if ext == '.mat':
                try:
                    self.import_file_mat(filepath)
                except TypeError:
                    print('Ignored incorrect matlab file: {}'.format(filepath))
                 if basename.lower() != 't-cal.mat':
                     self.import_file_mat(filepath)
                 else:
                     print('Ignored t-cal.mat')
            elif ext == '.txt':
                self.import_file_csv(filepath)
            else:
                print("Invalid format. Couldn't import file: " + filepath)
             self.importMetadata()
            if key_parameter is not None:
                self.key_parameter = key_parameter
            if description is not None:
                self.description = description
            self.give_name()
            for attr,val in kwargs:
                setattr(self,attr,val)
            if not silent:
                print('Imported {0} as {1}'.format(basename, self.name))
            if cleanData and len(self.raw_time) != 0:
                self.clean_data()
        except TypeError as err:
            print(err)
        except FileNotFoundError:
            print('File ' + filepath + ' not found')
def import_file ( self , filepath , cleanData = True , key_parameter = None , description = None , silent = True , ** kwargs ) : try : ext = os . path . splitext ( filepath ) [ - 1 ] . lower ( ) basename = os . path . basename ( filepath ) if ext == '.mat' : try : self . import_file_mat ( filepath ) except TypeError : print ( 'Ignored incorrect matlab file: {}' . format ( filepath ) ) elif ext == '.txt' : self . import_file_csv ( filepath ) else : print ( "Invalid format. Couldn't import file: " + filepath ) if key_parameter is not None : self . key_parameter = key_parameter if description is not None : self . description = description self . give_name ( ) for attr , val in kwargs : setattr ( self , attr , val ) if not silent : print ( 'Imported {0} as {1}' . format ( basename , self . name ) ) if cleanData and len ( self . raw_time ) != 0 : self . clean_data ( ) except TypeError as err : print ( err ) except FileNotFoundError : print ( 'File ' + filepath + ' not found' )
Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.
Imports a file . mat or . csv using self . import_file_mat () and self . import_file_csv methods respectively .
"""
        Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.
        :param filepath
            path to file
        :param cleanData:
            run the cleanData method, including fltering, baseline removal, setting timezero and others.
        :param key_parameter
            sets the key parameter
        :param description
            brief description of this transient, for file naming
        :param silent
            if true, doesnt print anything, set to False for debugging
        :param **kwargs
            all keyord args passed are set as attributes of this class instance. (use to overwrite parameters.

        """ # if it finds the file requested... # # if basename.lower() != 't-cal.mat': #     self.import_file_mat(filepath) # else: #     print('Ignored t-cal.mat') # self.importMetadata()
self
filepath
cleanData
key_parameter
description
silent