Redesign the verify method of the aperture class
mgennaro opened this issue · 0 comments
mgennaro commented
The verify() method:
Line 1495 in caaaecc
is seemingly used to verify that the X/YDetRef and X/YSciRef, however that verification seems to fail multiple times, possibly due to issues with the code itself.
I have a straw-man code below that could be used to build a more robust verify method:
def self_consistency_check(aperture):
try:
XrDet = aperture.XDetRef
YrDet = aperture.YDetRef
XrSci = aperture.XSciRef
YrSci = aperture.YSciRef
Xsz = aperture.XSciSize
Ysz = aperture.YSciSize
XcDet,YcDet = aperture.dms_corner()
if aperture.DetSciYAngle == 0:
Xrdms_full = 2049. - XrDet
Yrdms_full = YrDet
Xcdms_tmp = 2050. - XcDet - Xsz
Ycdms_tmp = YcDet
else:
Xrdms_full = XrDet
Yrdms_full = 2049. - YrDet
Xcdms_tmp = XcDet
Ycdms_tmp = 2050. - YcDet - Ysz
Xcheck = Xrdms_full - Xcdms_tmp+1
Ycheck = Yrdms_full - Ycdms_tmp+1
dx = Xcheck-XrSci
dy = Ycheck-YrSci
print('{:30} {:9.7f} {:9.7f}'.format(aperture.AperName,dx,dy))
except:
print(aperture.AperName,aperture.AperType)