# ------------------------------------------------------------------------- # # now call DF functions to fit the # intensity histogram to a mixture of von-Mises-Fischer distribution angles = ResultsFFT.X values = ResultsFFT.Y # convert the angles from degrees to radians: r_X = np.radians( angles ) X_samples = r_X # normalize the light intensity data (FFT): n_X = dC.normalizeIntensity( angles, values, YNplot='Yes' ) Int = n_X[:,1] # make points of angles based on the light intensity: p_X = dC.makePoints( n_X, YNplot='Yes' ) # select model to fit: #model_test = '1vM' #model_test = '2vM' #model_test = '3vM' #model_test = '2vM1U' model_test = '1vM1U' #%% for a 1vM1U model: #model_test = '1vM1U' if model_test == '1vM1U': # parameters for the von Mises member: p1_ = 0.7 # weight contribution of the 1st von Mises pu_ = 1. - p1_ # weight contribution of Uniform distribut kappa1_ = np.array((12.0)) # concentration for the 1st von Mises member loc1_ = -np.pi/9.0 # location for the 1st von Mises member
# ------------------------------------------------------------------------- # # read the data from the csv file: angles, values, mydat = dC.imageCVS2Data( csv_path ) # convert the angles from degrees to radians: angles = angles r_X = np.radians( angles ) X_samples = r_X # normalize the light intensity data (FFT): n_X = dC.normalizeIntensity( angles, values, YNplot='Yes' ) Int = n_X[:,1] # make points of angles based on the light intensity: p_X = ( dC.makePoints( n_X, YNplot='Yes' ) + np.pi/2 )/np.pi #p_X = p_X + np.pi/2 nn = len(p_X) u_X = np.random.uniform(0.0,np.pi,nn) u_X = np.sort(np.unique(u_X))/np.pi hh = np.arange(1/(nn+1), nn/(nn+1), 1/(nn+1)) #hh = np.arange(0, nn/(nn+1), 1/(nn+1)) #hh = np.arange(1/(nn+1), 1, 1/(nn+1)) fig, ax00 = plt.subplots(1, 1, figsize=(6, 6)) ax00.plot(hh, p_X[1::], color='r', linestyle=':', label='data') ax00.plot(hh, u_X[1::], color='b', linestyle=':', label='uniform') ax00.plot([0, 1], [0, 1], color='g', linestyle='--', label='45$^o$ line') ax00.plot(hh, hh, color='m')