ZOSAPI.Tools.Sequences.ISequenceSelector Interface Reference
Last update: 16.07.2025Tool interface for accessing and modifying NSC sequences, including options for generating sequences via different routines. This interface can be accessed via the relevant open method: IOpticalSystemTools.OpenSequenceSelector. More...

Public Member Functions | |
| bool | ContainsSequenceName (string name) |
| Whether the sequence list holds a sequence with the specified name. | |
| int? | IndexOfSequenceName (string name) |
| Get the index of the sequence with the specified name. | |
| ISequence | GetSequenceAt (int index) |
| Get the sequence at the specified index. | |
| ISequence | FindSequenceByName (string name) |
| Get the sequence with the specified name. | |
| void | ClearSequences () |
| Remove all sequences. | |
| void | DeleteSequence (int index) |
| Delete the sequence at the specified index. | |
| int | DeleteSequences (IEnumerable< int > indices) |
| Delete the sequences at each specified index. This can be used to conveniently delete multiple sequences, perhaps filtered by some custom condition, without needing to manually loop and take account of changing indices. | |
| int | DeleteSequenceRange (int start, int end) |
| Delete sequences in the index range [start, end). | |
| int | DeleteInvalidSequences () |
| Delete all sequences which are invalid. | |
| int | DeleteIncompleteSequences () |
| Delete all sequences which do not start with a source and end at a detector. | |
| int | DeleteSequencesBelowFlux (double minFlux) |
| Delete all sequences which have a flux value less than a given threshold. | |
| bool | EnableSequence (int index) |
| Enable the sequence at the specified index. | |
| bool | DisableSequence (int index) |
| Disable the sequence at the specified index. | |
| void | RenameSequence (int index, string newName) |
| Rename the sequence at the specified index. | |
| void | ReplaceSequence (int index, string sequence) |
| Replace the sequence at the specified index with a new sequence specified in filter format. | |
| void | ReplaceSequence (int index, IEnumerable< object > sequence) |
| Replace the sequence at the specified index with a new sequence, specified as an iterable of objects which can be cast to either SequenceElement or string. | |
| void | AddSequence (string sequence) |
| Append a new sequence, specified in sequence string format, to the sequence list. | |
| void | AddSequence (IEnumerable< object > sequence) |
| Append a new sequence, specified as an iterable of objects which can be cast to either SequenceElement or string, to the sequence list. | |
| int | OffsetObjectNumbersInSequence (int index, int startAtObject, int off) |
| Shift the object number values of all entries, starting from startAtObject, in the sequence at the specified index. | |
| int | OffsetObjectNumbersInSequence (int index, int startAtObject, int endAtObject, int off) |
| Shift the object number values of all entries, starting from startAtObject and ending at endAtObject (non-inclusive), in the sequence at the specified index. | |
| void | SortByAscendingFlux () |
| Sort the sequences in order of descending ISequence.Flux values. | |
| void | SortByDescendingFlux () |
| Sort the sequences in order of ascending ISequence.Flux values. | |
| void | SortByAscendingSize () |
| Sort the sequences in order of ascending number of entries. | |
| void | SortByDescendingSize () |
| Sort the sequences in order of descending number of entries. | |
| void | SortByAscendingNumDiffractions () |
| Sort the sequences in order of ascending number of diffraction events. | |
| void | SortByDescendingNumDiffractions () |
| Sort the sequences in order of descending number of diffraction events. | |
| void | LoadSequences (string filePath) |
| Load sequences from a JSON file. These will replace the currently held sequences on success. | |
| void | InsertSequencesFromFile (string filePath) |
| Insert sequences from a JSON file. These will be added to the currently held sequence list on success. | |
| void | SaveSequences (string filePath, bool formatted=false) |
| Save all the sequences to a JSON file. | |
| IStraightThroughPathsGenerationSettings | SelectStraightThroughPathsGeneration () |
| Create a new settings object for the straight through paths generator option, and set the GenerationSettings property to this to select this method of generation. | |
| IFromPathAnalysisGenerationSettings | SelectFromPathAnalysisGeneration () |
| Create a new settings object for the from pre-run Path Analysis generator option, and set the GenerationSettings property to this to select this method of generation. | |
| IViaZRDOrPAFGenerationSettings | SelectViaZRDOrPAFGeneration () |
| Create a new settings object for the via ZRD or PAF file generator option, and set the GenerationSettings property to this to select this method of generation. | |
| bool | Undo () |
| Defined for internal testing purposes. | |
Public Member Functions inherited from ZOSAPI.Tools.ISystemTool | |
| bool | Run () |
| Start the tool. Note that for synchronous tools (see IsAsynchronous), this call will block until completion. If it is asynchronous it will start running but return immediately. | |
| bool | RunAndWaitForCompletion () |
| Sames as calling Run followed by WaitForCompletion. | |
| bool | WaitForCompletion () |
| Waits for the asynchronous tool to complete. | |
| bool | Cancel () |
| Cancels the currently running asynchronous tool. | |
| bool | Close () |
| Closes this tool and frees up and associated resources. | |
| RunStatus | WaitWithTimeout (double timeOutSeconds) |
| Waits for the currently running tool to complete, with a specified time out value. Note that if the timeout is exceeded this method will return, however the tool will continue to run. Also note that this method will not start the tool running if it is not already. | |
| RunStatus | RunAndWaitWithTimeout (double timeOutSeconds) |
| Starts the tool running, and waits for it to complete with the specified timeout value. Note that if the timeout is exceeded this method will return, however the tool will continue to run. | |
Properties | |
| int | NumberOfSequences [get] |
| The number of sequences currently defined in the sequence list. | |
| ISequenceGenerationSettings | GenerationSettings [get, set] |
| Get or set the settings interface for sequence generation. | |
Properties inherited from ZOSAPI.Tools.ISystemTool | |
| int | Progress [get] |
| Gets the progress of the current tool, if supported. | |
| string | Status [get] |
| Gets the status of the current tool, if supporoted. | |
| bool | IsRunning [get] |
| Gets a value indicating whether the tool is currently running asynchronously. | |
| bool | CanCancel [get] |
| Gets a value indicating whether the tool can be cancelled. | |
| bool | IsAsynchronous [get] |
| Gets a value indicating whether the tool runs asynchronously (i.e. on a thread). | |
| bool | IsFiniteDuration [get] |
| Gets a value indicating whether this tool will complete on its own. | |
| bool | IsValid [get] |
| Gets a value indicating whether the input settings are valid. | |
| bool | Succeeded [get] |
| Gets a value indicating whether the tool execution succeeded. | |
| string | ErrorMessage [get] |
If Succeeded is false, get the error messages; otherwise, null. | |
Detailed Description
Tool interface for accessing and modifying NSC sequences, including options for generating sequences via different routines. This interface can be accessed via the relevant open method: IOpticalSystemTools.OpenSequenceSelector.
Member Function Documentation
◆ AddSequence() [1/2]
| void ZOSAPI.Tools.Sequences.ISequenceSelector.AddSequence | ( | IEnumerable< object > | sequence | ) |
Append a new sequence, specified as an iterable of objects which can be cast to either SequenceElement or string, to the sequence list.
- Parameters
-
sequence An iterable of objects to be processed.
- Exceptions
-
ArgumentException If the given sequence is invalid. InvalidCastException If sequence could not be cast appropriately.
◆ AddSequence() [2/2]
| void ZOSAPI.Tools.Sequences.ISequenceSelector.AddSequence | ( | string | sequence | ) |
Append a new sequence, specified in sequence string format, to the sequence list.
- Parameters
-
sequence A string in valid sequence format.
- Exceptions
-
ArgumentException If the given sequence string is invalid.
◆ ClearSequences()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.ClearSequences | ( | ) |
Remove all sequences.
◆ ContainsSequenceName()
| bool ZOSAPI.Tools.Sequences.ISequenceSelector.ContainsSequenceName | ( | string | name | ) |
Whether the sequence list holds a sequence with the specified name.
- Parameters
-
name Name of the sequence to search for.
- Returns
- True if the sequence exists, false otherwise.
◆ DeleteIncompleteSequences()
| int ZOSAPI.Tools.Sequences.ISequenceSelector.DeleteIncompleteSequences | ( | ) |
Delete all sequences which do not start with a source and end at a detector.
This will automatically rename all subsequent sequences which do not have custom names.
- Returns
- Number of sequences deleted.
◆ DeleteInvalidSequences()
| int ZOSAPI.Tools.Sequences.ISequenceSelector.DeleteInvalidSequences | ( | ) |
Delete all sequences which are invalid.
This will automatically rename all subsequent sequences which do not have custom names.
- Returns
- Number of sequences deleted.
◆ DeleteSequence()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.DeleteSequence | ( | int | index | ) |
Delete the sequence at the specified index.
This will automatically rename all subsequent sequences which do not have custom names.
- Parameters
-
index Index (zero-based) of the sequence to delete.
- Exceptions
-
IndexOutOfRangeException If index not in [0, NumberOfSequences)/>
◆ DeleteSequenceRange()
| int ZOSAPI.Tools.Sequences.ISequenceSelector.DeleteSequenceRange | ( | int | start, |
| int | end | ||
| ) |
Delete sequences in the index range [start, end).
This will automatically rename all subsequent sequences which do not have custom names.
- Parameters
-
start Index of first sequence in the range to delete. end One past-the-end index of last sequence in the range to delete.
- Returns
- Actual number of sequences deleted.
◆ DeleteSequences()
| int ZOSAPI.Tools.Sequences.ISequenceSelector.DeleteSequences | ( | IEnumerable< int > | indices | ) |
Delete the sequences at each specified index. This can be used to conveniently delete multiple sequences, perhaps filtered by some custom condition, without needing to manually loop and take account of changing indices.
This will automatically rename all subsequent sequences which do not have custom names.
- Parameters
-
indices Iterable of indices to delete. Any values, in this iterable, which are greater than or equal to NumberOfSequences will be ignored.
- Returns
- Actual number of sequences deleted.
◆ DeleteSequencesBelowFlux()
| int ZOSAPI.Tools.Sequences.ISequenceSelector.DeleteSequencesBelowFlux | ( | double | minFlux | ) |
Delete all sequences which have a flux value less than a given threshold.
This will automatically rename all subsequent sequences which do not have custom names.
- Parameters
-
minFlux Minimum flux value.
- Returns
- Number of sequences deleted.
◆ DisableSequence()
| bool ZOSAPI.Tools.Sequences.ISequenceSelector.DisableSequence | ( | int | index | ) |
Disable the sequence at the specified index.
- Parameters
-
index Index (zero-based) of the sequence to disable.
- Returns
- True if the sequence was successfully disabled, false otherwise.
◆ EnableSequence()
| bool ZOSAPI.Tools.Sequences.ISequenceSelector.EnableSequence | ( | int | index | ) |
Enable the sequence at the specified index.
- Parameters
-
index Index (zero-based) of the sequence to enable.
- Returns
- True if the sequence was successfully enabled, false otherwise.
◆ FindSequenceByName()
| ISequence ZOSAPI.Tools.Sequences.ISequenceSelector.FindSequenceByName | ( | string | name | ) |
Get the sequence with the specified name.
- Parameters
-
name Name of the sequence to search for.
- Returns
- A copy of the sequence data.
- Exceptions
-
KeyNotFoundException If no sequence with the given name is found.
◆ GetSequenceAt()
| ISequence ZOSAPI.Tools.Sequences.ISequenceSelector.GetSequenceAt | ( | int | index | ) |
Get the sequence at the specified index.
- Parameters
-
index Index (zero-based) of the sequence to retrieve.
- Returns
- A copy of the sequence data.
- Exceptions
-
IndexOutOfRangeException If index not in [0, NumberOfSequences)/>
◆ IndexOfSequenceName()
| int? ZOSAPI.Tools.Sequences.ISequenceSelector.IndexOfSequenceName | ( | string | name | ) |
Get the index of the sequence with the specified name.
- Parameters
-
name Name of the sequence to search for.
- Returns
- The sequence index if it exists.
◆ InsertSequencesFromFile()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.InsertSequencesFromFile | ( | string | filePath | ) |
Insert sequences from a JSON file. These will be added to the currently held sequence list on success.
- Parameters
-
filePath Path to the sequences file to load.
- Exceptions
-
ArgumentException If filePath is invalid, or loading fails for any reason.
◆ LoadSequences()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.LoadSequences | ( | string | filePath | ) |
Load sequences from a JSON file. These will replace the currently held sequences on success.
- Parameters
-
filePath Path to the sequences file to load.
- Exceptions
-
ArgumentException If filePath is invalid, or loading fails for any reason.
◆ OffsetObjectNumbersInSequence() [1/2]
| int ZOSAPI.Tools.Sequences.ISequenceSelector.OffsetObjectNumbersInSequence | ( | int | index, |
| int | startAtObject, | ||
| int | endAtObject, | ||
| int | off | ||
| ) |
Shift the object number values of all entries, starting from startAtObject and ending at endAtObject (non-inclusive), in the sequence at the specified index.
This method can be used to easily fix sequences which have been invalidated through modifications to the NCE. For example, one could call this with off set to -1 after removing an object from the NCE.
- Parameters
-
index Index (zero-based) of the sequence to adjust. startAtObject Object number to start offsets from in the sequence. endAtObject Object number to end offsets at (non-inclusive) in the sequence. off The value by which to offset the object numbers.
- Returns
- The number of entries in the sequence which were modified.
- Exceptions
-
ArgumentException If the new, modified sequence is invalid.
◆ OffsetObjectNumbersInSequence() [2/2]
| int ZOSAPI.Tools.Sequences.ISequenceSelector.OffsetObjectNumbersInSequence | ( | int | index, |
| int | startAtObject, | ||
| int | off | ||
| ) |
Shift the object number values of all entries, starting from startAtObject, in the sequence at the specified index.
This method can be used to easily fix sequences which have been invalidated through modifications to the NCE. For example, one could call this with off set to -1 after removing an object from the NCE.
- Parameters
-
index Index (zero-based) of the sequence to adjust. startAtObject Object number to start offsets from in the sequence. off The value by which to offset the object numbers.
- Returns
- The number of entries in the sequence which were modified.
- Exceptions
-
ArgumentException If the new, modified sequence is invalid.
◆ RenameSequence()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.RenameSequence | ( | int | index, |
| string | newName | ||
| ) |
Rename the sequence at the specified index.
- Parameters
-
index Index (zero-based) of the sequence to rename. newName New name to give the sequence.
- Exceptions
-
ArgumentException If the given new name is invalid.
◆ ReplaceSequence() [1/2]
| void ZOSAPI.Tools.Sequences.ISequenceSelector.ReplaceSequence | ( | int | index, |
| IEnumerable< object > | sequence | ||
| ) |
Replace the sequence at the specified index with a new sequence, specified as an iterable of objects which can be cast to either SequenceElement or string.
- Parameters
-
index Index (zero-based) of the sequence to replace. sequence An iterable of objects to be processed.
- Exceptions
-
ArgumentException If the given sequence is invalid. InvalidCastException If sequence could not be cast appropriately.
◆ ReplaceSequence() [2/2]
| void ZOSAPI.Tools.Sequences.ISequenceSelector.ReplaceSequence | ( | int | index, |
| string | sequence | ||
| ) |
Replace the sequence at the specified index with a new sequence specified in filter format.
- Parameters
-
index Index (zero-based) of the sequence to replace. sequence A string in valid sequence format.
- Exceptions
-
ArgumentException If the given sequence string is invalid.
◆ SaveSequences()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.SaveSequences | ( | string | filePath, |
| bool | formatted = false |
||
| ) |
Save all the sequences to a JSON file.
- Parameters
-
filePath Path to save the sequences to in JSON format. formatted Whether to pre-format the written JSON content in a human-readable format.
- Exceptions
-
ArgumentException If filePath is invalid, or saving fails for any reason.
◆ SelectFromPathAnalysisGeneration()
| IFromPathAnalysisGenerationSettings ZOSAPI.Tools.Sequences.ISequenceSelector.SelectFromPathAnalysisGeneration | ( | ) |
Create a new settings object for the from pre-run Path Analysis generator option, and set the GenerationSettings property to this to select this method of generation.
- Returns
◆ SelectStraightThroughPathsGeneration()
| IStraightThroughPathsGenerationSettings ZOSAPI.Tools.Sequences.ISequenceSelector.SelectStraightThroughPathsGeneration | ( | ) |
Create a new settings object for the straight through paths generator option, and set the GenerationSettings property to this to select this method of generation.
- Returns
◆ SelectViaZRDOrPAFGeneration()
| IViaZRDOrPAFGenerationSettings ZOSAPI.Tools.Sequences.ISequenceSelector.SelectViaZRDOrPAFGeneration | ( | ) |
Create a new settings object for the via ZRD or PAF file generator option, and set the GenerationSettings property to this to select this method of generation.
- Returns
◆ SortByAscendingFlux()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.SortByAscendingFlux | ( | ) |
Sort the sequences in order of descending ISequence.Flux values.
This will automatically rename any sequence which does not have a custom name.
Note: any sequences with NaN flux will always appear after non-NaN flux sequences.
◆ SortByAscendingNumDiffractions()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.SortByAscendingNumDiffractions | ( | ) |
Sort the sequences in order of ascending number of diffraction events.
This will automatically rename any sequence which does not have a custom name.
◆ SortByAscendingSize()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.SortByAscendingSize | ( | ) |
Sort the sequences in order of ascending number of entries.
This will automatically rename any sequence which does not have a custom name.
◆ SortByDescendingFlux()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.SortByDescendingFlux | ( | ) |
Sort the sequences in order of ascending ISequence.Flux values.
This will automatically rename any sequence which does not have a custom name.
Note: any sequences with NaN flux will always appear after non-NaN flux sequences.
◆ SortByDescendingNumDiffractions()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.SortByDescendingNumDiffractions | ( | ) |
Sort the sequences in order of descending number of diffraction events.
This will automatically rename any sequence which does not have a custom name.
◆ SortByDescendingSize()
| void ZOSAPI.Tools.Sequences.ISequenceSelector.SortByDescendingSize | ( | ) |
Sort the sequences in order of descending number of entries.
This will automatically rename any sequence which does not have a custom name.
◆ Undo()
| bool ZOSAPI.Tools.Sequences.ISequenceSelector.Undo | ( | ) |
Defined for internal testing purposes.
- Returns
- True if the last operation (if any) was undone successfully.
Property Documentation
◆ GenerationSettings
|
getset |
Get or set the settings interface for sequence generation.
The settings object used here determines which sequence generation method is used when running the tool.
◆ NumberOfSequences
|
get |
The number of sequences currently defined in the sequence list.
Public Member Functions inherited from