Fit to Coumarin Fluro Red absorption coefficient spectrum using four Gaussians. Parameters ---------- x : numpy.array Wavelength array in nanometers. This should take values in the optical range between 200 and 900. Returns ----
(x)
| 2 | from scipy.special import erf |
| 3 | |
| 4 | def absorption(x): |
| 5 | """ Fit to Coumarin Fluro Red absorption coefficient spectrum using four Gaussians. |
| 6 | |
| 7 | Parameters |
| 8 | ---------- |
| 9 | x : numpy.array |
| 10 | Wavelength array in nanometers. This should take values in the optical |
| 11 | range between 200 and 900. |
| 12 | |
| 13 | Returns |
| 14 | ------- |
| 15 | numpy.array |
| 16 | The spectrum normalised to peak value of 1.0. |
| 17 | |
| 18 | Notes |
| 19 | ----- |
| 20 | This fit is "good enough" for getting sensible answers but for research purposes |
| 21 | you should be using your own data as this might not be exactly the same |
| 22 | spectrum as your materials. |
| 23 | |
| 24 | Example |
| 25 | ------- |
| 26 | To make a absorption coefficient spectrum in the range 300 to 800 nanometers |
| 27 | containing 200 points:: |
| 28 | |
| 29 | spectrum = absorption(np.linspace(300, 800, 200)) |
| 30 | """ |
| 31 | p1 = 549.06438843562137 |
| 32 | a1 = 439.06754804626956 |
| 33 | w1 = 24.298601639828647 |
| 34 | |
| 35 | p2 = 379.48645797468572 |
| 36 | a2 = 85.177292848284353 |
| 37 | w2 = 13.513987279089216 |
| 38 | |
| 39 | p3 = 519.58858977131513 |
| 40 | a3 = 660.1731296017241 |
| 41 | w3 = 38.263352007649125 |
| 42 | |
| 43 | p4 = 490.05625608592726 |
| 44 | a4 = 511.11501615291041 |
| 45 | w4 = 52.213294432464529 |
| 46 | spec = ( |
| 47 | a1 * np.exp(-(((p1 - x) / w1) ** 2)) |
| 48 | + a2 * np.exp(-(((p2 - x) / w2) ** 2)) |
| 49 | + a3 * np.exp(-(((p3 - x) / w3) ** 2)) |
| 50 | + a4 * np.exp(-(((p4 - x) / w4) ** 2)) |
| 51 | ) |
| 52 | spec = spec / np.max(spec) |
| 53 | return spec |
| 54 | |
| 55 | |
| 56 | def emission(x): |