Skip to content

Commit

Permalink
now addpar_flag is an option to preserve the previous .addpar file du…
Browse files Browse the repository at this point in the history
…ring external_calibration (raw_orient) and write it during full_calibration (orient)
  • Loading branch information
alexlib committed Oct 15, 2019
1 parent 723c085 commit 5d93519
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions pyptv/calibration_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def _button_fine_orient_fired(self):
except:
raise ValueError("full calibration failed\n")
# save the results
self._write_ori(i_cam)
self._write_ori(i_cam,addpar_flag=True)


# Plot the output
Expand All @@ -823,12 +823,19 @@ def _button_fine_orient_fired(self):

self.status_text = "Orientation finished."

def _write_ori(self, i_cam):
def _write_ori(self, i_cam, addpar_flag = False):
""" Writes ORI and ADDPAR files for a single calibration result
of i_cam
addpar_flag is a boolean that allows to keep previous addpar
otherwise external_calibration overwrites zeros
"""

ori = self.calParams.img_ori[i_cam]
addpar = ori.replace('ori', 'addpar')
if addpar_flag:
addpar = ori.replace('ori', 'addpar')
else:
addpar = 'tmp.addpar'

print("Saving:", ori, addpar)
self.cals[i_cam].write(ori.encode(), addpar.encode())
if self.epar.Examine_Flag and not self.epar.Combine_Flag:
Expand Down
2 changes: 1 addition & 1 deletion pyptv/ptv.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,5 +449,5 @@ def py_multiplanecalibration(exp):
residuals, targ_ix, err_est = full_calibration(exp.cals[0], all_known, targs, exp.cpar, flags)

#Save the results
exp._write_ori(i_cam)
exp._write_ori(i_cam,addpar_flag=True) # addpar_flag to save addpar file
print('End multiplane')

0 comments on commit 5d93519

Please sign in to comment.