コード例 #1
0
ファイル: wfmutil.py プロジェクト: pklaus/pyRigolWFM
    args = parser.parse_args()

    try:
        with args.infile as f:
            scopeData = wfm.parseRigolWFM(f, args.forgiving)
    except wfm.FormatError as e:
        print(
            "Format does not follow the known file format. Try the --forgiving option.",
            file=sys.stderr)
        print("If you'd like to help development, please report this error:\n",
              file=sys.stderr)
        print(e, file=sys.stderr)
        sys.exit()

    scopeDataDsc = wfm.describeScopeData(scopeData)

    if args.action == "info":
        print(scopeDataDsc)

    if args.action == "csv":
        if scopeData["alternateTrigger"]:
            # In alternateTrigger mode, there are two time scales
            assert scopeData["channel"][1]["nsamples"] == scopeData["channel"][
                2]["nsamples"]

            print("X(CH1),CH1,X(CH2),CH2,")
            print("Second,Volt,Second,Volt,")
            for i in range(scopeData["channel"][1]["nsamples"]):
                for channel in range(1, 3):
                    sampleDict = scopeData["channel"][channel]["samples"]
コード例 #2
0
def info(args, scopeData, outfile):
    scopeDataDsc = wfm.describeScopeData(scopeData)
    print(scopeDataDsc, file=outfile)
コード例 #3
0
ファイル: wfmutil.py プロジェクト: alberto-fc/pyRigolWFM
 parser.add_argument('action', choices=['info', 'csv', 'plot', 'json', 'vcd', 'ols'], help="Action")
 parser.add_argument('infile', type=argparse.FileType('rb'))
 parser.add_argument('--forgiving', action='store_false', help="Lazier file parsing")
 
 args = parser.parse_args()
 
 try:
   with args.infile as f:
     scopeData = wfm.parseRigolWFM(f, args.forgiving)
 except wfm.FormatError as e:
   print("Format does not follow the known file format. Try the --forgiving option.", file=sys.stderr)
   print("If you'd like to help development, please report this error:\n", file=sys.stderr)
   print(e, file=sys.stderr)
   sys.exit()
 
 scopeDataDsc = wfm.describeScopeData(scopeData)
 
 if args.action == "info":
   print(scopeDataDsc)
   
 if args.action == "csv":
   if scopeData["alternateTrigger"]:
     # In alternateTrigger mode, there are two time scales
     assert scopeData["channel"][1]["nsamples"] == scopeData["channel"][2]["nsamples"]
     
     print("X(CH1),CH1,X(CH2),CH2,")
     print("Second,Volt,Second,Volt,")
     for i in range(scopeData["channel"][1]["nsamples"]):
       for channel in range(1,3):
         sampleDict = scopeData["channel"][channel]["samples"]
         print("%0.5e,%0.2e," % (sampleDict["time"][i], sampleDict["volts"][i]), end='')
コード例 #4
0
ファイル: wfmutil.py プロジェクト: pklaus/pyRigolWfm1000Z
def info(args, scopeData, outfile):
    scopeDataDsc = wfm.describeScopeData(scopeData)
    print(scopeDataDsc, file=outfile)