Esempio n. 1
0
origin = [0,0,0]
N = 2
n_bins = 30 #Bins for the histogram plot

time1 = timeit.default_timer() #Timing The Loop

for i in range(iterations_of_numbers):

    vector_magnitude_list = []

    for i in range(iterations_of_postitions): #This loop generates the spheres

        magnitude, vector = Obs.RandSphere(N)
        vector_magnitude_list.append(magnitude)
        #print(str(vector_magnitude_list))
    N += 2 #How many the number of flagella increases by

    flagella_number_list.append(N)
    mean_length_list.append(Obs.mean_value(vector_magnitude_list, n_bins)) #Now we append the empty lists from before

#Finally, write to a file
for a,b in zip(mean_length_list,flagella_number_list):
    f.write("%s,%s\n" % (a,b))
f.close()

time2 = timeit.default_timer()
print("Time taken for code to run... in seconds :-  " + str(time2 - time1)) #Finish Timing The Loop

Obs.mean_length_plotter() #Finally, send it to be plotted
Obs.log_length_plotter(N)
Esempio n. 2
0
        mean_mag_torque_list.append(
            scipy.linalg.norm(
                obs.torque(final_force_list, initial_force_list, N,
                           torque_list)))

        initial_force_list = []
        final_force_list = []

    mean_force = sum(mean_mag_force_list) / (iterations_of_positions)
    mean_torque = sum(mean_mag_torque_list) / (iterations_of_positions)

    mean_force_list.append(mean_force)
    mean_torque_list.append(mean_torque)
    number_list.append(N)

    N += 1

#Writing to a file
for a, b in zip(mean_torque_list, number_list):
    g.write("%s,%s\n" % (a, b))
g.close()

for a, b in zip(mean_force_list, number_list):
    f.write("%s,%s\n" % (a, b))
f.close()

#Plotting it all
obs.mean_length_plotter()
obs.mean_torque_plotter()
#obs.log_length_plotter(N)