W = Param[SampleNumber, 0] H = Param[SampleNumber, 1] WidthLoad = 'W' + str(int(W)) + '.txt' HeightLoad = 'H' + str(int(H)) + '.txt' Width = np.loadtxt(WidthLoad) Height = np.loadtxt(HeightLoad) TPAR[:, 0] = Width TPAR[:, 1] = Height SLD[0, 0] = SLD1 SLD[1, 0] = SLD1 SLD[2, 0] = SLD1 SLD[3, 0] = SLD1 Coord = CD.ID1CoordAssign(TPAR, SLD, Trapnumber, Pitch) #CDp.plotID1(Coord,Trapnumber,Pitch) (FITPAR, FITPARLB, FITPARUB) = CD.PBA_ID1(TPAR, SPAR, Trapnumber) R = np.random.normal(0, 0.225, [len(Qx[:, 0]), len(Qx[0, :])]) (Intensity, Amplitude) = SimInt_ID1(FITPAR) N = (1 / (np.power(Intensity, 0.5))) * Intensity # Generates noise N = N * R Intensity2 = Intensity + R # Applies Noise C = CD.Misfit(Intensity, Intensity2) Chi2 = np.sum((C)) MCPAR = np.zeros([7]) MCPAR[0] = 1 # Chainnumber MCPAR[1] = len(FITPAR)
W=Param[SampleNumber,0] H=Param[SampleNumber,1] WidthLoad='W'+str(int(W))+'.txt' HeightLoad='H'+str(int(H))+'.txt' Width=np.loadtxt(WidthLoad) Height=np.loadtxt(HeightLoad) TPAR[:,0]=Width TPAR[:,1]=Height SLD[0,0]=SLD1; SLD[1,0]=SLD1; SLD[2,0]=SLD1; SLD[3,0]=SLD1; Coord=CD.ID1CoordAssign(TPAR,SLD,Trapnumber,Pitch) #CDp.plotID1(Coord,Trapnumber,Pitch) (FITPAR,FITPARLB,FITPARUB)=CD.PBA_ID1(TPAR,SPAR,Trapnumber) R = np.random.normal(0, 0.225, [len(Qx[:,0]),len(Qx[0,:])]) (DummyIntensity,Amplitude)=SimInt_ID1(FITPAR) PreInt=abs(Amplitude) PreInt=np.power(PreInt,2) M=np.amax(PreInt) I0=(20000)/M # Scales the intensity so that the max is 20000 SPAR[1]=I0 Intensity=PreInt*I0+Bk (FITPAR,FITPARLB,FITPARUB)=CD.PBA_ID1(TPAR,SPAR,Trapnumber) #regenerates FITPAR with proper intensity scaling N=(1/(np.power(Intensity,0.5)))*Intensity # Generates noise