/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
GenDecay::beta::Spectra Class Reference

List of all members.

Public Member Functions

def __init__
def modeledSpectra
def sampledSpectra

Public Attributes

 random
 nuc
 betas

Detailed Description

Look at Beta decay Spectra

Definition at line 5 of file beta.py.


Constructor & Destructor Documentation

def GenDecay::beta::Spectra::__init__ (   self,
  z,
  a 
)
Create Spectra for given ground state isotope of given Z and A.

Definition at line 10 of file beta.py.

00011                           :
00012         '''
00013         Create Spectra for given ground state isotope of given Z and A.
00014         '''
00015         import random
00016         self.random = random.Random()
00017 
00018         from g4data import G4RadData
00019         rd = G4RadData()
00020         rd = G4RadData()
00021         self.nuc = rd.nuclideData(z,a)
00022         state = self.nuc.excitedState()
00023 
00024         betas = []
00025         for dk in state.decays:
00026             if dk.type[0:4] == 'Beta':
00027                 betas.append(dk)
00028                 continue
00029             continue
00030 
00031         if not betas:
00032             print 'Warning: no beta decays for: %s'%nuc
00033             return
00034 
00035         self.betas = betas
00036         return
    

Member Function Documentation

def GenDecay::beta::Spectra::modeledSpectra (   self,
  nbins = 100 
)

Definition at line 37 of file beta.py.

00038                                       :
00039         total_fraction = sum([dk.fraction for dk in self.betas])
00040         maximum = max([dk.radiation.endpoint for dk in self.betas])
00041 
00042         ret = []
00043         from numpy import array
00044         total = array([0.0 for x in range(nbins)])
00045         bins = [(x+0.5)*maximum/nbins for x in range(nbins)]
00046         for dk in self.betas:
00047             ratio = dk.fraction/total_fraction
00048             Sm = []
00049             Sm = map(dk.radiation.dnde,bins)
00050             scaled = [ratio*x for x in Sm]
00051             total += scaled
00052             ret.append(scaled)
00053             continue
00054         return (ret,bins,total)

def GenDecay::beta::Spectra::sampledSpectra (   self,
  ndecays = 1000,
  nbins = 100 
)
Return a list of tuples (decay.BetaDecay,numpy.histogram).
Each histogram has the given number of bins and gives the
sampled energy spectrum.  The total number of entries of all
histograms is as given.  The branching fractions of the decay
are used to divide up the total number of decays when sampling
each branch.  Histograms are normalized so their sum is 1 and
keeping the branching ratios intact

Definition at line 55 of file beta.py.

00056                                                    :
00057         '''Return a list of tuples (decay.BetaDecay,numpy.histogram).
00058         Each histogram has the given number of bins and gives the
00059         sampled energy spectrum.  The total number of entries of all
00060         histograms is as given.  The branching fractions of the decay
00061         are used to divide up the total number of decays when sampling
00062         each branch.  Histograms are normalized so their sum is 1 and
00063         keeping the branching ratios intact'''
00064         from numpy import histogram, array
00065 
00066         total_fraction = float(sum([dk.fraction for dk in self.betas]))
00067         maximum = max([dk.radiation.endpoint for dk in self.betas])
00068         ret = []
00069         
00070         binwidth = maximum/nbins
00071 
00072         for dk in self.betas:
00073             ratio = dk.fraction/total_fraction
00074             energies = []
00075             dk_number = ndecays*ratio
00076             for count in range(0,int(dk_number)):
00077                 energies.append(dk.radiation.sampleEnergy())
00078             h = histogram(energies,nbins,(0,maximum))
00079             norm = ratio/(binwidth*sum(h[0]))
00080             scaled = array([ bin*norm for bin in h[0] ])
00081             ret.append((dk,(scaled,h[1])))
00082             continue
00083         return ret
00084 
        

Member Data Documentation

Definition at line 12 of file beta.py.

Definition at line 12 of file beta.py.

Definition at line 12 of file beta.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:21:06 for GenDecay by doxygen 1.7.4