hawxgamer

Untitled

Mar 20th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. import sys, getopt
  2.  
  3. from Tools.scripts.treesync import raw_input
  4.  
  5. STARTFREQ = 100000000
  6. STOPFREQ=2700000000
  7. SWEEP=200000000
  8.  
  9. MSG_START_DEVICE_DETECTION="Start searching for GPIB devices"
  10. MSG_START_MEASUREMENT="Starting measurement for device "
  11. MSG_STOP_MEASUREMENT="Finished measurement for device "
  12. MSG_REMAINING_MEASUREMENT="Reamining measurements for the device(s) "
  13. MSG_WARNING_MEASUREMENT="Please terminate all the remaining devices except "
  14. MSG_USER_INTERACTION="Press enter to continue "
  15. MSG_NEWLINE="\n"
  16. MSG_SPACE=" "
  17.  
  18. def main(argv):
  19. version = '1.0'
  20. verbose = False
  21. startfrequency = 100000000
  22. stopfrequency=2700000000
  23. sweep=200000000
  24.  
  25. print('ARGV :', argv[1:])
  26.  
  27. ParseCommandLine(startfrequency, stopfrequency, sweep, version)
  28.  
  29. # SCPI Get List
  30. mylist=0
  31.  
  32. for device in mylist:
  33. print(MSG_START_MEASUREMENT + device.gpibaddress + MSG_NEWLINE)
  34. print(MSG_USER_INTERACTION + device.gpibaddress + MSG_SPACE + device.name + MSG_NEWLINE)
  35. WaitForInput()
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. def WaitForInput():
  43. python2 = sys.version_info[0] == 2
  44. if python2:
  45. raw_input("Press ENTER to continue.")
  46. else:
  47. input("Press ENTER to continue.")
  48.  
  49.  
  50. def ParseCommandLine(startfrequency, stopfrequency, sweep, version):
  51. try:
  52. options, remainder = getopt.getopt(sys.argv[1:], 'l:t:s:', ['lowfreq=',
  53. 'topfreq=',
  54. 'sweep=',
  55. 'version',
  56. ])
  57. except getopt.GetoptError:
  58. sys.exit(2)
  59. print('OPTIONS :', options)
  60. for opt, arg in options:
  61. if opt in ('-l', '--lowfreq'):
  62. startfrequency = arg
  63. elif opt in ('-t', '--topfreq'):
  64. stopfrequency = arg
  65. elif opt in ('-s', '--sweep'):
  66. sweep = arg
  67. elif opt == '--version':
  68. print('VERSION {0} by Mustafa Tunca, DMCE Linz', version)
  69. print('VERSION :', version)
  70. print('VERBOSE :', startfrequency)
  71. print('OUTPUT :', stopfrequency)
  72. print('REMAINING :', sweep)
  73.  
  74.  
  75. if __name__ == "__main__":
  76. main(sys.argv[1:])
Advertisement
Add Comment
Please, Sign In to add comment