<jupyter_start><jupyter_text>FFT based method<jupyter_code>mag = magnification.mag_fft.magnification(profile_names=['disk', 'limb1'])
rho = 0.01
u = np.linspace(0.0, 4.0 ,1000)
%time a_disk = mag.A_disk(u, rho)
%time a_limb1 = mag.A_limb1(u, rho)
%time a_limb2 = mag.A_limb2(u, rho)

plt.figure()
#plt.loglog(u, a_disk)
plt.plot(u, a_disk)
plt.plot(u, a_limb1)
plt.plot(u, a_limb2)
plt.show()
k = mag.k
apk = mag.apk
plt.figure()
plt.loglog(k, apk*k**2*magnification.mag_fft.sk_disk(k, rho) )
plt.loglog(k, apk*k**2*magnification.mag_fft.sk_limb(k, rho, 1) )
plt.loglog(k, apk*k**2*magnification.mag_fft.sk_limb(k, rho, 2) )
plt.show()<jupyter_output><empty_output><jupyter_text>Witt Mao analytic<jupyter_code>%time a_disk_WittMao1994 = magnification.mag_wm.A_disk(u, rho)

plt.figure()
plt.plot(u, a_disk)
plt.plot(u, a_disk_WittMao1994)
plt.show()<jupyter_output>CPU times: user 1.41 s, sys: 15.4 ms, total: 1.42 s
Wall time: 1.42 s<jupyter_text>Gould (1994), Yoo et al. (2004)<jupyter_code>%time a_disk_Gould = magnification.mag_yoo.A_disk(u, rho)

plt.figure()
plt.plot(u, a_disk)
plt.plot(u, a_disk_Gould)
plt.show()
%time a_limb_Gould = magnification.mag_yoo.A_limb(u, rho)

plt.figure()
plt.plot(u, a_limb1)
plt.plot(u, a_limb_Gould)
plt.axhline(1.0, color='k',ls='--')
plt.show()
%time a_para_Gould = magnification.mag_yoo.A_para(u, rho)

plt.figure()
plt.plot(u, a_limb2)
plt.plot(u, a_para_Gould)
plt.axhline(1.0, color='k',ls='--')
plt.show()<jupyter_output>CPU times: user 2.02 ms, sys: 9.01 ms, total: 11 ms
Wall time: 12.8 ms<jupyter_text>Witt & Barandela 2019: Taylar expansion and analytic approximation<jupyter_code>%time a_disk_WittBarandela2019 = magnification.mag_wb.A_disk(u, rho)

plt.figure()
plt.plot(u, a_disk)
plt.ylim(plt.ylim())
plt.plot(u, a_disk_WittBarandela2019)
plt.show()
%time a_limb_WittBarandela2019 = magnification.mag_wb.A_limb(u, rho)

plt.figure()
plt.plot(u, a_limb1)
plt.ylim(plt.ylim())
plt.plot(u, a_limb_WittBarandela2019)
plt.show()
%time a_para_WittBarandela2019 = magnification.mag_wb.A_para(u, rho)

plt.figure()
plt.plot(u, a_limb2)
plt.ylim(plt.ylim())
plt.plot(u, a_para_WittBarandela2019)
plt.show()<jupyter_output>CPU times: user 1.01 ms, sys: 20 µs, total: 1.03 ms
Wall time: 666 µs<jupyter_text>How to generate test data<jupyter_code>import testdata
# define profile or take predefine profile.
# Here I take predefined profile
s = testdata.s_disk
# define `u` bin to evaluate reference magnification
u = np.logspace(-2,2,100)
# define finite source parameter
rho = 0.1
# define file name to save the obtained reference test data
fname_to_save = 'testdata_temp.txt'
# generate test data.
# This takes time.
#testdata.gen(s, rho, fname_to_save, u=u)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15142648134601316, 'fraction_numerical': 0.04242867593269934, 'mean_word_length': 6.273936170212766, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '165973', 'license': 'MIT', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1227, 'n_words': 235, 'path': 'howtouse.ipynb', 'repo_name': 'git-sunao/fft-extended-source', 'size': '2734'}