コード例 #1
0
ファイル: VolumeCanvas.py プロジェクト: diffpy/srfit-sasview
    def _create_modelObject(self):
        """
            Create the simulation model obejct from the list
            of shapes.
            
            This method needs to be called each time a parameter
            changes because of the way the underlying library
            was (badly) written. It is impossible to change a 
            parameter, or remove a shape without having to 
            refill the space points.
            
            TODO: improve that.
        """
        # To find a complete example of the correct call order:
        # In LORES2, in actionclass.py, method CalculateAction._get_iq()
        
        # If there are not shapes, do nothing
        if len(self.shapes) == 0:
            self._model_changed()
            return 0
        
        # generate space filling points from shape list
        self._createVolumeFromList()

        self.points = pointsmodelpy.new_point3dvec()

        pointsmodelpy.complexmodel_add(self.complex_model, 
                                        self.lores_model, "LORES")
        for shape in self.shapes:
            if self.shapes[shape].params['is_lores'] == False:
                pointsmodelpy.complexmodel_add(self.complex_model, 
                    self.shapes[shape].shapeObject, "PDB")
        
        #pointsmodelpy.get_lorespoints(self.lores_model, self.points)
        self.npts = pointsmodelpy.get_complexpoints(self.complex_model, self.points)
コード例 #2
0
    def getPr(self):
        """
            Calculate P(r) from the objects on the canvas.
            This method should always be called after the shapes
            on the VolumeCanvas have changed.
            
            @return: calculation output flag 
        """
        # To find a complete example of the correct call order:
        # In LORES2, in actionclass.py, method CalculateAction._get_iq()

        # If there are not shapes, do nothing
        if len(self.shapes) == 0:
            self._model_changed()
            return 0

        # generate space filling points from shape list
        self._createVolumeFromList()

        self.points = pointsmodelpy.new_point3dvec()

        pointsmodelpy.complexmodel_add(self.complex_model, self.lores_model,
                                       "LORES")
        for shape in self.shapes:
            if self.shapes[shape].params['is_lores'] == False:
                pointsmodelpy.complexmodel_add(self.complex_model,
                                               self.shapes[shape].shapeObject,
                                               "PDB")

        #pointsmodelpy.get_lorespoints(self.lores_model, self.points)
        self.npts = pointsmodelpy.get_complexpoints(self.complex_model,
                                                    self.points)

        # expecting the rmax is a positive float or 0. The maximum distance.
        #rmax = pointsmodelpy.get_lores_pr(self.lores_model, self.points)

        rmax = pointsmodelpy.get_complex_pr(self.complex_model, self.points)
        self.hasPr = True

        return rmax
コード例 #3
0
ファイル: VolumeCanvas.py プロジェクト: diffpy/srfit-sasview
    def getPr(self):
        """
            Calculate P(r) from the objects on the canvas.
            This method should always be called after the shapes
            on the VolumeCanvas have changed.
            
            @return: calculation output flag 
        """
        # To find a complete example of the correct call order:
        # In LORES2, in actionclass.py, method CalculateAction._get_iq()
        
        # If there are not shapes, do nothing
        if len(self.shapes) == 0:
            self._model_changed()
            return 0
        
        # generate space filling points from shape list
        self._createVolumeFromList()

        self.points = pointsmodelpy.new_point3dvec()

        pointsmodelpy.complexmodel_add(self.complex_model, 
                                        self.lores_model, "LORES")
        for shape in self.shapes:
            if self.shapes[shape].params['is_lores'] == False:
                pointsmodelpy.complexmodel_add(self.complex_model, 
                    self.shapes[shape].shapeObject, "PDB")
        
        #pointsmodelpy.get_lorespoints(self.lores_model, self.points)
        self.npts = pointsmodelpy.get_complexpoints(self.complex_model, self.points)
        
        # expecting the rmax is a positive float or 0. The maximum distance.
        #rmax = pointsmodelpy.get_lores_pr(self.lores_model, self.points)   
         
        rmax = pointsmodelpy.get_complex_pr(self.complex_model, self.points) 
        self.hasPr = True   

        return rmax
コード例 #4
0
    def _create_modelObject(self):
        """
            Create the simulation model obejct from the list
            of shapes.
            
            This method needs to be called each time a parameter
            changes because of the way the underlying library
            was (badly) written. It is impossible to change a 
            parameter, or remove a shape without having to 
            refill the space points.
            
            TODO: improve that.
        """
        # To find a complete example of the correct call order:
        # In LORES2, in actionclass.py, method CalculateAction._get_iq()

        # If there are not shapes, do nothing
        if len(self.shapes) == 0:
            self._model_changed()
            return 0

        # generate space filling points from shape list
        self._createVolumeFromList()

        self.points = pointsmodelpy.new_point3dvec()

        pointsmodelpy.complexmodel_add(self.complex_model, self.lores_model,
                                       "LORES")
        for shape in self.shapes:
            if self.shapes[shape].params['is_lores'] == False:
                pointsmodelpy.complexmodel_add(self.complex_model,
                                               self.shapes[shape].shapeObject,
                                               "PDB")

        #pointsmodelpy.get_lorespoints(self.lores_model, self.points)
        self.npts = pointsmodelpy.get_complexpoints(self.complex_model,
                                                    self.points)