picadae calibration programs
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

calibrate_plot.py 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ##| Copyright: (C) 2019-2020 Kevin Larke <contact AT larke DOT org>
  2. ##| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
  3. import os,sys,json
  4. import common
  5. import matplotlib.pyplot as plt
  6. import plot_seq_1
  7. def plot_calibrate( cfg, pitch, dataD ):
  8. dataL = [ (d['pulse_us'], d['hm']['db'], d['targetDb'], d['matchFl'],d['skipMeasFl'],d['annIdx']) for d in dataD['measD'][pitch] ]
  9. udmL = [(t[0],t[1],t[3]) for t in dataL]
  10. udmL = sorted( udmL, key=lambda x: x[0] )
  11. usL,dbL,matchL = zip(*udmL)
  12. fig,ax = plt.subplots()
  13. musL = [us for us,db,m in udmL if m]
  14. mdbL = [db for us,db,m in udmL if m]
  15. ax.plot(musL,mdbL,marker='o',color='red',linestyle='None')
  16. ax.plot(usL,dbL,marker='.')
  17. initDataDir = os.path.expanduser(dataD['cfg']['inDir'])
  18. usL,dbL,_,_,_ = plot_seq_1.get_merged_pulse_db_measurements( initDataDir, int(pitch), cfg['analysisD'] )
  19. ax.plot(usL,dbL,marker='.')
  20. plt.show()
  21. if __name__ == "__main__":
  22. inDir = sys.argv[1]
  23. cfgFn = sys.argv[2]
  24. pitch = sys.argv[3]
  25. cfg = common.parse_yaml_cfg(cfgFn)
  26. cfg = cfg.calibrateArgs
  27. dataFn = os.path.join(inDir,"meas.json")
  28. with open(dataFn,"r") as f:
  29. dataD = json.load(f)
  30. print("pitchL:",dataD['cfg']['pitchL'],"targetDbL:",dataD['cfg']['targetDbL'])
  31. plot_calibrate( cfg, pitch, dataD )