Skip to content

ericddm/Python-dotNet-5820

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PXIe-5820 Python .NET Example

This examples shows how to setup the enviroment and run very basics RF examples from Python. There are two approaches: calling the CLR (Common Language Runtime) to directly interface with .NET classes and creating wrappers around the driver c dll using cpython. These examples use Python .NET as a way of importing the .NET classes into Python.

Please be aware that NI-RFSA neither NI-RFSG APIs are officially supported in Python. Official support is provided through .NET and LabVIEW APIs. This is provided as a last resort alternative but please remember that any issue, it being usability or bugs not reproducible in .NET or LabVIEW, will be your responsability.

Setting up Environment

  • Install Python 3.6.4

    • Version of Python is tied to Python .NET, pick your version according to their support
    • Install launcher for all users
    • Add Python 3.6 to PATH
    • Customization (pip, Documentation, IDLE, Test Suite, py launcher)
    • Everything else left as default (03-26-2018)
  • Install Software Support

  • Install some Python Packages

    • python -m pip install -U pip setuptools
    • python -m pip install matplotlib
    • python -m pip install numpy
  • Install pythonnet

  • Install .NET Framework 4.6.1

Testing the Environment

This scripts simply loads the clr and the RFSA .NET class library

 python source\PythondotNetTest.py

Examples

RFSGGettingStartedIQDevice.py

This python script was created based on the RFSA example called: "RFSG Getting Started Finite Generation (IQ Device).vi"

RFSAGettingStartedIQDevice.py

This python script was created based on the RFSA example called: "RFSA Getting Started IQ (IQ Device).vi"

Example using both RFSA and RFSG

Instrument set with a pair mmpx cables looping I In (+/-) to I Out (+/-). The RFSG example will continuously generate until the user presses "enter". Please note that the acquired tone frequency is configured by shifting by 1 KHz the IQ Out Carrier Frequency instead of generating a waveform of 1 KHz at the configure IQ Rate. Run RFSG first which will continuously generate a tone and then run the RFSA script.

python source\RFSGGettingStartedIQDevice.py --resource <your device name>
python source\RFSAGettingStartedIQDevice.py --resource <your device name>

Example using both RFSA and RFSG with a trigger

This example is very similar to first none triggered example but configures the RFSG to export a start trigger and the RFSA to wait 10 seconds for a trigger. Expected string can be found in the RFSA/G API help.

python source\RFSAGettingStartedIQDevice.py --resource <your device name> --trigger PXI_Trig0
python source\RFSGGettingStartedIQDevice.py --resource <your device name> --trigger PXI_Trig0

Example using both RFSA and RFSG with a marker

This example shows how to generate a trigger with a marker at a specific sample of the waveform. Using the timeout as a test you can now start the generation first and trigger your acquisition later because, everytime the generation loops the wfm, a trigger is sent over the selected terminal. In the previous example only the StartEvent sent out a trigger and this only happnes the first iteration of the waveform generation.

python source\RFSGGettingStartedIQDevice.py --resource <your device name> --marker PXI_Trig0
python source\RFSAGettingStartedIQDevice.py --resource <your device name> --trigger PXI_Trig0

ILoopback

Documentation

License

MIT License

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages