DiamondLightSource / jungfrau-commissioning

Scripts and code for commissioning the Jungfrau detectors at Diamond
0 stars 0 forks source link

Check linearity of detector response #13

Open graeme-winter opened 1 year ago

graeme-winter commented 1 year ago

Look at data set recorded with range of transmissions, assess whether the response appears linear e.g. as we increase transmission, does spot integrated intensity increase the same way?

graeme-winter commented 1 year ago
from matplotlib import pyplot

from dials.array_family import flex

all = flex.reflection_table.from_file("scaled.refl")

all = all.select(all.get_flags(all.flags.scaled))

all = all.select(all["intensity.prf.value"] > 3 * flex.sqrt(all["intensity.prf.variance"]))

bits = { }

for j in range(5):
    bits[j] = all.select(all["id"] == j)

# treat last / strongest as reference

r = bits[4]
pyplot.xscale("log")
pyplot.yscale("log")
ratios = ["1%/20%", "2%/20%", "25%/20%", "10%/20%"]
for j in range(4):
    b = bits[j]
    m1, m2, d = r.match(b)
    ir = r.select(m1)["intensity.prf.value"]
    isr = r.select(m1)["intensity.prf.value"] / flex.sqrt(r.select(m1)["intensity.prf.variance"])
    ib = b.select(m2)["intensity.prf.value"]
    pyplot.scatter(isr.as_numpy_array(), (ib / ir).as_numpy_array(), s=0.2, label=ratios[j])
pyplot.legend()
pyplot.ylim(0.01, 2)
pyplot.show()

Suitable DIALS / Python scipt

graeme-winter commented 1 year ago

linear Looks reasonable

graeme-winter commented 1 year ago
 2023-06-22-11-59-24_insulin3_1pcT_scan_360deg/insulin3_1pcT_scan_360deg_0_0.h5
 2023-06-22-12-00-19_insulin3_2pcT_scan_360deg/insulin3_2pcT_scan_360deg_0_0.h5
 2023-06-22-12-00-57_insulin3_5pcT_scan_360deg/insulin3_5pcT_scan_360deg_0_0.h5
 2023-06-22-12-03-08_insulin3_10pcT_scan_360deg/insulin3_10pcT_scan_360deg_0_0.h5
 2023-06-22-12-04-48_insulin3_20pcT_scan_360deg/insulin3_20pcT_scan_360deg_0_0.h5

These data

graeme-winter commented 1 year ago

Ratios are not working out perfectly, but there is a small chance that the sample was moved so we shoot a "fresh" bit of crystal (which would change the illluminated volume and hence scale)