예제 #1
0
class File(object):
    """Basic class that describes elements of a DataSet
    
    [description]
    """
    def __init__(self,
                 file_name="",
                 file_type=None,
                 parent_dataset=None,
                 axarr=None):
        """
        **Constructor**
        
        [description]
        
        Keyword Arguments:
            - file_name {str} -- Full path
            - file_type {[type]} -- [description] (default: {None})
            - parent_dataset {[type]} -- [description] (default: {None})
            - axarr {[type]} -- [description] (default: {None})
        """
        self.file_full_path = os.path.abspath(file_name)
        tmpname = os.path.basename(self.file_full_path)
        self.file_name_short = os.path.splitext(tmpname)[0]
        self.file_type = file_type
        self.parent_dataset = parent_dataset
        self.axarr = axarr

        #plot attributes
        self.marker = None
        self.color = None
        self.filled = None
        self.size = None

        # Shift variables
        self.isshifted = [False] * DataTable.MAX_NUM_SERIES
        self.xshift = [0] * DataTable.MAX_NUM_SERIES
        self.yshift = [0] * DataTable.MAX_NUM_SERIES

        self.header_lines = []
        self.file_parameters = {}
        self.active = True
        self.data_table = DataTable(axarr, self.file_name_short)
        # extra theory xrange
        self.with_extra_x = False
        self.theory_xmin = "None"
        self.theory_xmax = "None"
        self.theory_logspace = True
        self.th_num_pts = 10  # number of points
        self.nextramin = 0
        self.nextramax = 0

    def __str__(self):
        """[summary]
        
        [description]
        """
        return '%s: %s' % (self.file_full_path, self.file_parameters)

    def mincol(self, col):
        """Minimum value in data_table column col
        [description]

        """
        return self.data_table.mincol(col)

    def minpositivecol(self, col):
        """Minimum positive value in data_table column col
        [description]

        """
        return self.data_table.minpositivecol(col)

    def maxcol(self, col):
        """Maximum value in data_table column col
        [description]

        """
        return self.data_table.maxcol(col)