Terrabits / rohdeschwarz

Rohde & Schwarz python instrument control toolbox
https://vna.rs-us.net/python/
Other
37 stars 18 forks source link

CW Mode measurement error #2

Closed Streyder closed 8 years ago

Streyder commented 8 years ago

Hey Dev Team,

I am currently trying to get a CW Mode measurement with only 1 data point going. As soon as I call trace.measuremeasure_complex_data() I get an error in line 148 on vnatrace.py: UnboundLocalError: local variable 'x' referenced before assignment.

I looked at the code above and recognized that x is only assigned if I use a frequency or power sweep. I would assume x should be an index when doing a CW Mode measurement.

Am I using the library wrong for CW Mode measurements? If so: where can I find an example on how to do it properly?

Best Kevin

Terrabits commented 8 years ago

Hey Kevin,

Looking at VnaTrace.py as well, I am apparently not handling cases other than frequency and power sweeps. I will add support for CW and time sweeps and release an updated version.

Thanks for the input. Nick

Terrabits commented 8 years ago

Kevin,

I pushed a new version of the project to github and PyPi (0.5.4dev1) that handles CW and Time sweeps correctly. I tested it on my system and it's working. Can you try it and let me know how it works for you?

You are using it correctly; you don't have to do anything special, just call: x, y = vna.trace('name').measure_complex_data()

and yes, the x values for CW are just index numbers. So for your single-point case, you'd get: x = [1.] y = []

I'd be interested to know what your use-case for CW is (I don't run into that mode very often). You can email me if you don't mind sharing:

nick.lalic@rsa.rohde-schwarz.com

Nick

Streyder commented 8 years ago

Hi Nick,

thanks for the quick fix! CW Mode seems to be working pretty nice on my end as well.

I sent you an e-mail explaining our use case.

Thanks Again, Kevin