Skip to content
Snippets Groups Projects
Commit 0a6caedf authored by Francois Perrin's avatar Francois Perrin
Browse files

change of the threshold value for pixel validity check.

Can be increased close to the metropro constant.
Suggestion of another method using numpy 
optimized function.
parent a54e1b4e
No related branches found
No related tags found
1 merge request!3Change of the threshold value for pixel validity check.
......@@ -139,13 +139,21 @@ def readDatFile(fileName):
d['mask'] = np.ones_like(d['data_pixel'], dtype='bool')
# little comment: numpy as some optimized functions to perform the same test
# see: https://numpy.org/devdocs/reference/generated/numpy.where.html
# d['data_pixel'] = np.where(d['data_pixel'] < 2e9,
# d['data_pixel'],
# badpixelValue)
# d['mask'] = np.where(d['data_pixel'] < 2e9,)
# d['mask'],
# badpixelValue)
for i in range(0,d['cn_height']):
for j in range(0,d['cn_width']):
if d['data_pixel'][i][j]>1e7:#2017151:#2097151
if d['data_pixel'][i][j]>2e9: # invalid pixel is set at 2147483640 with int32
d['data_pixel'][i][j] = badpixelValue
d['mask'][i][j] = 0
elif d['data_pixel'][i][j]<-1e7:#-2017152:#2097152
elif d['data_pixel'][i][j]<-2e9: # XXX: is this test necessary ?
d['data_pixel'][i][j] =badpixelValue
d['mask'][i][j] = 0
else:
......@@ -213,4 +221,4 @@ if __name__ == "__main__":
# print(d['ac_org_y'])
# print(d['cn_org_x'])
# print(d['cn_org_y'])
# np.savetxt('X:\Fizeau data\sharper head\\h.txt', d["nanometers"], delimiter=',')
\ No newline at end of file
# np.savetxt('X:\Fizeau data\sharper head\\h.txt', d["nanometers"], delimiter=',')
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