Beispiel #1
0
    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"]
Beispiel #2
0
def info(args, scopeData, outfile):
    scopeDataDsc = wfm.describeScopeData(scopeData)
    print(scopeDataDsc, file=outfile)
Beispiel #3
0
 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='')
Beispiel #4
0
def info(args, scopeData, outfile):
    scopeDataDsc = wfm.describeScopeData(scopeData)
    print(scopeDataDsc, file=outfile)