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.ID3MCoordAssign(TPAR, SLD, Trapnumber, Pitch, X1) #CDp.plotID1(Coord,Trapnumber,Pitch) (FITPAR, FITPARLB, FITPARUB) = CD.PBA_ID2(TPAR, SPAR, Trapnumber, X1) #Does not need to be changed R = np.random.normal(0, 0.225, [len(Qx[:, 0]), len(Qx[0, :])]) (Intensity, Amplitude) = SimInt_ID3M(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.ID2CoordAssign(TPAR,SLD,Trapnumber,Pitch,X1) #CDp.plotID1(Coord,Trapnumber,Pitch) (FITPAR,FITPARLB,FITPARUB)=CD.PBA_ID2(TPAR,SPAR,Trapnumber,X1) R = np.random.normal(0, 0.225, [len(Qx[:,0]),len(Qx[0,:])]) (DummyIntensity,Amplitude)=SimInt_ID2(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_ID2(TPAR,SPAR,Trapnumber,X1) #regenerates FITPAR with proper intensity scaling N=(1/(np.power(Intensity,0.5)))*Intensity # Generates noise
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.ID2CoordAssign(TPAR, SLD, Trapnumber, Pitch, X1) #CDp.plotID1(Coord,Trapnumber,Pitch) (FITPAR, FITPARLB, FITPARUB) = CD.PBA_ID2(TPAR, SPAR, Trapnumber, X1) R = np.random.normal(0, 0.225, [len(Qx[:, 0]), len(Qx[0, :])]) (Intensity, Amplitude) = SimInt_ID2(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.ID3MCoordAssign(TPAR, SLD, Trapnumber, Pitch, X1) #CDp.plotID1(Coord,Trapnumber,Pitch) (FITPAR, FITPARLB, FITPARUB) = CD.PBA_ID2(TPAR, SPAR, Trapnumber, X1) #Does not need to be changed R = np.random.normal(0, 0.225, [len(Qx[:, 0]), len(Qx[0, :])]) (DummyIntensity, Amplitude) = SimInt_ID3M(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_ID2( TPAR, SPAR, Trapnumber, X1) #regenerates FITPAR with proper intensity scaling