Changeset beb374a in sasview


Ignore:
Timestamp:
May 27, 2010 4:16:00 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
d734a3b1
Parents:
2f1a0dc
Message:

working on documentation

Location:
calculator
Files:
34 added
1 edited

Legend:

Unmodified
Added
Removed
  • calculator/sld_calculator.py

    r89108a0 rbeb374a  
    11""" 
    2     This module intends to compute the neutron scattering length density of molecule 
    3     @author: Gervaise B. Alina 
     2    This module intends to compute the neutron scattering length density  
     3    of a molecule. It uses methods of the periodictable package to provide  
     4    easy user interface for  Sld calculator applications. 
    45""" 
    56 
     
    1314class SldCalculator(object): 
    1415    """ 
    15         compute neutron SLD and related parameters 
     16    Given a molecule, a density and a wavelength, this class  
     17    determine scattering length density. 
    1618    """ 
    1719    def __init__(self): 
     
    2729    def set_value(self, user_formula, density, wavelength=6.0): 
    2830        """ 
    29             Store values of density and wavelength into the calculator  
    30             and compute the volume 
     31        Store values into the sld calculator and compute the corresponding 
     32        volume. 
    3133        """ 
    3234        self.wavelength = wavelength 
     
    3739            raise ZeroDivisionError("integer division or modulo\ 
    3840                         by zero for density") 
    39             return  
    4041        self.volume = (self.sld_formula.mass / self.density) / avogadro_number\ 
    4142                                *1.0e24    
     
    4445    def calculate_xray_sld(self, element): 
    4546        """ 
    46             Get an element and compute the corresponding SLD for a given formula 
    47             @param element:  elementis a string of existing atom 
     47        Get an element and compute the corresponding SLD for a given formula 
     48        @param element:  elementis a string of existing atom 
    4849        """ 
    4950        myformula = formula(str(element)) 
     
    6162    def calculate_neutron_sld(self): 
    6263        """ 
    63             Compute the neutron SLD for a given molecule 
    64             @return absorp: absorption 
    65             @return coh: coherence cross section 
    66             @return inc: incoherence cross section 
     64        Compute the neutron SLD for a given molecule 
     65        @return absorp: absorption 
     66        return coh: coherence cross section 
     67        @return inc: incoherence cross section 
    6768        """ 
    6869        if self.density == 0: 
     
    7576        #Don't know if value is return in cm or  cm^(-1).assume return in cm 
    7677        # to match result of neutron inc of Alan calculator 
    77         self.incoherence = inc * 1/10 
    78         #Doesn't match result of Alan calculator for absorption factor of 2 
    79         #multiplication of 100 is going around 
    80         self.absorption = absorp * 2 * 100 
     78        self.incoherence = inc 
     79        self.absorption = absorp  
    8180        self.coherence  = coh 
    8281        return self.coherence, self.absorption, self.incoherence 
     
    8584    def calculate_length(self): 
    8685        """ 
    87             Compute the neutron 1/e length 
     86        Compute the neutron 1/e length 
    8887        """ 
    8988        self.length = (self.coherence + self.absorption +\ 
     
    9493    def calculate_coherence_im(self): 
    9594        """ 
    96             Compute imaginary part of the absorption  
     95        Compute imaginary part of the absorption  
    9796        """ 
    9897        atom = self.sld_formula.atoms  
Note: See TracChangeset for help on using the changeset viewer.