def build_with_map(self, mapfile): this_xplor = xplor_map.reader(mapfile) self.np_on_grid = (this_xplor.gridding.n[0]-1 ) /2 ## this is the np_on_grid stored in xplor map self.np_on_grid = int(self.np_on_grid) self.raw_map = this_xplor.data self.map = flex.double( this_xplor.data.size(), 0) self.id = mapfile.split('.')[0] this_rmax = this_xplor.unit_cell.parameters()[0]/2.0 if(self.rmax is not None and ( self.rmax != this_rmax ) ): # do the scaling grid=build_3d_grid(self.np_on_grid, this_rmax) self.nlm_coefs = get_moments_for_scaled_model( self.raw_map, self.np_on_grid, grid, self.nmax, this_rmax, self.rmax) self.nlm_array = math.nlm_array(self.nmax) self.nlm_array.load_coefs(self.nlm_array.nlm(), self.nlm_coefs ) else: self.rmax = this_rmax print self.rmax,"test" threshold = flex.max( self.raw_map )/3.0 select = flex.bool( this_xplor.data.as_1d() >= threshold ) self.map.set_selected( select, 1) self.ngp = self.map.size() # number of grid point in 3D box self.all_indx = flex.int(range( self.ngp )) self.molecule = self.all_indx.select( select ) self.grid_obj=math.sphere_grid(self.np_on_grid, self.nmax) ss = self.grid_obj.construct_space_sum_via_list( self.molecule.as_1d(), self.map.as_1d() ) self.moment_obj = math.zernike_moments( self.grid_obj, self.nmax ) self.moment_obj.calc_moments( ss.as_1d() ) self.nlm_array = self.moment_obj.moments() self.nlm_coefs = self.nlm_array.coefs()
def load_maps(self, files): # take about 0.5s to load one map, not big deal xplor_file = files[0] this_xplor = xplor_map.reader(xplor_file) self.raw_map = this_xplor.data.as_1d() self.np_on_grid = int((this_xplor.gridding.n[0] - 1) / 2)
def load_maps(self, files): # take about 0.5s to load one map, not big deal xplor_file = files[0] this_xplor = xplor_map.reader(xplor_file) self.raw_map = flex.double( this_xplor.data.size(), 0) threshold = flex.max( this_xplor.data )/4.0 for ii in range( this_xplor.data.size() ): if( this_xplor.data[ii] > threshold ): self.raw_map[ii] = 1 self.np_on_grid = (this_xplor.gridding.n[0]-1 ) /2 for xplor_file in files[1:]: this_xplor = xplor_map.reader(xplor_file) threshold = flex.max( this_xplor.data )/4.0 for ii in range( this_xplor.data.size() ): if( this_xplor.data[ii] > threshold ): self.raw_map[ii] += 1
def load_maps(self, files): # take about 0.5s to load one map, not big deal xplor_file = files[0] this_xplor = xplor_map.reader(xplor_file) self.raw_map = this_xplor.data.as_1d() #self.raw_map = flex.double( this_xplor.data.size(), 0) #threshold = flex.max( this_xplor.data )/4.0 #for ii in range( this_xplor.data.size() ): # if( this_xplor.data[ii] > threshold ): # self.raw_map[ii] = 1 self.np_on_grid = int((this_xplor.gridding.n[0] - 1) / 2)