Wavelength Functions#

These functions configure the wavelength settings of the optical system.

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_AddWavelength(self, wavelength_micrometers: float, wavelength_weight: float = 1.0) ZOSAPI_SystemData_IWavelength[source]#

Adds a new wavelength to the system.

Parameters:
  • wavelength_micrometers (float) – The wavelength - in microns - to add to the system.

  • wavelength_weight (float, optional) – Weight to give the wavelength, defaults to 1.0

Returns:

The newly added wavelength object.

Return type:

ZOSAPI_SystemData_IWavelength

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_GetAllSystemWavelengthsAsMicrometers(self) ndarray[source]#

Returns an array of all the system wavelengths, ordered by their Zemax index, in units of micrometers.

Returns:

The wavelengths configured in the system.

Return type:

np.ndarray

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_GetAllSystemWavelengthsWeights(self) ndarray[source]#

Returns an array of all the system wavelength weights, ordered by their Zemax index.

Returns:

The wavelength weights configured in the system.

Return type:

np.ndarray

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_GetNamesOfAllPresets(self, print_to_console: bool = False) list[source]#

This function builds a list of all the the preset wavelengths configurations in Zemax. This can be useful to look up what one may want to code as input to functions like Wavelength_SelectWavelengthPreset().

Parameters:

print_to_console (bool, optional) – If True will print to console, defaults to False

Returns:

A list of the names of all preset wavelengthss in Zemax.

Return type:

list

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_GetNumberOfWavelengths(self) int[source]#

Returns number of wavelengths in the system.

Returns:

The number of wavelengths configured in the system.

Return type:

int

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_GetPrimaryWavelength(self) ZOSAPI_SystemData_IWavelength[source]#

Returns the wavelength which is the primary one in the system

Returns:

The primary wavelength object.

Return type:

ZOSAPI_SystemData_IWavelength

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_GetPrimaryWavelengthAsMicrometers(self) float[source]#

Returns the micrometer value of the wavelength which is the primary one in the system

Returns:

The primary wavelength in micrometers.

Return type:

float

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_GetWavelength(self, wavelengthNum: int = 1) ZOSAPI_SystemData_IWavelength[source]#

Gets the wavelength entry at index.

Parameters:

wavelengthNum (int, optional) – Index of wavelength entry to lookup, defaults to 1

Returns:

The object associated with that wavelength.

Return type:

ZOSAPI_SystemData_IWavelength

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_GetWavelengthByMicrometers(self, wavelength_micrometers: float, add_if_not_in_system: bool = True, weight_of_added_wavelength: float = 1.0) ZOSAPI_SystemData_IWavelength[source]#

Gets the wavelength entry by the micrometer value (instead of index value like Wavelength_GetWavelength()). By default behavior, the specified micrometer wavelength will be added if it is not found in the system and returned automatically. If this behavior is turned off and the wavelength is not found then None will be returned

Parameters:
  • wavelength_micrometers (float) – The wavelength in micrometers to lookup.

  • add_if_not_in_system (bool) – If True and the given wavelength is not found then it will be added to the system, defaults to True

  • weight_of_added_wavelength (bool) – If wavelength is to be added to the system then this will be the assigned weight.

Returns:

The object associated with the wavelength.

Return type:

ZOSAPI_SystemData_IWavelength

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_RemoveAllButPrimaryWavelength(self) None[source]#

Removes all wavelengths in the current system except the primary wavelength.

Returns:

None

Return type:

None

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_RemoveWavelength(self, in_wavelength: int | ZOSAPI_SystemData_IWavelength) bool[source]#

Deletes/removes a wavelengths from the system

Parameters:

in_wavelength (Union[int, ZOSAPI_SystemData_IWavelength]) – The wavelength to remove - either an index or the wavelength object.

Returns:

True if the wavelength is valid and there were at least two wavelengths in the system, else False.

Return type:

bool

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_RemoveWavelengthByMicrometers(self, wavelength_micrometers: float) bool[source]#

Removes the wavelength entry by the micrometer value (instead of index or ZOSAPI_SystemData_IWavelength value like Wavelength_RemoveWavelength()). If wavelength doesn’t exist then this function effectively does nothing.

Parameters:

wavelength_micrometers (float) – The wavelength in micrometers to remove.

Returns:

True if the wavelength is valid and there were at least two wavelengths in the system, else False.

Return type:

ZOSAPI_SystemData_IWavelength

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_SelectWavelengthPreset(self, preset: str = 'd_0p587') None[source]#

Configures the system’s wavelengths to one of the named preset configurations within Zemax.

See Wavelength_GetNamesOfAllPresets() to extract the names in python.

If more than one preset could match the specified string, the first one sorted by ascending length, then alphabet, is taken.

Parameters:

preset (str, optional) – Name of the preset to use, defaults to “d_0p587”

skZemax.skZemax_subfunctions._wavelength_functions.Wavelength_SetPrimaryWavelength(self, in_wavelength: int | ZOSAPI_SystemData_IWavelength) ZOSAPI_SystemData_IWavelength[source]#

Sets the wavelength as the primary one in the system

Parameters:

in_wavelength (Union[int, ZOSAPI_SystemData_IWavelength]) – The wavelength to make primary - either an index or the wavelength object.

Returns:

The primary wavelength object.

Return type:

ZOSAPI_SystemData_IWavelength