Python API library for interaction with G2V Optics Pico.
pip install git+https://git@github.com/g2v-optics/G2VPico.git@mainExample scripts are available in the examples directory.
Please note that the examples directory will not be installed with the setup but can be downloaded through GitHub.
To make use of this capability, you must have the following equipment:
- A G2V Pico Solar Simulator
- A computer with a python environment installed (https://www.python.org/)
- An ethernet connection between your computer and the G2V Pico
The Python API requires two pieces of information in order to create a Pico object:
- IP address of the Pico on the network: Can be found by typing ifconfig in a terminal on the Pico control box, or hovering the mouse over the network connection icon in the top right of the screen.
- Example:
192.168.1.70
- Example:
- Pico ID: Can be found by looking in the bottom-right of any screen on the Pico GUI software, just below the version number.
- Example:
00000000c2ca735f
- Example:
from g2vpico import G2VPico
# Create a Pico instance using the IP address and the Pico ID assigned to the Pico
pico = G2VPico('192.168.1.70', '00000000c2ca735f')
# Get the number of channels avaialble
num_channels = pico.channel_count
# Turn channel 1 to a value of 50
pico.set_channel_value(1, 50)
# Read out the value of channel 5
pico.get_channel_value(5)Bases: object
A class used to represent a G2V Pico
ip_address: The IP address of the Pico on the networkpico_id: The 16 character ID of the Pico
The number of channels available in the Pico
int: The number of channels available
A list of the available channels in the Pico
list: List of channels with typeint
The ID of the Pico used to intialize the object
str: The ID of the Pico
Set all channels in the Pico to a value of 0
bool: True when all channels have been set to 0
Returns the maximum limit [0-4096] of the channel. This limit is the maximum value that can be used when setting the channel value.
channel: The channel number in the range [1, channel_count]
int: The maximum limit of the channel in the range [0, 4096]
ValueError: Raised when the channel parameter is an invalid typeValueError: Raised when the channel is not in the range [0, channel_count]
Returns the current PWM value of the channel
channel: The channel number in the range [1, channel_count]
int: The current value of the channel in the range [0, 4096]
ValueError: Raised when the channel parameter is an invalid type
Returns the minimum and maximum wavelength values for a channel in nm
channel: The channel number in the range [1, channel_count]
list: A list where index 0 is the minimum wavelength and index 1 is the maximum wavelength Units are nm
ValueError: Raised when the channel parameter is an invalid typeValueError: Raised when the channel is not in the range [0, channel_count]
Returns the global intensity that is applied to all channels
float: A value between 0.0 and 100.0 where 100.0 means all channels are fully on and a value of 0.0 means all channels are 0.
Get the current spectrum as a list of dict itmes
list: A list of dict items channel and value keys forming the current spectrum in the Pico.
Returns whether the fixture is on or off
bool: True if the fixture is on and False if the fixture is off
Sets the chosen channel to the specified value.
channel: The channel number in the range [1, channel_count]value: The value to set the chosen channel to in the range [0, channel_limit]
bool: True if the channel has been set to the new value and False if it has not changed
ValueError: Raised when the channel parameter is an invalid typeValueError: Raised when the channel is not in the range [0, channel_count]ValueError: Raised when the value parameter is an invalid type
Sets the global intensity that is applied to all channels. Note that the new global intensity will take effect immediately.
value: The value of the new global intensity in the range [0.0, 100.0]
bool: True if the global intensity has been set successfully and False if not
Load in a spectrum either as a json string or a dictionary. Channels are changed individually so operation is not instantaneous.
channel_list:str- A JSON formatted string contain channels and their corresponding valueslist- A list of dict objects containing ‘channel’ and ‘value’ keys
bool: True if the new spectrum has been loaded and False if not
ValueError: If the spectrum data in channel_list is invalid when of str typeValueError: If the type of channel_list is invalidValueError: Raised when the channel value is an invalid typeValueError: Raised when the channel is not in the range [0, channel_count]
Turns the fixture off while preserving channel values
bool: True if the fixture was turned off and False if the fixture failed to turn off
Turns the fixture on with previously stored spectrum
bool: True if the fixture was turned on and False if the fixture failed to turn on