def onDGSSXResKernel(self, kernel):
        t = kernel

        abs = t.absorption_cross_section
        sctt = t.scattering_cross_section

        if abs is None or sctt is None:
            # need to get cross section from sample assembly representation
            # svn://danse.us/inelastic/sample/.../sampleassembly
            # origin is a node in the sample assembly representation
            #
            # scatterer_origin is assigned to kernel when a kernel is
            # constructed from kernel xml.
            # see sampleassembly_support.SampleAssembly2CompositeScatterer for details.
            origin = t.scatterer_origin
            from sampleassembly import cross_sections

            abs, inc, coh = cross_sections(origin)
            sctt = inc + coh
            pass

        abs, sctt = self._unitsRemover.remove_unit((abs, sctt), 1.0 / units.length.meter)
        target_position = self._unitsRemover.remove_unit(t.target_position, units.length.meter)
        target_radius = self._unitsRemover.remove_unit(t.target_radius, units.length.meter)
        tof_at_target = self._unitsRemover.remove_unit(t.tof_at_target, units.time.second)
        dtof = self._unitsRemover.remove_unit(t.dtof, units.time.second)
        return self.factory.dgssxreskernel(target_position, target_radius, tof_at_target, dtof, abs, sctt)
    def onE_vQ_Kernel(self, kernel):
        t = kernel

        # cross section related
        abs = t.absorption_coefficient
        sctt = t.scattering_coefficient

        if abs is None or sctt is None:
            # need to get cross section from sample assembly representation
            # svn://danse.us/inelastic/sample/.../sampleassembly
            # origin is a node in the sample assembly representation
            #
            # scatterer_origin is assigned to kernel when a kernel is
            # constructed from kernel xml.
            # see sampleassembly_support.SampleAssembly2CompositeScatterer for details.
            origin = t.scatterer_origin
            from sampleassembly import cross_sections

            abs, inc, coh = cross_sections(origin, include_density=True)
            sctt = inc + coh
            pass

        abs, sctt = self._unitsRemover.remove_unit((abs, sctt), 1.0 / units.length.meter)

        # functors
        E_Q = kernel.E_Q
        S_Q = kernel.S_Q

        # Emax
        Emax = self._unitsRemover.remove_unit(kernel.Emax, units.energy.meV)

        return self.factory.E_vQ_Kernel(E_Q, S_Q, Emax, abs, sctt)
Example #3
0
def onSQEkernel(self, sqekernel):
    
    t = sqekernel

    import units
    Erange = t.Erange
    Erange = self._unitsRemover.remove_unit( Erange, units.energy.meV )

    Qrange = t.Qrange
    Qrange = self._unitsRemover.remove_unit( Qrange, 1./units.length.angstrom )

    csqe = t.SQE.identify(self)

    abs = t.absorption_cross_section
    sctt = t.scattering_cross_section
    if abs is None or sctt is None:
        #need to get cross section from sample assembly representation
        # svn://danse.us/inelastic/sample/.../sampleassembly
        #origin is a node in the sample assembly representation
        #
        #scatterer_origin is assigned to kernel when a kernel is
        #constructed from kernel xml.
        #see sampleassembly_support.SampleAssembly2CompositeScatterer for details.
        origin = t.scatterer_origin
        from sampleassembly import cross_sections
        abs, inc, coh = cross_sections( origin )
        sctt = inc + coh
        pass

    abs, sctt = self._unitsRemover.remove_unit( (abs, sctt), 1./units.length.meter )
    
    return self.factory.sqekernel(
        abs, sctt,
        csqe, Qrange, Erange )
Example #4
0
    def onE_vQ_Kernel(self, kernel):
        t = kernel

        # cross section related
        abs = t.absorption_coefficient
        sctt = t.scattering_coefficient

        if abs is None or sctt is None:
            #need to get cross section from sample assembly representation
            # svn://danse.us/inelastic/sample/.../sampleassembly
            #origin is a node in the sample assembly representation
            #
            #scatterer_origin is assigned to kernel when a kernel is
            #constructed from kernel xml.
            #see sampleassembly_support.SampleAssembly2CompositeScatterer for details.
            origin = t.scatterer_origin
            from sampleassembly import cross_sections
            abs, inc, coh = cross_sections(origin, include_density=True)
            sctt = inc + coh
            pass
        
        abs, sctt = self._unitsRemover.remove_unit( (abs, sctt), 1./units.length.meter )

        # functors
        E_Q = kernel.E_Q
        S_Q = kernel.S_Q

        # Emax
        Emax = self._unitsRemover.remove_unit(
            kernel.Emax, units.energy.meV)
        
        return self.factory.E_vQ_Kernel(E_Q, S_Q, Emax, abs, sctt)
Example #5
0
    def onSQEkernel(self, sqekernel):
        
        t = sqekernel
        
        Erange = t.Erange
        Erange = self._unitsRemover.remove_unit( Erange, units.energy.meV )
        
        Qrange = t.Qrange
        Qrange = self._unitsRemover.remove_unit( Qrange, 1./units.length.angstrom )
        
        csqe = t.SQE.identify(self)
        
        abs = t.absorption_cross_section
        sctt = t.scattering_cross_section
        if abs is None or sctt is None:
            #need to get cross section from sample assembly representation
            # svn://danse.us/inelastic/sample/.../sampleassembly
            #origin is a node in the sample assembly representation
            #
            #scatterer_origin is assigned to kernel when a kernel is
            #constructed from kernel xml.
            #see sampleassembly_support.SampleAssembly2CompositeScatterer for details.
            origin = t.scatterer_origin
            from sampleassembly import cross_sections
            abs, inc, coh = cross_sections( origin, include_density=False)
            sctt = inc + coh
            pass

        abs, sctt = self._unitsRemover.remove_unit( (abs, sctt), units.length.meter**2)
        
        unitcell_vol = t.unitcell_vol
        if unitcell_vol is None:
            origin = t.scatterer_origin
            structure = origin.phase.unitcell
            unitcell_vol = structure.lattice.getVolume()
            # convert to meter^3
            unitcell_vol *= 1.e-30
        
        return self.factory.sqekernel(
            abs, sctt, unitcell_vol,
            csqe, Qrange, Erange )
Example #6
0
    def onIsotropicKernel(self, kernel):
        t = kernel

        abs = t.absorption_cross_section
        sctt = t.scattering_cross_section

        if abs is None or sctt is None:
            #need to get cross section from sample assembly representation
            # svn://danse.us/inelastic/sample/.../sampleassembly
            #origin is a node in the sample assembly representation
            #
            #scatterer_origin is assigned to kernel when a kernel is
            #constructed from kernel xml.
            #see sampleassembly_support.SampleAssembly2CompositeScatterer for details.
            origin = t.scatterer_origin
            from sampleassembly import cross_sections
            abs, inc, coh = cross_sections( origin )
            sctt = inc + coh
            pass
        
        abs, sctt = self._unitsRemover.remove_unit( (abs, sctt), 1./units.length.meter )
        
        return self.factory.isotropickernel(abs, sctt)