<jupyter_start><jupyter_text>Plotting the GCL<jupyter_code>du = gcl(rel_pos, c_t*vec, D*vec, ti*vec).reshape(X.shape)
pl.pcolor(X,Y,du, vmin=-0.5, vmax=0.0)
pl.colorbar()
pl.axis('tight');<jupyter_output><empty_output><jupyter_text>Plotting the NOJ<jupyter_code>k = 0.5 # wake expansion parameter
du = noj(rel_pos, c_t*vec, D*vec, k*vec).reshape(X.shape)
pl.pcolor(X,Y,du, vmin=-0.5, vmax=0.0)
pl.colorbar()
pl.axis('tight');<jupyter_output>/home/pire/git/waketor/waketor/single_wake/noj.py:29: RuntimeWarning: divide by zero encountered in true_divide
  DU = - (1.0 - np.sqrt(1.0 - c_t)) / (1.0 + (k * x) / R) ** 2.0<jupyter_text>Plotting Ainslie<jupyter_code>du = ainslie(rel_pos, c_t*vec, D*vec, ti*vec).reshape(X.shape)
pl.pcolor(X,Y,du, vmin=-0.5, vmax=0.0)
pl.colorbar()
pl.axis('tight');<jupyter_output><empty_output><jupyter_text>Benchmark<jupyter_code>import timeit
t_ainslie = timeit.timeit('ainslie(rel_pos, c_t*vec, D*vec, ti*vec)', 
              setup="from __main__ import ainslie, rel_pos, c_t, D, ti, vec", 
              number=5)/5

t_gcl = timeit.timeit('gcl(rel_pos, c_t*vec, D*vec, ti*vec)', 
              setup="from __main__ import gcl, rel_pos, c_t, D, ti, vec", 
              number=10)/10

t_noj = timeit.timeit('noj(rel_pos, c_t*vec, D*vec, k*vec)', 
              setup="from __main__ import noj, rel_pos, c_t, D, k, vec", 
             number=100)/100
pl.bar(range(3),[t_noj, t_gcl, t_ainslie], log=True)
pl.xticks(np.arange(3)+0.4, ['NOJ', 'GCL', 'Ainslie'])
for x,y in zip(range(3),[t_noj, t_gcl, t_ainslie]):
    pl.text(x+0.4, y, '%.2E' % y, ha='center', va= 'bottom')
pl.ylabel('time [sec]')
pl.title('Time to process {:.2E} points'.format(N**2))
print('Ainslie is {:2.2f} times slower than NOJ'.format(t_ainslie / t_noj))
print('GCL is {:2.2f} times slower than NOJ'.format(t_gcl / t_noj))<jupyter_output>Ainslie is 6700.68 times slower than NOJ
GCL is 20.01 times slower than NOJ
{'fraction_non_alphanumeric': 0.18561001042752867, 'fraction_numerical': 0.03128258602711158, 'mean_word_length': 4.611111111111111, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '354939', 'license': 'Apache-2.0', 'n_tokens_mistral': 899, 'n_tokens_neox': 865, 'n_words': 157, 'path': 'theory/single_wake_models.ipynb', 'repo_name': 'rethore/waketor', 'size': '1918'}