Skip to content
Snippets Groups Projects
Commit dde9ab6f authored by Jakobsen, Mads Bregenholt's avatar Jakobsen, Mads Bregenholt
Browse files

added photonization via photon energy

parent ed15b532
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,8 @@ class Xpcs(BaseCorrectionAddon):
def __init__(self, config):
self._ttcdata = TTCdata()
self._mask_path = config["mask_path"]
self._photon_energy = config.get("photonEnergy")
self._module_no = None
self._current_image_mean = 0
......@@ -20,6 +22,7 @@ class Xpcs(BaseCorrectionAddon):
self._sparse_array = None
self._cal_mask = None
global cupy
import cupy
......@@ -41,6 +44,18 @@ class Xpcs(BaseCorrectionAddon):
.defaultValue("")
.reconfigurable()
.commit(),
# value of the photon energy. used for the photonization step
DOUBLE_ELEMENT(schema)
.key(f"{prefix}.photonEnergy")
.tags("managed")
.assignmentOptional()
.defaultValue(8.0)
.reconfigurable()
.commit(),
)
@staticmethod
......@@ -72,6 +87,10 @@ class Xpcs(BaseCorrectionAddon):
self._mask_path = changed_config["mask_path"]
self.set_mask()
if changed_config.has("photonEnergy"):
self._photon_energy = changed_config["photonEnergy"]
def post_correction(self, data, cell_table, pulse_table, output_hash):
global cupy
......@@ -79,11 +98,11 @@ class Xpcs(BaseCorrectionAddon):
data[0] = 0
# Photonize
# print(f"Unphotonized mean ({data.shape}): {np.nanmean(data)}")
start = time.time()
data /= 10
data[data < 0] = 0
data /= self._photon_energy
np.around(data, out=data)
# print(f"Photonized mean: {np.nanmean(data)}")
# Sparsify
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment