def execute(self): """ Returns the normalization integral for the waves, alphas, and beam polarization. Note that the normalization integral is stored as a numpy ndarray with 4 dimensions. The indexing of the normalization integral is [wave1.epsilon,wave2.epsilon,waves.index(wave1),waves.index(wave2)]. This means that the first 2 dimensions (wave1.epsilon,wave2.epsilon) have length of 2. The last 2 dimensions (waves.index(wave1),waves.index(waves2)) have length equal to the number of waves to be represented in this normalization integral. """ evnumber = 0 for alpha in self.alphaList: spindensity = spinDensity(self.beamPolarization, alpha) for wave1 in self.waves: for wave2 in self.waves: temp = wave1.complexamplitudes[evnumber] * numpy.conj( wave2.complexamplitudes[evnumber]) * spindensity[ wave1.epsilon, wave2.epsilon] self.ret[wave1.epsilon, wave2.epsilon, self.waves.index(wave1), self.waves.index(wave2)] += temp evnumber += 1 buffe = self.ret * (1. / float(evnumber)) self.ret = buffe return self.ret
def calclogI(self): """ The logarithm intensity function. Returns: Numpy.complex data type representing the value of the logarithm of the intensity function. """ ret=numpy.complex(0.,0.) for n in range(0,len(self.alphaList)-1,1): argret=numpy.complex(0.,0.) for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes)!=0: #logarithmic domain error arg = self.productionAmplitudes[self.waves.index(wave1)]*numpy.conjugate(self.productionAmplitudes[self.waves.index(wave2)])*wave1.complexamplitudes[n]*numpy.conjugate(wave2.complexamplitudes[n])*spinDensity(self.beamPolarization,self.alphaList[n])[wave1.epsilon,wave2.epsilon] argret+=arg argret=argret.real if self.debugPrinting==1: print"loop#",n,"="*10 print"argval:",arg print"argtype:",type(arg) print"productionAmps1:",self.productionAmplitudes[self.waves.index(wave1)] print"productionAmps2*:",numpy.conjugate(self.productionAmplitudes[self.waves.index(wave2)]) print"spinDensityValue:",spinDensity(self.beamPolarization,self.alphaList[n])[wave1.epsilon,wave2.epsilon] print"A1:",wave1.complexamplitudes[n] print"A2*:",numpy.conjugate(wave2.complexamplitudes[n]) if argret > 0.: ret+=log(argret) self.iList.append(argret) return ret
def execute(self): """ Returns the normalization integral for the waves, alphas, and beam polarization. Note that the normalization integral is stored as a numpy ndarray with 4 dimensions. The indexing of the normalization integral is [wave1.epsilon,wave2.epsilon,waves.index(wave1),waves.index(wave2)]. This means that the first 2 dimensions (wave1.epsilon,wave2.epsilon) have length of 2. The last 2 dimensions (waves.index(wave1),waves.index(waves2)) have length equal to the number of waves to be represented in this normalization integral. """ evnumber = 0 for alpha in self.alphaList: spindensity = spinDensity(self.beamPolarization, alpha) for wave1 in self.waves: for wave2 in self.waves: temp = ( wave1.complexamplitudes[evnumber] * numpy.conj(wave2.complexamplitudes[evnumber]) * spindensity[wave1.epsilon, wave2.epsilon] ) self.ret[wave1.epsilon, wave2.epsilon, self.waves.index(wave1), self.waves.index(wave2)] += temp evnumber += 1 buffe = self.ret * (1.0 / float(evnumber)) self.ret = buffe return self.ret
def calculate(self, mass, eventNumber, ohmlist): """ Calculate function for the instensity class, returns the value for the instensity for specified mass and event number. Args: mass (float): eventNumber (int): ohmlist (numpy.ndarray) Returns: The value of the intensity function as a numpy.complex type. """ ret = numpy.complex(0., 0.) self.testValues = [] for wave1 in self.waves: for wave2 in self.waves: ret += ohmlist[ self.waves.index(wave1), self.waves.index(wave2)] * wave1.complexamplitudes[ eventNumber] * numpy.conjugate( wave2. complexamplitudes[eventNumber]) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[wave1.epsilon, wave2.epsilon] return ret
def calclogI(self): """ The logarithm intensity function. Returns: Numpy.complex data type representing the value of the logarithm of the intensity function. """ ret = numpy.complex(0., 0.) for n in range(0, len(self.alphaList) - 1, 1): argret = numpy.complex(0., 0.) for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes) != 0: #logarithmic domain error arg = self.productionAmplitudes[self.waves.index( wave1)] * numpy.conjugate( self.productionAmplitudes[self.waves.index( wave2)] ) * wave1.complexamplitudes[n] * numpy.conjugate( wave2.complexamplitudes[n]) * spinDensity( self.beamPolarization, self.alphaList[n])[wave1.epsilon, wave2.epsilon] argret += arg argret = argret.real if self.debugPrinting == 1: print "loop#", n, "=" * 10 print "argval:", arg print "argtype:", type(arg) print "productionAmps1:", self.productionAmplitudes[ self.waves.index(wave1)] print "productionAmps2*:", numpy.conjugate( self.productionAmplitudes[self.waves.index(wave2)]) print "spinDensityValue:", spinDensity( self.beamPolarization, self.alphaList[n])[wave1.epsilon, wave2.epsilon] print "A1:", wave1.complexamplitudes[n] print "A2*:", numpy.conjugate(wave2.complexamplitudes[n]) if argret > 0.: ret += log(argret) self.iList.append(argret) return ret
def calc(self): """ Function that does the work of calculating rhoAA Return: rhoAA (numpy ndarray): Note, this class does NOT save the array and must be saved after returning. """ for n in range(self.eventNumber): for i,iwave in enumerate(self.waves): for j,jwave in enumerate(self.waves): Ai = iwave.complexamplitudes[n] Aj = jwave.complexamplitudes[n] self.rhoAA[i,j,n] = spinDensity(self.beamPolarization,self.alphaList[n])[iwave.epsilon,jwave.epsilon] * Ai * np.conjugate(Aj) return self.rhoAA
def calc(self): """ Function that does the work of calculating rhoAA Return: rhoAA (numpy ndarray): Note, this class does NOT save the array and must be saved after returning. """ for n in range(self.eventNumber): for i, iwave in enumerate(self.waves): for j, jwave in enumerate(self.waves): Ai = iwave.complexamplitudes[n] Aj = jwave.complexamplitudes[n] self.rhoAA[i, j, n] = spinDensity( self.beamPolarization, self.alphaList[n] )[iwave.epsilon, jwave.epsilon] * Ai * np.conjugate(Aj) return self.rhoAA
def calculate(self,mass,eventNumber,ohmlist): """ Calculate function for the instensity class, returns the value for the instensity for specified mass and event number. Args: mass (float): eventNumber (int): ohmlist (numpy.ndarray) Returns: The value of the intensity function as a numpy.complex type. """ ret=numpy.complex(0.,0.) self.testValues=[] for wave1 in self.waves: for wave2 in self.waves: ret+=ohmlist[self.waves.index(wave1),self.waves.index(wave2)]*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon] return ret
def calculate(self,mass,eventNumber): ret=numpy.complex(0.,0.) self.testValues=[] for resonance1 in self.resonances: for resonance2 in self.resonances: for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes)==0: ret+=complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon] if self.testWriting==1: if [self.waves.index(wave1),self.waves.index(wave2),self.resonances.index(resonance1),self.resonances.index(resonance2),complexV(resonance1,wave1,self.waves,self.normint,mass),complexV(resonance2,wave2,self.waves,self.normint,mass),complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon],wave1.complexamplitudes[eventNumber],wave2.complexamplitudes[eventNumber]] not in self.testValues: self.testValues.append([self.waves.index(wave1),self.waves.index(wave2),self.resonances.index(resonance1),self.resonances.index(resonance2),complexV(resonance1,wave1,self.waves,self.normint,mass),complexV(resonance2,wave2,self.waves,self.normint,mass),complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon],wave1.complexamplitudes[eventNumber],wave2.complexamplitudes[eventNumber]]) if self.testWriting==1: for items in self.testValues: print"="*10 print"wave1",items[0] print"wave2",items[1] print"resonance1:",items[2] print"resonance2:",items[3] print"v1:",items[4] print"v2:",items[5] print"amplitude1:",items[7] print"amplitude2:",items[8] print"term:",items[6] return ret
def calclogI(self,mass,eventNumber): ret=numpy.complex(0.,0.) for n in range(1,eventNumber,1): for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes)!=0: ret+=log(self.productionAmplitudes[self.waves.index(wave1)]*numpy.conjugate(self.productionAmplitudes[self.waves.index(wave2)])*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon]) return ret
def calculate(self,mass,eventNumber): """ Calculate function for the instensity class, returns the value for the instensity for specified mass and event number. Args: mass (float): eventNumber (int): Returns: The value of the intensity function as a numpy.complex type. """ ret=numpy.complex(0.,0.) self.testValues=[] for resonance1 in self.resonances: #print"resonance1=",resonance1.r0 for resonance2 in self.resonances: #print"resonance2=",resonance2.r0 for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes)==0: ret+=complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon] if len(self.productionAmplitudes)!=0: ret+=self.productionAmplitudes[self.waves.index(wave1)]*numpy.conjugate(self.productionAmplitudes[self.waves.index(wave2)])*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon] if self.testWriting==1: if [self.waves.index(wave1),self.waves.index(wave2),self.resonances.index(resonance1),self.resonances.index(resonance2),complexV(resonance1,wave1,self.waves,self.normint,mass),complexV(resonance2,wave2,self.waves,self.normint,mass),complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon],wave1.complexamplitudes[eventNumber],wave2.complexamplitudes[eventNumber]] not in self.testValues: self.testValues.append([self.waves.index(wave1),self.waves.index(wave2),self.resonances.index(resonance1),self.resonances.index(resonance2),complexV(resonance1,wave1,self.waves,self.normint,mass),complexV(resonance2,wave2,self.waves,self.normint,mass),complexV(resonance1,wave1,self.waves,self.normint,mass)*numpy.conjugate(complexV(resonance2,wave2,self.waves,self.normint,mass))*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon],wave1.complexamplitudes[eventNumber],wave2.complexamplitudes[eventNumber]]) if self.testWriting==1: for items in self.testValues: print"="*10 print"wave1",items[0] print"wave2",items[1] print"resonance1:",items[2] print"resonance2:",items[3] print"v1:",items[4] print"v2:",items[5] print"amplitude1:",items[7] print"amplitude2:",items[8] print"term:",items[6] return ret
def calculate(self, mass, eventNumber): """ Calculate function for the instensity class, returns the value for the instensity for specified mass and event number. Args: mass (float): eventNumber (int): Returns: The value of the intensity function as a numpy.complex type. """ ret = numpy.complex(0., 0.) self.testValues = [] for resonance1 in self.resonances: #print"resonance1=",resonance1.r0 for resonance2 in self.resonances: #print"resonance2=",resonance2.r0 for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes) == 0: ret += complexV( resonance1, wave1, self.waves, self.normint, mass) * numpy.conjugate( complexV(resonance2, wave2, self.waves, self.normint, mass) ) * wave1.complexamplitudes[ eventNumber] * numpy.conjugate( wave2.complexamplitudes[eventNumber] ) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[ wave1.epsilon, wave2.epsilon] if len(self.productionAmplitudes) != 0: ret += self.productionAmplitudes[self.waves.index( wave1)] * numpy.conjugate( self.productionAmplitudes[self.waves.index( wave2)] ) * wave1.complexamplitudes[ eventNumber] * numpy.conjugate( wave2.complexamplitudes[eventNumber] ) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[ wave1.epsilon, wave2.epsilon] if self.testWriting == 1: if [ self.waves.index(wave1), self.waves.index(wave2), self.resonances.index(resonance1), self.resonances.index(resonance2), complexV(resonance1, wave1, self.waves, self.normint, mass), complexV(resonance2, wave2, self.waves, self.normint, mass), complexV(resonance1, wave1, self.waves, self.normint, mass) * numpy.conjugate( complexV(resonance2, wave2, self.waves, self.normint, mass)) * wave1.complexamplitudes[eventNumber] * numpy.conjugate( wave2. complexamplitudes[eventNumber]) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[ wave1.epsilon, wave2.epsilon], wave1.complexamplitudes[eventNumber], wave2.complexamplitudes[eventNumber] ] not in self.testValues: self.testValues.append([ self.waves.index(wave1), self.waves.index(wave2), self.resonances.index(resonance1), self.resonances.index(resonance2), complexV(resonance1, wave1, self.waves, self.normint, mass), complexV(resonance2, wave2, self.waves, self.normint, mass), complexV(resonance1, wave1, self.waves, self.normint, mass) * numpy.conjugate( complexV(resonance2, wave2, self.waves, self.normint, mass)) * wave1.complexamplitudes[eventNumber] * numpy.conjugate( wave2. complexamplitudes[eventNumber]) * spinDensity( self.beamPolarization, self.alphaList[eventNumber])[ wave1.epsilon, wave2.epsilon], wave1.complexamplitudes[eventNumber], wave2.complexamplitudes[eventNumber] ]) if self.testWriting == 1: for items in self.testValues: print "=" * 10 print "wave1", items[0] print "wave2", items[1] print "resonance1:", items[2] print "resonance2:", items[3] print "v1:", items[4] print "v2:", items[5] print "amplitude1:", items[7] print "amplitude2:", items[8] print "term:", items[6] return ret
def calclogI(self,mass,eventNumber): ret=numpy.complex(0.,0.) for n in range(1,eventNumber,1): for resonance1 in self.resonances: for resonance2 in self.resonances: for wave1 in self.waves: for wave2 in self.waves: if len(self.productionAmplitudes)!=0: ret+=log(self.productionAmplitudes[self.waves.index(wave1)]*numpy.conjugate(self.productionAmplitudes[self.waves.index(wave2)])*wave1.complexamplitudes[eventNumber]*numpy.conjugate(wave2.complexamplitudes[eventNumber])*spinDensity(self.beamPolarization,self.alphaList[eventNumber])[wave1.epsilon,wave2.epsilon]) return ret