libplanarradpy/planrad.py
def read_pr_report(self, filename):
        """Reads in a PlanarRad generated report

        Saves the single line reported parameters as a python dictionary

        :param filename: The name and path of the PlanarRad generated file
        :returns self.data_dictionary: python dictionary with the key and values from the report
        """
        done = False
        f = open(filename)
        while f:
        #for line in open(filename):
            line = f.readline()
            if not line:
                done = True
                break

            if "# Quad solid angle mean point theta table (rows are horizontal, columns are vertical):" in line.strip():
                # read in the bunch of lines.
                tmp = []
                for i_iter in range(0, len(self.data_dictionary['theta_points_deg']) - 2):
                    tmp.append(f.readline())

                self.data_dictionary['Quad_solid_angle_mean_point_theta'] = tmp

            elif '#' not in line or not line.strip():
                element = line.split(',')
                self.data_dictionary[element[0]] = element[1:]

            if "# Quad solid angle mean point phi table (rows are horizontal, columns are vertical):" in line.strip():
                # read in the bunch of lines.
                tmp = []
                for i_iter in range(0, len(self.data_dictionary['theta_points_deg']) - 2):
                    tmp.append(f.readline())

                self.data_dictionary['Quad_solid_angle_mean_point_phi'] = tmp

            elif '#' not in line or not line.strip():
                element = line.split(',')
                self.data_dictionary[element[0]] = element[1:]

            if "L_w band" in line.strip():

                for i_iter in range(0, int(self.data_dictionary['band_count'][1])):
                    tmp = []
                    for j_iter in range(0, len(self.data_dictionary['theta_points_deg']) - 2):
                        tmp.append(f.readline())

                    self.data_dictionary['L_w_band_' + str(i_iter + 1)] = tmp
                    f.readline()
                    f.readline()  # skip the next 2 lines

            if "L_it band" in line.strip():

                for i_iter in range(0, int(self.data_dictionary['band_count'][1])):
                    tmp = []
                    for j_iter in range(0, len(self.data_dictionary['theta_points_deg']) - 2):
                        tmp.append(f.readline())

                    self.data_dictionary['L_it_band_' + str(i_iter + 1)] = tmp
                    f.readline()
                    f.readline()  # skip the next 2 lines




        return self.data_dictionary
def read_pr_report(self, filename):
        done = False
        f = open(filename)
        while f:
        #for line in open(filename):
            line = f.readline()
            if not line:
                done = True
                break

            if "# Quad solid angle mean point theta table (rows are horizontal, columns are vertical):" in line.strip():
                # read in the bunch of lines.
                tmp = []
                for i_iter in range(0, len(self.data_dictionary['theta_points_deg']) - 2):
                    tmp.append(f.readline())

                self.data_dictionary['Quad_solid_angle_mean_point_theta'] = tmp

            elif '#' not in line or not line.strip():
                element = line.split(',')
                self.data_dictionary[element[0]] = element[1:]

            if "# Quad solid angle mean point phi table (rows are horizontal, columns are vertical):" in line.strip():
                # read in the bunch of lines.
                tmp = []
                for i_iter in range(0, len(self.data_dictionary['theta_points_deg']) - 2):
                    tmp.append(f.readline())

                self.data_dictionary['Quad_solid_angle_mean_point_phi'] = tmp

            elif '#' not in line or not line.strip():
                element = line.split(',')
                self.data_dictionary[element[0]] = element[1:]

            if "L_w band" in line.strip():

                for i_iter in range(0, int(self.data_dictionary['band_count'][1])):
                    tmp = []
                    for j_iter in range(0, len(self.data_dictionary['theta_points_deg']) - 2):
                        tmp.append(f.readline())

                    self.data_dictionary['L_w_band_' + str(i_iter + 1)] = tmp
                    f.readline()
                    f.readline()  # skip the next 2 lines

            if "L_it band" in line.strip():

                for i_iter in range(0, int(self.data_dictionary['band_count'][1])):
                    tmp = []
                    for j_iter in range(0, len(self.data_dictionary['theta_points_deg']) - 2):
                        tmp.append(f.readline())

                    self.data_dictionary['L_it_band_' + str(i_iter + 1)] = tmp
                    f.readline()
                    f.readline()  # skip the next 2 lines




        return self.data_dictionary
def read_pr_report ( self , filename ) : done = False f = open ( filename ) while f : #for line in open(filename): line = f . readline ( ) if not line : done = True break if "# Quad solid angle mean point theta table (rows are horizontal, columns are vertical):" in line . strip ( ) : # read in the bunch of lines. tmp = [ ] for i_iter in range ( 0 , len ( self . data_dictionary [ 'theta_points_deg' ] ) - 2 ) : tmp . append ( f . readline ( ) ) self . data_dictionary [ 'Quad_solid_angle_mean_point_theta' ] = tmp elif '#' not in line or not line . strip ( ) : element = line . split ( ',' ) self . data_dictionary [ element [ 0 ] ] = element [ 1 : ] if "# Quad solid angle mean point phi table (rows are horizontal, columns are vertical):" in line . strip ( ) : # read in the bunch of lines. tmp = [ ] for i_iter in range ( 0 , len ( self . data_dictionary [ 'theta_points_deg' ] ) - 2 ) : tmp . append ( f . readline ( ) ) self . data_dictionary [ 'Quad_solid_angle_mean_point_phi' ] = tmp elif '#' not in line or not line . strip ( ) : element = line . split ( ',' ) self . data_dictionary [ element [ 0 ] ] = element [ 1 : ] if "L_w band" in line . strip ( ) : for i_iter in range ( 0 , int ( self . data_dictionary [ 'band_count' ] [ 1 ] ) ) : tmp = [ ] for j_iter in range ( 0 , len ( self . data_dictionary [ 'theta_points_deg' ] ) - 2 ) : tmp . append ( f . readline ( ) ) self . data_dictionary [ 'L_w_band_' + str ( i_iter + 1 ) ] = tmp f . readline ( ) f . readline ( ) # skip the next 2 lines if "L_it band" in line . strip ( ) : for i_iter in range ( 0 , int ( self . data_dictionary [ 'band_count' ] [ 1 ] ) ) : tmp = [ ] for j_iter in range ( 0 , len ( self . data_dictionary [ 'theta_points_deg' ] ) - 2 ) : tmp . append ( f . readline ( ) ) self . data_dictionary [ 'L_it_band_' + str ( i_iter + 1 ) ] = tmp f . readline ( ) f . readline ( ) # skip the next 2 lines return self . data_dictionary
Reads in a PlanarRad generated report

        Saves the single line reported parameters as a python dictionary

        :param filename: The name and path of the PlanarRad generated file
        :returns self.data_dictionary: python dictionary with the key and values from the report
Reads in a PlanarRad generated report