def build_plot(self, usePCA): import pylab self.normaliser = MorphologyForRenderingOperator(self.morph, usePCA=usePCA) # Find the Point that is the furthest distance way from # the centre when the cell is centred and rotated: rotator = lambda s: self.normaliser(s.get_distal_npa3()) rotated_section_dict = DictBuilderSectionVisitorHomo(morph=self.morph, functor=rotator)() # Add in the parents manually: dummy_scetion = self.morph._dummysection rotated_section_dict[dummy_scetion] = self.normaliser(dummy_scetion.get_distal_npa3()) max_axis = max([numpy.linalg.norm(rotated_section_pt) for rotated_section_pt in rotated_section_dict.values()]) plot_lims = (max_axis * -1.1, max_axis * 1.1) max_x = max([numpy.fabs(rotated_section_pt[0]) for rotated_section_pt in rotated_section_dict.values()]) max_y = max([numpy.fabs(rotated_section_pt[1]) for rotated_section_pt in rotated_section_dict.values()]) max_z = max([numpy.fabs(rotated_section_pt[2]) for rotated_section_pt in rotated_section_dict.values()]) maxes = [max_x, max_y, max_z] # allMax = max(maxes) for i in self.plot_views: maxes[i] = maxes[i] + 0.2 * max([max_x, max_y, max_z]) self.fig = pylab.figure(**self.fig_kwargs) # figsize=(7, 7)) self.fig.subplots_adjust(left=0.05, top=0.95, right=0.95, bottom=0.05, wspace=0.15, hspace=0.15) self.subplots = {} for i in self.plot_views: self.subplots[i] = self.build_draw_sub_plot(rotated_section_dict, self.fig, i, plot_lims)
def buildPlot(self, usePCA): import pylab self.normaliser = MorphologyForRenderingOperator(self.morph, usePCA=usePCA) # Find the Point that is the furthest distance way from # the centre when the cell is centred and rotated: rotator = lambda s: self.normaliser(s.getDistalNPA3()) rotatedSectionDict = DictBuilderSectionVisitorHomo(morph=self.morph, functor=rotator ) () # Add in the parents manually: p = self.morph._dummysection rotatedSectionDict[ p ] = self.normaliser( p.getDistalNPA3() ) maxAxis = max([ numpy.linalg.norm(rs) for rs in rotatedSectionDict.values() ]) plotLims = (maxAxis * -1.1, maxAxis * 1.1) maxX = max([ numpy.fabs(rs[0]) for rs in rotatedSectionDict.values() ]) maxY = max([ numpy.fabs(rs[1]) for rs in rotatedSectionDict.values() ]) maxZ = max([ numpy.fabs(rs[2]) for rs in rotatedSectionDict.values() ]) maxes = [maxX, maxY, maxZ] #allMax = max(maxes) for i in self.plotViews: maxes[i] = maxes[i] + 0.2 * max([maxX, maxY, maxZ]) self.fig = pylab.figure(figsize=(7, 7)) self.fig.subplots_adjust(left=0.05, top=0.95, right=0.95, bottom=0.05, wspace=0.1, hspace=0.1) self.subplots = {} for i in self.plotViews: self.subplots[i] = self.buildDrawSubPlot(rotatedSectionDict, self.fig, i, plotLims)
def build_plot(self, usePCA): import pylab self.normaliser = MorphologyForRenderingOperator(self.morph, usePCA=usePCA) # Find the Point that is the furthest distance way from # the centre when the cell is centred and rotated: rotator = lambda s: self.normaliser(s.get_distal_npa3()) rotated_section_dict = DictBuilderSectionVisitorHomo(morph=self.morph, functor=rotator)() # Add in the parents manually: dummy_scetion = self.morph._dummysection rotated_section_dict[dummy_scetion] = self.normaliser( dummy_scetion.get_distal_npa3()) max_axis = max([ numpy.linalg.norm(rotated_section_pt) for rotated_section_pt in rotated_section_dict.values() ]) plot_lims = (max_axis * -1.1, max_axis * 1.1) max_x = max([ numpy.fabs(rotated_section_pt[0]) for rotated_section_pt in rotated_section_dict.values() ]) max_y = max([ numpy.fabs(rotated_section_pt[1]) for rotated_section_pt in rotated_section_dict.values() ]) max_z = max([ numpy.fabs(rotated_section_pt[2]) for rotated_section_pt in rotated_section_dict.values() ]) maxes = [max_x, max_y, max_z] # allMax = max(maxes) for i in self.plot_views: maxes[i] = maxes[i] + 0.2 * max([max_x, max_y, max_z]) self.fig = pylab.figure(**self.fig_kwargs) #figsize=(7, 7)) self.fig.subplots_adjust( left=0.05, top=0.95, right=0.95, bottom=0.05, wspace=0.15, hspace=0.15, ) self.subplots = {} for i in self.plot_views: self.subplots[i] = self.build_draw_sub_plot( rotated_section_dict, self.fig, i, plot_lims)