From ffe1b4a339006862aa0efd880c4674ca1480acc5 Mon Sep 17 00:00:00 2001 From: Arnaud Le Fur Date: Fri, 11 Sep 2026 15:35:48 -0400 Subject: [PATCH] Record the boresight the transform ran about The boresight is recomputed for every frame from its altitude, so the parameters alone do not describe the transform that ran. writeTransformToDB sends it to mcs_pfi_transformation alongside them. Drop the write to mcs_boresight. That table is keyed by visit and takes only the first iteration's value, which is neither the calibration nor a record of what the other iterations used; what it should hold instead is a separate question. mcsActor is left with no reference to it. Co-Authored-By: Claude Opus 5 (1M context) --- python/mcsActor/mcsRoutines/dbRoutinesMCS.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/python/mcsActor/mcsRoutines/dbRoutinesMCS.py b/python/mcsActor/mcsRoutines/dbRoutinesMCS.py index 05be97b..0d2c644 100644 --- a/python/mcsActor/mcsRoutines/dbRoutinesMCS.py +++ b/python/mcsActor/mcsRoutines/dbRoutinesMCS.py @@ -9,7 +9,6 @@ mcs_data (write) mcs_exposure (write, read) -mcs_boresight (read, write in calibration mode) mcs_pfi_transformation (write) cobra_target (read) cobra_match (write) @@ -81,25 +80,21 @@ def loadTargetsFromDB(db, frameId): def writeTransformToDB(db, frameId, pfiTransform, cameraName, doCloseTransaction=False): """Write [x0,y0,theta,dscale,scale2,alpha_rot,camera_name] for one frame into mcs_pfi_transformation. - If doCloseTransaction=True and a transaction is already active, commit here; else delegate to db.insert(). - """ - pfs_visit_id = frameId // 100 - iteration = frameId % 100 - # just recording mcs_boresight for the first iteration. - if iteration == 0: - db.insert_kw('mcs_boresight', - pfs_visit_id=pfs_visit_id, - mcs_boresight_x_pix=float(pfiTransform.mcs_boresight_x_pix), - mcs_boresight_y_pix=float(pfiTransform.mcs_boresight_y_pix), - calculated_at='now') + The boresight the transform was applied about goes with them: it is recomputed from + the altitude of every frame, so the parameters alone do not describe the transform + that ran. + If doCloseTransaction=True and a transaction is already active, commit here; else delegate to db.insert(). + """ mcsDistortCols = ['x0', 'y0', 'theta', 'dscale', 'scale2'] df = pd.DataFrame(pfiTransform.mcsDistort.getArgs().reshape(1, len(mcsDistortCols)), columns=mcsDistortCols) df['mcs_frame_id'] = frameId df['alpha_rot'] = float(pfiTransform.alphaRot) df['camera_name'] = cameraName + df['mcs_boresight_x_pix'] = float(pfiTransform.mcs_boresight_x_pix) + df['mcs_boresight_y_pix'] = float(pfiTransform.mcs_boresight_y_pix) db.insert_dataframe('mcs_pfi_transformation', df)