You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
815 B

5 years ago
  1. #!/usr/bin/env python3
  2. import matplotlib.pyplot as plt
  3. import seaborn as sns
  4. import numpy as np
  5. import random
  6. from util.script import frange
  7. from collections import Counter
  8. def main():
  9. #alpha_range = frange(0.5, 10, 0.1)
  10. #k = 50
  11. #alphas = _get_bins(k, alpha_range)
  12. alphas = []
  13. k = 25
  14. for v in range(5, 50):
  15. alphas.append(round(k/v, 2))
  16. num_bins =len(np.unique(alphas))
  17. print(num_bins)
  18. sns.set()
  19. plt.hist(alphas, bins=num_bins)
  20. plt.show()
  21. def _get_bins(k, alpha_range):
  22. bins = {}
  23. alphas = []
  24. for a in alpha_range:
  25. v = int(k/a)
  26. real_alpha = (k / v)
  27. alphas.append(round(real_alpha, 2))
  28. return alphas
  29. if __name__ == "__main__":
  30. main()