def _repr_html_(self): if not has_ipy_table: return "Please install ipy_table." if self.is_axis_aligned(): type = 'axis aligned' elif self.is_affine(): type = 'affine' elif self.is_uniform(): type = 'uniform' else: type = '' if type!='': type = " (%s)"%type s = "Grid%dD %s: "%(int(self.ndim),type) def pretty(list): return str(['{0:.2f}'.format(flt) for flt in list]) table_data = [[s,'','','','','',''], ['space','shape','min','max','span','center','spread'], [str(self.space), pretty(self.shape) ,pretty(self.min()) ,pretty(self.max()) ,pretty(self.span()) ,pretty(self.center()) ,pretty(self.mean_dist_from_center())], ] table = ipy_table.make_table(table_data) table = ipy_table.apply_theme('basic') table = ipy_table.set_cell_style(0,0, column_span=7) table = ipy_table.set_cell_style(0,0, align='center') table = ipy_table.set_row_style(1, color='#F7F7F7') table = ipy_table.set_row_style(2, color='#F7F7F7') table = ipy_table.set_row_style(0,color='#CCFF99') table = ipy_table.set_row_style(1, bold = True) table = ipy_table.set_row_style(1, align = 'center') table = ipy_table.set_global_style(float_format="%3.3f") s = table._repr_html_() return s
def _repr_html_(self): if not has_ipy_table: return "Please install ipy_table." table_data = [ ['bla ',1], ['blabla',2], ] table = ipy_table.make_table(table_data) table = ipy_table.apply_theme('basic_left') table = ipy_table.set_global_style(float_format="%3.3f") return table._repr_html_()
def _repr_html_(self): if not has_ipy_table: return "Please install ipy_table." table_data = [ ['bla ', 1], ['blabla', 2], ] table = ipy_table.make_table(table_data) table = ipy_table.apply_theme('basic_left') table = ipy_table.set_global_style(float_format="%3.3f") return table._repr_html_()
def _repr_html_(self): #FIXME: add angles_axial and angles_azimuthal if not has_ipy_table: return "Please install ipy_table." table_data = [['N_axial', self.N_axial], ['N_azimuthal', self.N_azimuthal], ['Size_u', self.size_u], ['Size_v', self.size_v], ['N_u', self.N_u], ['N_v', self.N_v]] N_per_row = 12 for i in range(len(self.angles_azimuthal) / N_per_row + 1): i_start = i * N_per_row i_end = (i + 1) * N_per_row if i_end >= len(self.angles_azimuthal): i_end = len(self.angles_azimuthal) if i == 0: table_data.append([ "Angles_azimuthal [deg]", array_to_string( rad_to_deg(self.angles_azimuthal[i_start:i_end]), "%3.4f ") ]) else: table_data.append([ "", array_to_string( rad_to_deg(self.angles_azimuthal[i_start:i_end]), "%3.4f ") ]) i_start = 0 i_end = len(self.angles_axial) - 1 if i_end - i_start >= 4: table_data.append([ "Angles_axial [deg]", str(rad_to_deg(self.angles_axial[i_start])) + " " + str(rad_to_deg(self.angles_axial[i_start + 1])) + " ... " + str(rad_to_deg(self.angles_axial[i_end - 1])) + " " + str(rad_to_deg(self.angles_axial[i_end])), ]) table = ipy_table.make_table(table_data) table = ipy_table.apply_theme('basic_left') #table = ipy_table.set_column_style(0, color='lightBlue') table = ipy_table.set_global_style(float_format="%3.3f") return table._repr_html_()
def _repr_html_(self): if not has_ipy_table: return "Please install ipy_table." s = 'Transformation' table_data = [[s,'','','','','',''], ['map_from','map_to','determinant','is_rigid','is_6DOF','is_rotation','is_translation'], [self.map_from, self.map_to, str(self.determinant()), self.is_rigid(), self.is_6DOF(), self.is_rotation(), self.is_translation() ], ] table = ipy_table.make_table(table_data) table = ipy_table.apply_theme('basic') table = ipy_table.set_cell_style(0,0, column_span=7) table = ipy_table.set_cell_style(0,0, align='center') table = ipy_table.set_row_style(1, color='#F7F7F7') table = ipy_table.set_row_style(2, color='#F7F7F7') table = ipy_table.set_row_style(0, color='#FFFF99') table = ipy_table.set_row_style(1, bold = True) table = ipy_table.set_row_style(1, align = 'center') table = ipy_table.set_row_style(1, height = 30) table = ipy_table.set_global_style(float_format="%3.3f") table2 = ipy_table.make_table(self.data) table3 = ipy_table.make_table([' ']) table3 = ipy_table.set_row_style(0, no_border='all') s = '<div><style>table {float: left; margin-right:10px;}</style> %s %s %s </div>'%( table._repr_html_(), table3._repr_html_() ,table2._repr_html_() ) return s
def _repr_html_(self): #FIXME: add angles_axial and angles_azimuthal if not has_ipy_table: return "Please install ipy_table." table_data = [['N_axial',self.N_axial],['N_azimuthal',self.N_azimuthal],['Size_u',self.size_u],['Size_v',self.size_v],['N_u',self.N_u],['N_v',self.N_v]] N_per_row = 12 for i in range(len(self.angles_azimuthal)/N_per_row+1): i_start = i*N_per_row i_end = (i+1)*N_per_row if i_end>=len(self.angles_azimuthal): i_end=len(self.angles_azimuthal) if i==0: table_data.append([ "Angles_azimuthal [deg]", array_to_string(rad_to_deg(self.angles_azimuthal[i_start:i_end]),"%3.4f ") ]) else: table_data.append([ "", array_to_string(rad_to_deg(self.angles_azimuthal[i_start:i_end]),"%3.4f ") ]) i_start=0 i_end =len(self.angles_axial)-1 if i_end-i_start >= 4: table_data.append([ "Angles_axial [deg]", str(rad_to_deg(self.angles_axial[i_start]))+" "+str(rad_to_deg(self.angles_axial[i_start+1]))+" ... "+str(rad_to_deg(self.angles_axial[i_end-1]))+" "+str(rad_to_deg(self.angles_axial[i_end])), ]) table = ipy_table.make_table(table_data) table = ipy_table.apply_theme('basic_left') #table = ipy_table.set_column_style(0, color='lightBlue') table = ipy_table.set_global_style(float_format="%3.3f") return table._repr_html_()