Skip to content
Snippets Groups Projects
Commit b4a44ebd authored by Karim Ahmed's avatar Karim Ahmed
Browse files

commit before rebasing

parent afc292fa
No related branches found
No related tags found
1 merge request!228Feat/batch prioritization darks
...@@ -1285,13 +1285,16 @@ class AgipdCorrections: ...@@ -1285,13 +1285,16 @@ class AgipdCorrections:
# fidxv: INDEX/.../image/first idx values # fidxv: INDEX/.../image/first idx values
# cntsv: INDEX/.../image/counts values # cntsv: INDEX/.../image/counts values
# Extract parameters through identifying
# unique trains, index and numbers.
uq, fidxv, cntsv = np.unique(alltrains[firange - firange[0]], uq, fidxv, cntsv = np.unique(alltrains[firange - firange[0]],
return_index=True, return_index=True,
return_counts=True) return_counts=True)
# Validate calculated CORR INDEX contents # Validate calculated CORR INDEX contents.
train_diff = np.isin(np.array(self.infile["/INDEX/trainId"]), uq, invert=True) train_diff = np.isin(np.array(self.infile["/INDEX/trainId"]), uq, invert=True)
# Insert zeros for missing trains.
for i, diff in enumerate(train_diff): for i, diff in enumerate(train_diff):
if diff: if diff:
if i < len(cntsv): if i < len(cntsv):
...@@ -1301,27 +1304,16 @@ class AgipdCorrections: ...@@ -1301,27 +1304,16 @@ class AgipdCorrections:
cntsv = np.append(cntsv, 0) cntsv = np.append(cntsv, 0)
fidxv = np.append(fidxv, 0) fidxv = np.append(fidxv, 0)
mv = len(fidxv) # save INDEX contents (first, count) in CORR files
fidx = np.zeros(len(fidxv), fidxv.dtype)
fidx[self.valid[:mv]] = np.array(fidxv)[self.valid[:mv]]
for i in range(len(fidx) - 1, 2, -1):
if fidx[i - 1] == 0 and fidx[i] != 0:
fidx[i - 1] = fidx[i]
cnts = np.zeros(len(fidxv), cntsv.dtype)
cnts[self.valid[:mv]] = np.array(cntsv)[self.valid[:mv]]
# add INDEX contents in CORR files
self.outfile.create_dataset(idx_base + "{}/first".format(do), self.outfile.create_dataset(idx_base + "{}/first".format(do),
fidx.shape, fidxv.shape,
dtype=fidx.dtype, dtype=fidxv.dtype,
data=fidx, data=fidxv,
fletcher32=True) fletcher32=True)
self.outfile.create_dataset(idx_base + "{}/count".format(do), self.outfile.create_dataset(idx_base + "{}/count".format(do),
cnts.shape, cntsv.shape,
dtype=cnts.dtype, dtype=cntsv.dtype,
data=cnts, data=cntsv,
fletcher32=True) fletcher32=True)
def create_output_datasets(self): def create_output_datasets(self):
......
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