Improve hacks/stress.py a bit.
[dcpomatic.git] / hacks / gamma_graphs.py
1 #!/usr/bin/python
2
3 import matplotlib.pyplot as plt
4 import numpy as np
5
6 x = np.logspace(-3, 0, 100)
7
8 plt.loglog(x, pow(x, 2.2))
9 # plt.loglog(x, pow(x, 2.4))
10
11 srgb_linearised = []
12 for xx in x:
13     if xx > 0.04045:
14         srgb_linearised.append(pow((xx + 0.055) / 1.055, 2.4))
15     else:
16         srgb_linearised.append(xx / 12.92)
17
18 # plt.loglog(x, srgb_linearised)
19
20 rec_linearised = []
21 for xx in x:
22     if xx > 0.081:
23         rec_linearised.append(pow((xx + 0.099) / 1.099, 1 / 0.45))
24     else:
25         rec_linearised.append(xx / 4.5)
26
27 plt.loglog(x, rec_linearised)
28
29 plt.show()