Class VL_OpticalSetups
- Namespace
- VirtualLab.Programming
- Assembly
- VirtualLab.Programming.dll
This class provides methods for changing parameters of an Optical Setup (if you want to write your own parameter variation) and for working with Parameter Runs (if you want to vary parameters this way).
public static class VL_OpticalSetups
- Inheritance
-
VL_OpticalSetups
- Inherited Members
Methods
GetAllResultNames(ParameterRun)
Gets all result names which you can access with the methods GetParameterValues(Lightpath, string) and GetDocumentResults<T>(ParameterRun, out bool, string, string). Detector name and sub-detector name are separated by VirtualLabAPI.Core.ParameterRuns.ParameterRunSupportFunctions.IdentificationStringSeparator (" || "). Only the first iteration is evaluated, thus this method does not work correctly if different iterations yield results for different sub-detectors.
public static List<string> GetAllResultNames(this ParameterRun parameterRun)
Parameters
parameterRunParameterRunThe parameter run from which the results are retrieved.
Returns
Exceptions
- ArgumentException
Parameter Run contains no results.
GetDocumentResults<T>(ParameterRun, out bool, string, string)
Gets all document results of the first matching detector (and maybe sub-detector).
public static List<T?> GetDocumentResults<T>(this ParameterRun parameterRun, out bool areNullEntries, string partialDetectorName, string partialSubDetectorName = "") where T : class, IDocument
Parameters
parameterRunParameterRunThe parameter run from which the results are retrieved.
areNullEntriesboolReturns whether there are
nullentries.partialDetectorNamestringA filter string to find the desired detector name. It can contain multiple words and word groups (marked by quotation marks) which must all be in the detector name. Can be empty if there is only one detector.
partialSubDetectorNamestringA filter string to find the desired sub-detector name. It can contain multiple words and word groups (marked by quotation marks) which must all be in the sub-detector name. Can be omitted if the specified detector returned only one document.
Returns
- List<T>
The list with the desired documents. A list with
nullentries if the detector results are not of the given type.
Type Parameters
TThe type of the detector results, e.g. DataArray2D.
Exceptions
- ArgumentException
Parameter Run contains no results. or Matching detector could not be found. or No results for given detector. or Found results do not have the given type.
GetParameterValues(Lightpath, string)
Gets the values of the specified parameters of this Optical Setup. To this end you specify strings which you can find for example in the Parameter Overview Table.
public static List<PhysicalValue> GetParameterValues(this Lightpath opticalSetup, string filterString)
Parameters
opticalSetupLightpathThe optical setup from which the parameters are extracted. Note that for a Optical Setup variable e.g. named
os, you can directly writeos.GetParameterValues(…)without this parameter.filterStringstringThe filter string. Can contain multiple words and word groups embraced by quotation marks, for example: "surface #1" scaling.
Returns
- List<PhysicalValue>
A list with all parameters containing all given words or word groups in their complete parameter name including object names and categories (if applicable). The matching is done case insensitive.
The parameters are given as PhysicalValue including also their current value.
GetPhysicalValueResults(ParameterRun, string, string, bool)
Gets all physical value results of the first matching detector (and maybe sub-detector), including varied and coupled parameters.
public static List<PhysicalValueBase?> GetPhysicalValueResults(this ParameterRun parameterRun, string partialDetectorName, string partialSubDetectorName, bool searchVariedParametersFirst = false)
Parameters
parameterRunParameterRunThe parameter run from which the results are retrieved.
partialDetectorNamestringA filter string to find the desired detector name. It can contain multiple words and word groups (marked by quotation marks) which must all be in the detector name. Can be empty if there is only one detector. You can useVirtualLabAPI.Core.ParameterRuns.ParameterRunSupportFunctions.VariedParametersString to retrieve a certain varied parameter and VirtualLabAPI.Core.LightPath.CoupledParameterContainer.CoupledParametersString to retrieve a certain coupled parameter (if present).
partialSubDetectorNamestringA filter string to find the desired sub-detector name. It can contain multiple words and word groups (marked by quotation marks) which must all be in the sub-detector name.
searchVariedParametersFirstboolBy default, first the detector results are searched and then the varied (and maybe coupled) parameters. Set this optional parameter to
trueto change this behavior.
Returns
- List<PhysicalValueBase>
The list with the desired physical values (one entry for each iteration of the Parameter Run).
Exceptions
- ArgumentException
Parameter Run contains no results. or Matching detector could not be found. or No results for given detector. or Given detector does not yield physical values. or A matching sub-detector could not be found in the sub-detectors of the specified detector.
SetParameterValue(Lightpath, PhysicalValue)
Method to set a single value which was retrieved with the GetParameterValues(Lightpath, string) method and changed externally back to the Optical Setup.
public static void SetParameterValue(this Lightpath opticalSetup, PhysicalValue valueToSet)
Parameters
opticalSetupLightpathThe optical setup from which the parameters are extracted. Note that for a Optical Setup variable e.g. named
os, you can directly writeos.SetParameterValue(…)without this parameter.valueToSetPhysicalValueThe value to set. The comment must match the complete name of the parameter in the Optical Setup.
Exceptions
- ArgumentException
Comment of given value matches no parameter of the Optical Setup. or Comment of given value matches more than one parameter of the Optical Setup.