Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/sasview_model.py

    r3a1afed r5024a56  
    695695            return self._calculate_Iq(qx, qy) 
    696696 
    697     def _calculate_Iq(self, qx, qy=None): 
     697    def _calculate_Iq(self, qx, qy=None, Fq=False, effective_radius_type=1): 
    698698        if self._model is None: 
    699699            self._model = core.build_model(self._model_info) 
     
    715715        #print("values", values) 
    716716        #print("is_mag", is_magnetic) 
     717        if Fq: 
     718            result = calculator.Fq(call_details, values, cutoff=self.cutoff, 
     719                                   magnetic=is_magnetic, 
     720                                   effective_radius_type=effective_radius_type) 
    717721        result = calculator(call_details, values, cutoff=self.cutoff, 
    718722                            magnetic=is_magnetic) 
     
    732736        Calculate the effective radius for P(q)*S(q) 
    733737 
    734         *mode* is the R_eff type, which defaults to 1 to match the ER 
    735         calculation for sasview models from version 3.x. 
    736  
    737738        :return: the value of the effective radius 
    738739        """ 
    739         # ER and VR are only needed for old multiplication models, based on 
    740         # sas.sascalc.fit.MultiplicationModel.  Fail for now.  If we want to 
    741         # continue supporting them then add some test cases so that the code 
    742         # is exercised.  We can access ER/VR using the kernel Fq function by 
    743         # extending _calculate_Iq so that it calls: 
    744         #    if er_mode > 0: 
    745         #        res = calculator.Fq(call_details, values, cutoff=self.cutoff, 
    746         #                            magnetic=False, effective_radius_type=mode) 
    747         #        R_eff, form_shell_ratio = res[2], res[4] 
    748         #        return R_eff, form_shell_ratio 
    749         # Then use the following in calculate_ER: 
    750         #    ER, VR = self._calculate_Iq(q=[0.1], er_mode=mode) 
    751         #    return ER 
    752         # Similarly, for calculate_VR: 
    753         #    ER, VR = self._calculate_Iq(q=[0.1], er_mode=1) 
    754         #    return VR 
    755         # Obviously a combined calculate_ER_VR method would be better, but 
    756         # we only need them to support very old models, so ignore the 2x 
    757         # performance hit. 
    758         raise NotImplementedError("ER function is no longer available.") 
     740        Fq = self._calculate_Iq([0.1], True, mode) 
     741        return Fq[2] 
    759742 
    760743    def calculate_VR(self): 
     
    765748        :return: the value of the form:shell volume ratio 
    766749        """ 
    767         # See comments in calculate_ER. 
    768         raise NotImplementedError("VR function is no longer available.") 
     750        Fq = self._calculate_Iq([0.1], True, mode) 
     751        return Fq[4] 
    769752 
    770753    def set_dispersion(self, parameter, dispersion): 
Note: See TracChangeset for help on using the changeset viewer.