Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyApex

Python3 Library for controlling Apex equipments


Installation

  1. Download the package PyApex

  2. Unzip it and move it in the "Lib" directory of your Python 3.x distribution

Using

  1. To access to the help and see all possibilities of PyApex, import the module :
    import PyApex
    help(PyApex)
    With PyApex, you can communicate with AP1000 (Ethernet), AP2XXX (Ethernet), AB3510 (USB) and XU Thermal Etuve (RS232).

    AP1000

    The AP1000 class allows you to control (via Ethernet) any AP1000 equipment (AP1000-2, AP1000-5 and AP1000-8)

  2. In your Python 3.x script, import the PyApex module. For exemple, if you want to remote control an AP1000 equipment, import the AP1000 sub-module of PyApex as below
    import PyApex.AP1000 as AP1000

  3. Connect to the equipment. For an AP1000, you can use
    MyAP1000 = AP1000("192.168.0.10", Simulation=False)
    where 192.168.0.10 is the IP address of the equipment
    and Simulation argument is a boolean to simulate the equipment

  4. To see the methods and attributs of the AP1000 class, do:
    help(MyAP1000)

  5. To initiate a module of an AP1000 equipement, use the corresponding class and give the slot number in parameter. For exemple, to control an AP1000 power meter module (AP3314), you can use
    MyPowerMeter = MyAP1000.PowerMeter(1)
    where 1 is the slot number of the module
    and for seeing the different methods and attributs associated to this module, do:
    help(MyPowerMeter)

  6. To close the connection to the equipment, use the Close function. For exemple
    MyAP1000.Close()

    AP2XXX

    The AP2XXX class allows you to control (via Ethernet) any OSA and OCSA equipment (AP2040, AP2050, AP2060, AP2443,...)

  7. In your Python 3.x script, import the PyApex module. For exemple, if you want to remote control an AP2040 equipment, import the AP2XXX sub-module of PyApex as below
    import PyApex.AP2XXX as AP2040

  8. Connect to the equipment:
    MyAP2040 = AP2040("192.168.0.10", Simulation=False)
    where 192.168.0.10 is the IP address of the equipment
    and Simulation argument is a boolean to simulate the equipment

  9. To see the methods and attributs of the AP2XXX class, do:
    help(MyAP2040)
    All functions of your AP2XXX are in sub-classes :
    MyOSA = MyAP2040.OSA() for the Heterodyne OSA
    MyPowerMeter = MyAP2040.Powermeter() for the powermeter, ...
    And, to see the methods and attributs of these sub-classes :
    help(MyOSA)
    help(MyPowerMeter)
  10. Finally, to close the connection to the equipment, use the Close function:
    MyAP2040.Close()

Here is a very simple example for controlling your OSA:

    # Import the AP2XXX class from the Apex Driver
    from PyApex import AP2XXX
    # Import pyplot for displaying the data
    from matplotlib import pyplot as plt

    # Connection to your OSA *** SET THE GOOD IP ADDRESS ***
    MyAP2XXX = AP2XXX("192.168.0.119")
    MyOSA = MyAP2XXX.OSA()

    # Set the parameters of your OSA
    # Here, we use wavelength X-Axis and set the span from 1532 to 1563 nm
    # We also set the number of points to 2000
    MyOSA.SetScaleXUnit("nm")
    MyOSA.SetStartWavelength(1532.0)
    MyOSA.SetStopWavelength(1563.0)
    MyOSA.DeactivateAutoNPoints()
    MyOSA.SetNPoints(2000)

    # We run a single
    Status = MyOSA.Run()
    # If the single is good (Status = 1), we get the data in a list Data = [[Power Data], [Wavelength Data]]
    if Status:
        Data = MyOSA.GetData()

    # The connection with the OSA is closed
    MyAP2XXX.Close()

    # The spectrum is displayed
    if Status:
        plt.grid(True)
        plt.plot(Data[1], Data[0])
        plt.xlabel("Wavelength (nm)")
        plt.ylabel("Power (dBm)")
        plt.show()
    else:
        print("No spectrum acquired")

About

Python3 Library for controlling Apex equipments

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages