def __repr__(self): s = "PET Binning: \n" s = s+" - N_axial_bins: %d \n"%self.N_axial s = s+" - N_azimuthal_bins: %d \n"%self.N_azimuthal s = s+" - Size_u: %f \n"%self.size_u s = s+" - Size_v: %f \n"%self.size_v s = s+" - N_u: %d \n"%self.N_u s = s+" - N_v: %d \n"%self.N_v s = s+" - Angles axial: %s \n"%array_to_string(self.angles_axial) s = s+" - Angles azimuthal: %s \n"%array_to_string(self.angles_azimuthal) return s
def __repr__(self): s = "PET Binning: \n" s = s + " - N_axial_bins: %d \n" % self.N_axial s = s + " - N_azimuthal_bins: %d \n" % self.N_azimuthal s = s + " - Size_u: %f \n" % self.size_u s = s + " - Size_v: %f \n" % self.size_v s = s + " - N_u: %d \n" % self.N_u s = s + " - N_v: %d \n" % self.N_v s = s + " - Angles axial: %s \n" % array_to_string( self.angles_axial) s = s + " - Angles azimuthal: %s \n" % array_to_string( self.angles_azimuthal) 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_()
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_()